Skip to content

Fix for deadlock in logging#10

Merged
ago1024 merged 1 commit into
ago1024:masterfrom
bdew-wurm:fix-deadlock
Apr 26, 2018
Merged

Fix for deadlock in logging#10
ago1024 merged 1 commit into
ago1024:masterfrom
bdew-wurm:fix-deadlock

Conversation

@bdew
Copy link
Copy Markdown
Contributor

@bdew bdew commented Apr 18, 2018

Deadlock is happening when 2 threads in the client try to log at the same time. Example thread dump here: https://gist.github.com/bdew/d6a2e1372dec8864403395ead8f7a2ac

Easiest way to reproduce is to pray right after you log in, if you're (un)lucky you'll get the 2 following lines emitted at the same time and your client will hang:

Writing to PlayerFiles\players\bdew\logs\_Skills.2018-04.txt
SEVERE: Input does not appear to be an Ogg bitstream.

Making this method non-synchronized seems to fix it, and i don't see any particular reason for it to be - it only accesses a thread local value and System.out.println which is synchronized on it's own (and that's part of why it deadlocks) - so i just left it at that.

Compiled build for testing here - https://www.dropbox.com/s/7xwwa43wi86mj91/client-modlauncher-0.8-hangfix.zip?dl=0

@ago1024 ago1024 merged commit 3fc92a8 into ago1024:master Apr 26, 2018
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

Successfully merging this pull request may close these issues.

2 participants