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

Server won't stop #505

Closed
madmaxoft opened this issue Jan 4, 2014 · 13 comments
Closed

Server won't stop #505

madmaxoft opened this issue Jan 4, 2014 · 13 comments
Assignees

Comments

@madmaxoft
Copy link
Member

When the stop command is issued on the server console, the server goes as far as Waiting for the world storage to finish saving and stays there forever. This is probably caused by the new cQueue class introduced in PR #494.
Seen on a Windows version, might be present on other platforms, too.

@ghost ghost assigned worktycho Jan 4, 2014
@worktycho
Copy link
Member

I can't reproduce this on a brand new world on linux. I'll add some more debug info to see whats going on in your setup. Through if this is what I suspect it is that might fix it.

@madmaxoft
Copy link
Member Author

I can't reproduce this again either. Must have been some sort of a race condition or some glitch.

@worktycho
Copy link
Member

THere is a race condition in BlockTillQueueEmpty that I'm aware of but can't work out how to fix as it involves a modification between releasing a Mutex and Starting to wait on an event. Keep the Issue open though until Its fixed to track it. Its only an issue when shutting down as otherwise another item is queued and then removed at some point waking it up.

@madmaxoft
Copy link
Member Author

I got the deadlock again. It seems to happen everytime when the nightbuild is run to produce the APIDump documentation to be uploaded. The nightbuild uses the release mode, so I guess I'll have less info analysing it, wish me luck.

I'll check if it happens again in a regular release mode, too.

@madmaxoft
Copy link
Member Author

It seems that it's the BlockTillEmpty() function that you've expected. I can't read individual member variables, but I can see the main thread is waiting for the m_evtRemoved, while waiting for the save queue to become empty.

@madmaxoft
Copy link
Member Author

I'll fix this.

@ghost ghost assigned madmaxoft Jan 5, 2014
@worktycho
Copy link
Member

Good luck. I couldn't work out any way of getting that method to be race free at all. Theres always a gap between releasing the mutex and starting the wait, during which the event can occur.

@worktycho worktycho reopened this Jan 5, 2014
@worktycho
Copy link
Member

Reopened as the issue still exists only is smaller.

@madmaxoft
Copy link
Member Author

The issue is fixed, as I've explained in the commit comments.

@worktycho
Copy link
Member

Only its not. This code is exactly the same but without the size query hidden behind a method call.

@worktycho worktycho reopened this Jan 6, 2014
@worktycho
Copy link
Member

All you've done is change the timings so there must still be race condition there thats just not surfacing now.

@madmaxoft
Copy link
Member Author

Right, the issue is still present, but not because of the wait function, that works well, rather it's the WorldStorage code.

@madmaxoft
Copy link
Member Author

Oh yeah, of course. You changed the way items are enqueued, you first set the "added" event and only then enqueue; that needs to be swapped - first enqueue, then set event.

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

No branches or pull requests

2 participants