Jump to content




[1.56][Ssp/smp] Turtle Mounting Disk After Moving Can Cause Thread Deadlock


  • You cannot reply to this topic
No replies to this topic

#1 Sangar

  • Members
  • 30 posts

Posted 13 August 2013 - 11:21 AM

So, I've had the game die on me a couple of times over the last weeks. Turns out, it really was ComputerCraft. Dump of the threads in deadlock below.

I did not see this posted, if it has been, I'm sorry, please merge this to the existing thread.

Version Information
CC 1.56, MC 1.62, Forge 9.10.0.804
Thread deadlock captured in VisualVM in SSP but I have seen this in SMP, too.
No other mods were installed.

Description
After a random amount of time, the game logic locks up. I can still move around and will not get disconnected, but when breaking blocks they don't drop anything, when trying to interact with objects nothing happens (e.g. a GUI should open but it doesn't) and the inventory won't open anymore. When closing the game (Esc->Save and Quit to Title) the game will just stay in the shutting down internal server screen forever.

Steps to reproduce
Run MC, start a map. I'm pretty sure this is related to the disk drive,
Spoiler

Update: much simpler test-case! This actually happens with just a turtle and a disk drive (with a disk in it). Here's how the setup looks:

Posted Image

This is the program the turtle runs (starting next to the disk drive):
while true do
  repeat until turtle.up()
  repeat until turtle.down()
end

The turtle should obviously be fueled up quite a bit before this is being run. This time, after about one hour the deadlock happened.

The Deadlock
Spoiler

Here is the full thread dump:
Spoiler

Interestingly enough the line numbers were slightly different with the updated test case - note that I managed to reproduce this three times with that approach alone, and for these the line numbers were equal. I didn't update MC or CC since then, so I can only assume it depends on the order in which the threads lock up (before or after the respective synchronize). Anyway, here's the alternative numbers:
Spoiler


I am aware that this may be a pain to figure out, as race conditions are wont to be, but I would really appreciate if this were fixed, since from what I've seen the game rarely (never?) properly saves in such cases, meaning anything written to disk by Lua programs will be in the world's "future", so, among other things, custom program persistence will break.

Quite frequently turtles have lost their identity via this kind of "crash", too (this has been reported before, though in the context of other crashes as far as I'm aware), meaning they get a new ID, lose any peripherals and their inventory. This only happened if there were multiple turtles, so I assume this was in the context of one turtle causing the deadlock and others moving at that moment. This is just conjecture, though, hence the grey text color. Still, I wanted to get it out there.

PS: On a possibly unrelated note, I noticed this NPE in the log, recently, though it didn't cause a crash. But it's also involving the disk drive, so I guess this is the best place to mention it. Before and after there's just random unrelated logging, so I doubt this will be very enlightening, but you never know...
Spoiler

Edit: made title a bit more descriptive now that I'm pretty sure what the actual cause is.

Edited by Sangar, 14 August 2013 - 09:50 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users