Skip to content
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

Transmutation Table hanging the client when too many updates to EMC happen #2364

Open
IRicTheCoder opened this issue Sep 22, 2024 · 1 comment

Comments

@IRicTheCoder
Copy link

Tickets that do not conform to this template will be closed without comment

Exact ProjectE version (do not say "latest", "latest on Curse", or similar): 1.20.1-PE1.0.1

Exact Forge version: 47.3.7

Link to crash log (please use a paste site, do not attach the .txt or paste the log inline): There isn't one as the client hangs until it either crashes from Out of Memory (which is rare, and does not provide any files not even a process pid log) or is force closed, no crash reports, or logs get generated from that.

Steps to reproduce:

  1. Install Both ProjectE and ProjectExpansion (or any other mod that allows for the EMC value to be automatically updated for the player);
  2. Add a bunch of EMC Links or other things that cause updates to the EMC (make sure you have a few of them like around 50 or so);
  3. Apply the tome of knowledge;
  4. It hangs the client;

What I expected to happen:
Maybe use Async methods to search for the items to add or remove, have a cached list to make it easier, or even block the update of the tablet to only run on open, or every X amount of time. This would most likely prevent the client hanging.

Couldn't test much more so I can't be sure if there are more factors involved, but the not hanging is the behavior I would expect.

As a side note, I would suggest making the item list update only run when the tablet is open or when the player puts an item into it or takes an item, instead of every time the EMC value updates.

What happened instead:
What is happening is pretty simple to explain, and seems to happen mainly when using ProjectExpansion with ProjectE, since there isn't a way to generate a lot of updates to the EMC value without it.

When you have a few EMC Links pulling and pushing in and out of the EMC, and you open the tablet with a lot of items learned, or in the case of our tests with the Tome of Knowledge learned, it hang the client.

In a world with less than 50 Links, and using a simple debugger to read the calls, the tablet runs more than 3 thousand calls in terms of instructions, to update the value, the items that display based on the EMC value and for sorting.

We tested a lot of things as this issue started happening in Project Architect 2, from using Links or not, Transmutation Interfaces or not, Collectors (which aren't in the modpack but I tested them), at the end the number of updates seem to be the driver for the issue.

Increasing the time it takes for the ProjectExpansion Links to run doesn't seem to be enough to fix it.

NOTE: The reason why I am posting this issue here, is because it is related mainly to how the table seems to be handling updates, which is, in my opinion, more related to ProjectE itself then its addons.

@James103
Copy link

Also, any additional EMC/knowledge sync packets received while processing one such packet will be added to the queue, with no limit on the number of such packets in the queue.
Each time a player's EMC value is updated, including through commands and EMC Links, an EMC/knowledge sync packet is sent to that player, with no limit on the number of such packets sent per tick.

Example result from OP's setup (all of this happens in the same frame on the client, but across many ticks serverside):

  • 1st EMC/knowledge sync packet received.
  • Processing 1st EMC/knowledge sync packet...
    • While processing: 2nd EMC/knowledge sync packet received
    • While processing: 3rd EMC/knowledge sync packet received
  • Processing 2nd EMC/knowledge sync packet...
    • While processing: 4th EMC/knowledge sync packet received
    • While processing: 5th EMC/knowledge sync packet received
  • Processing 3rd EMC/knowledge sync packet...
    • While processing: 6th EMC/knowledge sync packet received
    • While processing: 7th EMC/knowledge sync packet received
  • ...

Even though the EMC/knowledge sync packets are being processed one after another, they can be received far faster than can be processed, especially if a Transmutation Table is open (whose GUI updates from every packet). If this continues automatically due to EMC Links, the resulting backlog grows endlessly, causing an infinite loop and client hang.

Would it be possible to throttle the processing of EMC/knowledge sync packets so that the list of transmutable items only updates once per frame, instead of potentially many (or infinite) times per frame?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants