ProtocolSupport / ProtocolSupportPocketIssues

Issue-tracker for ProtocolSupport pocket edition.
6 stars 0 forks source link

Serverbound packet freeze #20

Closed WesleyVanNeck closed 5 years ago

WesleyVanNeck commented 6 years ago

without psps it just froze under heavy nbt remaping and some other shit here is the log latest.log

7kasper commented 6 years ago

Please help find if there is any consistancy in when this happens.

WesleyVanNeck commented 6 years ago

@7kasper it's happening if the server get to much overloaded with nbt remapping and player handling

WesleyVanNeck commented 6 years ago

And it's happening with 1 player online ^_^

WesleyVanNeck commented 6 years ago

here is some tps

TPS from last 1m, 5m, 15m: 19.97, 19.96, 19.95

and here are the timings https://timings.aikar.co/?id=b6fbebf1dc0142809152629d8ffc46d3

WesleyVanNeck commented 6 years ago

@7kasper its protocollib what is causing the server boundpacket freeze

WesleyVanNeck commented 6 years ago

And its freeze of CPU maxt out or like 70% of cpu

WesleyVanNeck commented 6 years ago

If I set my primary tread priorities to number 1 priority it will not freeze for some reason

WesleyVanNeck commented 6 years ago

So its possible to be to much load on the server and so it freeze

7kasper commented 6 years ago

@7kasper its protocollib what is causing the server boundpacket freeze

Oh this is quite possible! That helps. I'll try to check it out in the upcoming holiday.

magicus commented 6 years ago

I'm not sure if this is what I'm seeing, or if I have some other issue. I'm frequently encountering a problem where the client seems to stop sending packets to the server. (I assume this is "serverbound packets"). I can move around fine in the PE client, but nothing I do (e.g. place blocks) affect the server, and inventory stuff (like opening a chest) does not work.

This happens on my development laptop, with just a single PE player connected. There is no high CPU load. If happens frequently, and often just within minutes of logging in. I believe it can be related to my actions on the PE client, but I've found no way to reproduce it for sure.

magicus commented 6 years ago

Or does the "freeze" in this bug mean that the server freeze? Because that's not what I'm seeing, I can log out and then log in again and the server works fine; it's just the connection to PE that dies.

magicus commented 6 years ago

The freeze, at least the one I've seen, is triggered by the latest versions of RakNet.

This patch is a workaround, that uses an older version of RakNet which is more lenient in handling lost packets:

https://github.com/magicus/ProtocolSupport/commit/fcb2b5951ee0d3d32812204b0b8f8f23d875a775

magicus commented 5 years ago

Here's a short summary of the current situation on this bug that I posted on discord.

The freeze is a long standing problem. The symptom is this: the client sends packets to the server about what it is doing, but they never reach the PSPE processing, but gets stuck in RakNet (or something like that).

RakNet confirms the packets, so the client still consider itself connected. It still gets updates from the server. But nothing the PE player does get registered at the server.

This can be hard to detect, since the PE client has a lot of autonomy. So if the player move, the client updates the view. If the player places a block, the client shows it as placed. But it never reaches the server. To test if this happens, my litmus test is usually to try to open a chest. This must involve a response from the server. If nothing happens, I know the connection is frozen.

Different users seem to experience this with varying frequency. For me, it happens almost always within a few minutes. It happens on join for others, or later.

We know a bit what causes this. The idea is that it's triggered by multiple packets with tp or location change, that gets queued up, reordered, or lost.

We have tracked down where this started happening. Shevchik removed code in his RakNet library, that provided some kind of "forgiving" behavior for out of order packets. (This was in https://github.com/Shevchik/RakNetServer/commit/71ee2b558c48d7e1ba6dcbab8433fffd75065aad).

We've had some discussions about this. I believe the code should be there, since it helps the game actually work. Shevchik argues that the problem is solved at the wrong level, and that this kind of packet issues should be resolved elsewhere than in the RakNet library. Since I don't understand RakNet very well, I assume that he is right. There have been multiple attempts at resolving this in PSPE, but none have worked 100% satisfactory. I personally do my development of PSPE on a personal branch, where I've rolled back to the older, working, RakNet library.

magicus commented 5 years ago

The current suggested workaround is to apply this patch to RakNetServer: https://github.com/Shevchik/RakNetServer/pull/3

colinrgodsey commented 5 years ago

definitely fixed in the new raknet... closing this out as we now have a know fix

current PR: https://github.com/Shevchik/RakNetServer/pull/4

magicus commented 5 years ago

@colinrgodsey But this PR is still not merged in RakNey, yes? Until it is, I think we should keep this open as a tracking bug.

7kasper commented 5 years ago

How's this right now? Has raknet been patched yet?

WesleyVanNeck commented 5 years ago

This is fixed so idk why it open still