ldtteam / minecolonies

Minecolonies minecraft mod
http://minecolonies.com/
GNU General Public License v3.0
655 stars 336 forks source link

Crash when opening postbox #3937

Closed RyTechro closed 4 years ago

RyTechro commented 4 years ago

Minecolonies version

Version: Up to date with branch version/1.14 so 0.10.432??

Expected behavior

The postbox loads smooth and doesn't overflow the open file buffer

Actual behaviour

If you place down a postbox and open it it takes a short while before the inventory fully loads. If you open the postbox a lot of times like 10 times the game crashes.

Steps to reproduce the problem

  1. Create world
  2. Place townhall
  3. Place postbox
  4. Open the postbox 10 times
  5. ... Profit

Crash log

https://gist.github.com/RyTechro/f823fbd7aee2a1a112248ae42b33ba8e

Raycoms commented 4 years ago

Crash log please

Am Di., 15. Okt. 2019 um 15:26 Uhr schrieb TechRo <notifications@github.com

:

Minecolonies version

Version: Up to date with branch version/1.14 so 0.10.432?? Expected behavior

The postbox loads smooth and doesn't overflow the open file buffer Actual behaviour

If you place down a postbox and open it it takes a short while before the inventory fully loads. If you open the postbox a lot of times like 10 times the game crashes. Steps to reproduce the problem

  1. Create world
  2. Place townhall
  3. Place postbox
  4. Open the postbox 10 times
  5. ... Profit

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ldtteam/minecolonies/issues/3937?email_source=notifications&email_token=ABRD3S2VT2S2YSBVDYERXJ3QOYDNRA5CNFSM4JBAKK52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HR6OKMQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRD3S75B6PXK7NLNXD42HDQOYDNRANCNFSM4JBAKK5Q .

RyTechro commented 4 years ago

My apologies:

https://gist.github.com/RyTechro/f823fbd7aee2a1a112248ae42b33ba8e

Raycoms commented 4 years ago

Seems like a memory overflow issue. It's because the postbox filters all blocks in the game and that's slow. I have to find a better way on how to handle that.

Am Di., 15. Okt. 2019 um 15:36 Uhr schrieb TechRo <notifications@github.com

:

My apologies:

https://gist.github.com/RyTechro/f823fbd7aee2a1a112248ae42b33ba8e

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ldtteam/minecolonies/issues/3937?email_source=notifications&email_token=ABRD3S4LVSVNY6CSWMUUBJTQOYESPA5CNFSM4JBAKK52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBJZFIY#issuecomment-542347939, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRD3S67UPPSID36WBCHUV3QOYESPANCNFSM4JBAKK5Q .

Raycoms commented 4 years ago

We got a similar issue open to this already so I'll close this here. But we're working on making this more scaleable.

RyTechro commented 4 years ago

If it's a memory issue something is not cleaned out correctly on closing the ui. The issue also rises when opening the postbox enough times just before it crashes and then opening a different UI

Raycoms commented 4 years ago

I'd suspect the garbage collector hasn't finished cleaning it up yet.

Am Di., 15. Okt. 2019 um 15:44 Uhr schrieb TechRo <notifications@github.com

:

If it's a memory issue something is not cleaned out correctly on closing the ui. The issue also rises when opening the postbox enough times just before it crashes and then opening a different UI

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ldtteam/minecolonies/issues/3937?email_source=notifications&email_token=ABRD3SZMC2ZIOPQPN4V76TLQOYFPLA5CNFSM4JBAKK52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBJZ5GQ#issuecomment-542351002, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRD3S6PKG5VBO5FLM2AJFLQOYFPLANCNFSM4JBAKK5Q .

RyTechro commented 4 years ago

The issue also occurs if the inventory opens are spread over like an hour. Is this consistent with your theorie?

Raycoms commented 4 years ago

That sounds weird, good job debugging this =D Opening this up a long time afterwards =D

Am Di., 15. Okt. 2019 um 16:04 Uhr schrieb TechRo <notifications@github.com

:

The issue also occurs if the inventory opens are spread over like an hour. Is this consistent with your theorie?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ldtteam/minecolonies/issues/3937?email_source=notifications&email_token=ABRD3S45L5G2RIXYJZ3JKBLQOYH47A5CNFSM4JBAKK52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBJ352Q#issuecomment-542359274, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRD3SZVEOYCPB65BD2OXLLQOYH47ANCNFSM4JBAKK5Q .

Raycoms commented 4 years ago

I checked through the code, can't see anything where memory could leak.

Am Di., 15. Okt. 2019 um 16:10 Uhr schrieb Ray Neiheiser < ray.neiheiser@gmail.com>:

That sounds weird, good job debugging this =D Opening this up a long time afterwards =D

Am Di., 15. Okt. 2019 um 16:04 Uhr schrieb TechRo < notifications@github.com>:

The issue also occurs if the inventory opens are spread over like an hour. Is this consistent with your theorie?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ldtteam/minecolonies/issues/3937?email_source=notifications&email_token=ABRD3S45L5G2RIXYJZ3JKBLQOYH47A5CNFSM4JBAKK52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBJ352Q#issuecomment-542359274, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRD3SZVEOYCPB65BD2OXLLQOYH47ANCNFSM4JBAKK5Q .

RyTechro commented 4 years ago

That too many open files warning feels like its to blame for this.

[20:34:35] [Client thread/WARN] [structurize:blockout/]: java.nio.file.FileSystemException: /Users/robindejong/Desktop/ModdedMinecraftDevelopment/minecolonies/build/resources/main/assets/minecolonies/textures/gui/builderhut/builder_button_small.png: Too many open files

Could it be that when rendering all the files for the GUI of the postbox it opens all the icons it needs for the display and afterwards never closes them?

On second thought; its always this builder_button_small.png file. Is that loaded inside a loop that behaves unexpectedly?

RyTechro commented 4 years ago

After looking into this even more I belief BlockOut is to blame for this crash. Is there a way I can make a test interface with a lot of buttonimages to isolate this issue?

Also you said this issue would be reopend; but it isn't yet

Raycoms commented 4 years ago

Yes, there are xml files in the mod which have the GUIs you can simply add a lot of buttonimages to one of these xmls and load them. Afaik you should be able to override those gui files with a resource pack as well and add your own interace on top of an existing one.

Raycoms commented 4 years ago

I checked into it, and debugged it, I opened the GUI many times and the quantity of buttonImages in the memory stayed the same, so I believe it is because we're drawing so many of them and the GC doesn't have time to clean them all up. So yeah, we have to optimize this GUI in general to only display and render those we need. The best thing is probably to make it pages and not a scrolling list.

Raycoms commented 4 years ago

Fix pushed