InvMenu icon indicating copy to clipboard operation
InvMenu copied to clipboard

Some time the whole HUD vanish

Open dadodasyra opened this issue 3 years ago • 10 comments

It seems that the #188 is still a thing. Honestly I don't understand why because even PMMP was saying it's fixed, but i'm still having the issue with some players (which I assume have a bad connection and/or a bad computer) where some times their HUD just disappear. I understand there's a lack of information but except that I use removeCurrentWindow on play I can actually not say much more on this.

I'm using last up to date version PM4 and InvMenu version. If you have maybe a debug way where I can help with, tell me. Thx

dadodasyra avatar Oct 13 '22 19:10 dadodasyra

After some investigation I managed to get some more informations on the initial cause of this bug. Bedrock protocol is pretty strange so when the server wants to close an interface it do something like this (c is client, s is server): 1.s->c ContainerClosePacket {server true} 2. c->s ContainerClosePacket (act as a acknowledgment of receipt I guess) 3. s->c ContainerClosePacket {server false}

I managed to reproduce the same bug as the initial in the issue by cancelling the sending of the packet in the step 3, the UI is closing correctly but the client cannot open any inventory anymore.

My guess is that the initial issue is way more frequent with people with bad connexions. I'm using a fiber connection with a maximum of 20ms with my server. Some players on mobile with online data is probably way more affected by this issue. By spamming inventory opening maybe some packets are not sended in the good order.

The only "fix" (which is more a workaround as a fix) that I see would be to manually packet sending/receiving. There's probably a better way to fix it, the best way would be that Mojang fix this issue which is clearly client side, and I guess the easiest way would be that PocketMine-MP fix that's somewhere in the core.

Any idea @Muqsit, @thebigsmileXD or @dktapps ?

dadodasyra avatar Nov 08 '22 17:11 dadodasyra

I understand there's a lack of information but except that I use removeCurrentWindow on play I can actually not say much more on this.

does it work without? Afaik you should use close() anyways.

inxomnyaa avatar Nov 08 '22 19:11 inxomnyaa

does it work without? Afaik you should use close() anyways.

I can't really tell you or test anything, the thing is that this is pretty random and I cant actually reproduce it myself, but I have multiple players who has this problem randomly.

dadodasyra avatar Nov 08 '22 20:11 dadodasyra

And no It will not close the interface without it, it's actually the goal of removeCurrentWindow.. close the interface.. So if I remove it no it will not trigger anything x)

dadodasyra avatar Nov 08 '22 20:11 dadodasyra

I don't really see why the packets would be incorrectly ordered. Since https://github.com/pmmp/PocketMine-MP/commit/554f96bc249b50698229d525025a32b4275c46f1 the server defers opening new windows until the old one has been closed and acked, so you can't have two windows open at the same time.

The only reason why this would be happening in PM is if you were manually sending your own ContainerOpen or ContainerClose without using InventoryManager's system.

dktapps avatar Nov 09 '22 12:11 dktapps

I should also mention for completeness' sake that InvCrashFix is no longer useful, and is now harmful rather than helpful.

dktapps avatar Nov 09 '22 12:11 dktapps

I dont know anything more. I'm not using InvCrashFix and I don't use ContainerOpen in my code.. so.. guess it's my proxy who's taking drugs

dadodasyra avatar Nov 11 '22 11:11 dadodasyra

I have not experienced or been able to reproduce this issue as of yet. Are you still encountering the issue? If so, could you please confirm the following details:

  • Is the plugin responsible for this issue using the latest version of InvMenu?
  • Are you using $player->removeCurrentWindow() to close the menu? Some users invoke methods in PlayerSession instead to close the menu which isn't the right way.
  • Are any of your plugins handling DataPacketSendEvent for ContainerClosePacket? It's possible that they may be causing an issue.

Muqsit avatar Jan 03 '23 15:01 Muqsit

Damn Sorry for this late response. As far as I know I'm using the latest version of InvMenu. I updated all my libs on 08/08/22 so I guess I'm good on this. Yes I always use removeCurrentWindow but maybe some time I call it twice I don't really know. Yes some plugins are using DataPacketSendEvent but never for ContainerClosePacket.

It's still probably a thing but I guess it's based on performance, TPS or client computing or both. As I remember the majority of the case where on PS4 so I guess with a slower client, I don't really know, but I know some people did it on Windows and me too with a NASA PC. I will quote this issue on my bug forum maybe some people will add their experience with it. The thing is I don't know how to reproduce it and it seems pretty random.

dadodasyra avatar Jan 14 '23 19:01 dadodasyra

Could this be related to a situation like this :

  1. Open inv A
  2. Player sends close of inv A
  3. Server sends close of inv A
  4. Server sends inv B
  5. Server receives the close of the player at step two
  6. Player receives inv B but server confirm the closing of inv B due to 5

Or something like this ? I don't know if it's really possible because interfaces should have differents IDs.. but if the client close the main GUI it's because it's already doing something wrong somewhere. I managed to reproduce the ID of the main GUI being closed (but my hotbar was still there) by using clumsy with lag (ping) drop of packets nad throttle and by spamming E while opening boxes (which close the interface after the interface and reopen again an interface with the next box). I should try this by logging packets but it takes.. time, and is really random asf.

dadodasyra avatar Feb 11 '23 21:02 dadodasyra