-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix packet duplicating at some points #8566
Conversation
I can confirm this bug cause user kicked by reason Invalid move player packet received. Everything works properly with patched Paper build. also may be related to |
c0cc8d7
to
d326f8c
Compare
Changes fixing issues induced by patches should go into the original patch, rather than as an extra patch down the line; I'm also not fond of this fix as it's not really fixing the underlying issue, really, that loop needs changing back into a peek/poll loop which will properly manage the queue rather than trying to mangle it with state flags |
Thanks for the suggestion! I will made this change to previous patches and change it back to poll loop, and seems this change conflicted with couples patches, it will need some time to done. |
The poll loop will not fix this either. There's no way to use CLQ with some kind of conditional poll logic, which is why the iterator was used. However, the iterator doesn't actually fix the issue as it does not indicate to the caller whether the node was actually removed by the remove() call or was already removed. You can fix this issue by using an AtomicBoolean on the PacketHolder class and use getAndSet(true) to atomically mark a packet as sent and check if it was already sent. |
Originally I want to use an variable with mutex to save the unready packet and restore to poll loop, but I found it's bad for readability and maintainability, because it needs change all packet queue related stuff to made it behave normally, which brings more code changes and more complex than the original one. So I choose just merge current changes to original patch and apply the suggestion from Spottedleaf (Thanks for it!), change the variable type to AtomicBoolean, also think more about muti-threading - let it become the Test jar will be updated later, it needs sometime to build. |
Emmmm, look like the patch file is broken for incorrectly conflict solving, will fix it later |
c999e15
to
69c0108
Compare
Tested with the newest changes and seems still work for me, now this PR is ready for review again, paper build also was updated for testing. |
It has been 9 days, When this PR will be merged? Does it require me to do any extra things? |
They aproved it, probably they're just waiting for some other reviewer? |
I had a short convo with a paper mod on Sunday about this issue because I need it to be merged too and they said "Can be next hour or in 2023, we cant really tell" but I don't know why |
we are volunteers, we do this in our free time, we can't ever give estimates on anything. we have a giant queue of open PRs that the team is slowly churning thru now (first time below 200 in a looong time!), but it takes time. |
Due to the weakly consistent of ConcurrentLinkedQueue iterator, at some points, packet will be resent twice times or more, causing some weird behaviors (e.g. kicked for illegal movement since the same ClientboundPlayerPositionPacket was sent two times). This changes for the patch add a flag for marking if the packet was consumed to prevent such issue and ensure consistently of the packet queue.
In the future, please open PRS on other branches as the master branch makes it a little harder for us to work with your PR. 😄 |
Oh, sorry for that, I will create the another branch other than master when opening another PRs. |
No worries, thank you for your contribution regardless. |
Overview:
Due to the weakly consistent of ConcurrentLinkedQueue iterator, at some points, packet will be resent twice times or more, causing some weird behaviors (e.g. kicked for illegal movement since the same ClientboundPlayerPositionPacket was sent two times). This changes for the patch add a flag for marking if the packet was consumed to prevent such issue and ensure consistently of the packet queue.
Related issue:
PotatoCraft-Studio/QuickShop-Reremake#255
QuickShop-Community/QuickShop-Hikari#517
Related logs (By adding debug log):
https://pastebin.com/eqfsz2kn
Paper build for testing (Updated):
https://mega.nz/file/BwA3HC7I#qZgM8b93X0NKiidE3prUFZkg7aqdetgS3jiLgu8r-K4
Additional Information:
Spigot does not have this issue because the original one is using
poll
method, and paper is usingiterator
for anti-xray feature.Download the paperclip jar for this pull request: paper-8566.zip