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.