mojira.dev
MC-153355

java.util.NoSuchElementException ticking entity crash when a workstation is destroyed near a villager with a job

NOTE: This bug is different from MC-145686, but could be related. MC-145686 was about java.util.Optional.get(Optional.java:135), this one is about it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet.removeFirstLong (LongLinkedOpenHashSet.java:470) gotten in a near-similar environment.

Environment
Have a villager with a job near a workstation (preferably within a 1-block radius). Attached (

[media]

) is the world I used. At -83 / -12 is a pit with a villager. This is where I performed my testing.

How to reproduce
To trigger the crash, one commonly needs to quickly destroy and place the workstation. This will cause the villager to quickly switch from being a nitwit and the job belonging to the workstation.

In the snapshots of 1.14, this crash seems to be fairly easy to reproduce, as the villager keeps its job for longer or even doesn't become a nitwit once its workstation is destroyed. In 1.14.2, villagers switch quickly between nitwit and having a job, thus it requires more destroying and placing (and more time to reproduce). Suggestion is, taken from the comments about this bug on MC-145686, to map the place and destroy buttons to keys near each other, for example E and F for placing and destroying, respectively.

Crash logs
1.14.2 server crash log:

[media]

---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 29-5-19 16:34
Description: Exception ticking world

java.util.NoSuchElementException
	at it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet.removeFirstLong(LongLinkedOpenHashSet.java:470)
	at ckn.b(SourceFile:194)
	at aqh$a.a(SourceFile:247)
	at aqh.a(SourceFile:154)
	at us.a(SourceFile:384)
	at ve.a(SourceFile:295)
	at vg.a(SourceFile:310)
	at net.minecraft.server.MinecraftServer.b(SourceFile:827)
	at net.minecraft.server.MinecraftServer.a(SourceFile:764)
	at dxk.a(SourceFile:128)
	at net.minecraft.server.MinecraftServer.run(SourceFile:632)
	at java.lang.Thread.run(Thread.java:745)

1.14.2 game log (anonimised):

[media]

[16:34:45] [Server thread/ERROR]: Encountered an unexpected exception
m: Exception ticking world
	at net.minecraft.server.MinecraftServer.b(SourceFile:831) ~[1.14.2.jar:?]
	at net.minecraft.server.MinecraftServer.a(SourceFile:764) ~[1.14.2.jar:?]
	at dxk.a(SourceFile:128) ~[1.14.2.jar:?]
	at net.minecraft.server.MinecraftServer.run(SourceFile:632) [1.14.2.jar:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]
Caused by: java.util.NoSuchElementException
	at it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet.removeFirstLong(LongLinkedOpenHashSet.java:470) ~[fastutil-8.2.1.jar:?]
	at ckn.b(SourceFile:194) ~[1.14.2.jar:?]
	at aqh$a.a(SourceFile:247) ~[1.14.2.jar:?]
	at aqh.a(SourceFile:154) ~[1.14.2.jar:?]
	at us.a(SourceFile:384) ~[1.14.2.jar:?]
	at ve.a(SourceFile:295) ~[1.14.2.jar:?]
	at vg.a(SourceFile:310) ~[1.14.2.jar:?]
	at net.minecraft.server.MinecraftServer.b(SourceFile:827) ~[1.14.2.jar:?]
	... 4 more

Other remarks
This bug has been present since at least 19w14b, but doesn't seem to be in the game in 19w14a.

Attachments

Comments 3

I can confirm that this bug does affect 1.14.2

How I do it: In creative mode spawn in a villager and set the time of day to 2000. Nearby, place a workstation without a gui such as a lectern. Get very close and target the side closest to you, then simply press and HOLD right then left mouse buttons to break and replace repeatedly.  Eventually the game will crash. 

Added: crash-2019-05-28_21.58.13-server.txt

Unlisted Video: https://youtu.be/M2QQ1SBwHGM

DarkShadow_TNT

It looks like it is fixed as of 1.14.3-pre1. Quickly placing and destroying a workstation does not cause a crash. What likely changed, is that a villager now less frequently checks for whether or not a workstation is nearby compared to 1.14.2 and earlier.

The question is now if a villager will refresh trades during the correct times of day. In 1.14.2 I have had villagers go several days while I wait form them to refresh.  It's as if they cannot find the workplace.  Anyone know the ticket for that?

DarkShadow_TNT

migrated

Community Consensus

Crash, Entities, Village system

crash, villager, workstations

Minecraft 1.14.2

Minecraft 1.14.3 Pre-Release 1

Retrieved