SquidDev-CC / CCTweaks

Random additions to ComputerCraft (somewhat deprecated, use CC-Tweaked if you're on Minecraft 1.12).
MIT License
12 stars 2 forks source link

Server Stalls with Multithreading #124

Closed inklit closed 7 years ago

inklit commented 7 years ago

On 1.2.2, using Cobalt and multithreading.

My server completely stalls often, completely not ticking and the main thread is frozen. The server uses 100% CPU and does not even respond to SIGTERMs. This is due to CC/CCTweaks according to WarmRoast.

http://i.imgur.com/zxC9DYL.png here is WarmRoast.

This does not happen without multithreading enabled with Cobalt. I have not and will not test Rembulan. I tested with 32 threads, 16 threads, 4 threads, and completely disabling multithreading. Disabling multithreading appears to fix the problem.

SquidDev commented 7 years ago

Just out of curiosity: what happens if you enable multi-threading but leave the thread count at 1? 2?

I haven't got a clue about this bug: pollChanged is a simple if(changed) { changed = false; return true; } else { return false; } method and so is unlikely to be responsible for the 100% CPU usage. The method is synchronized so may block slightly, I'd guess this is where it is going wrong.

Are you sure you're measuring CPU time rather than something else? This shouldn't take processing time, just block the thread.

SquidDev commented 7 years ago

I've had a go at reproducing this but am unable to. Do you think you could provide logs and enable multi-threading but leave the thread count at 1 and 2 and see the results.

Thanks!

inklit commented 7 years ago

Sure I'll give it a go in a few hours.

inklit commented 7 years ago

I've tested with 1 thread and it does not crash. EDIT: It crashes with 2 threads.

Logs show no useful information, the console does not output anything when the server is stalled.

inklit commented 7 years ago

http://switchcraft.pw/crash.dump Here is a thread dump which apparently detected a deadlock. Hope this is helpful!

inklit commented 7 years ago

Just an update: This issue has not reproduced itself since the last update :+1:

SquidDev commented 7 years ago

Woops, I'd forgotten about this! Kept meaning to close it but wanted to wait to check it had been fixed.