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

NEI Item List Search occasionally breaks #18642

Closed
1 of 3 tasks
lailani-f opened this issue Jan 4, 2025 · 0 comments
Closed
1 of 3 tasks

NEI Item List Search occasionally breaks #18642

lailani-f opened this issue Jan 4, 2025 · 0 comments

Comments

@lailani-f
Copy link

Your GTNH Discord Username

cure.starlight

Your Pack Version

Nightly 804

Your Server

Zeta

Java Version

Java 21

Type of Server

Don't know

Your Expectation

NEI Item Search to work reliably.

The Reality

NEI Search sometimes stops working. It won't start working again until the client is restarted.

In the logs

[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]: java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.HashMap.get(Object)" is null
[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]:     at Launch//codechicken.nei.ItemList$3.compare(ItemList.java:391)
[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]:     at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]:     at java.base/java.util.TimSort.sort(TimSort.java:234)
[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]:     at java.base/java.util.Arrays.sort(Arrays.java:1308)
[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]:     at java.base/java.util.ArrayList.sort(ArrayList.java:1804)
[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]:     at Launch//codechicken.nei.ItemList$3.execute(ItemList.java:412)
[NEI Item Filtering/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:785]:     at Launch//codechicken.nei.RestartableTask$1.run(RestartableTask.java:25)

Method in question: https://github.com/GTNewHorizons/NotEnoughItems/blob/master/src/main/java/codechicken/nei/ItemList.java#L236
It might be a race condition between the two tasks loadItems and updateFilter when loadItems gets triggered while updateFilter is still running. In this case loadItems empties the HashMap that updateFilter relies on effectively causing the NPE during comparison operations.

I was unable to reproduce the issue reliably but it can happen when switching dimensions.

Your Proposal

Ensure the NPE cannot occur.

Final Checklist

  • I have searched this issue tracker and there is nothing similar already. Posting on a closed issue saying the bug still exists will prompt us to investigate and reopen it once we confirm your report.
  • I can reproduce this problem consistently by follow the exact steps I described above, or this does not need reproducing, e.g. recipe loophole.
  • I have asked other people and they confirm they also have this problem by follow the exact steps I described above, or this does not need reproducing, e.g. recipe loophole.
@lailani-f lailani-f added Bug: Minor Status: Triage Issue awaiting triage. Remove once this issue is processed labels Jan 4, 2025
@chochem chochem added Mod: NEI and removed Status: Triage Issue awaiting triage. Remove once this issue is processed labels Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants