-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Change Select JudgeServerLogic #391
base: master
Are you sure you want to change the base?
Conversation
Change Select JudgeServerLogic to prevent deadlock
How the deadlock caused? |
This => JudgeServer.objects.select_for_update().filter(is_disabled=False).order_by("task_number") [for server in servers: ] this will result in deadlock, if order is changed due to change in task number by some other thread.... |
this will select the judge server which is the fastest and has fewest tasks? |
yes, least (current total task/core ratio) |
thank you for your contribution, but i still do not understand the reason of the deadlock, could you give me more information about if, for example: the database deadlock log, the django error log, how to reproduce the bug. |
There was whole error log in dramatiq logs, but i guess it stores only 10 most recent files. To reproduce this bug, you need to have 3 to 4 (8 core) judge servers processors, and just DDOS it with 30 to 60 submissions per second. You will be able to find this error in dramatiq logs. [2 judge servers would be okay i guess, but 3-4 would be much better as ordering by task_number will throw more error] This can help:- https://stackoverflow.com/a/42731706 |
@virusdefender Hi, any updates on this PR ? |
808fdff
to
5d178da
Compare
Change Select JudgeServerLogic to prevent deadlock.