-
-
Notifications
You must be signed in to change notification settings - Fork 926
Description
Description
When is_restricted_to_select_one_submission is enabled for a challenge phase, multiple submissions can become public simultaneously due to a race condition. This violates the business rule that only one submission should be public at a time.
Location
File: apps/jobs/views.py
Lines:
- 342-349 (in challenge_submission function)
- 475-485 (in change_submission_data_and_visibility function)
Reproduction
- Save the attached test script as test_bug_race_condition.py
- Run: python3 test_bug_race_condition.py
- Observe the output showing 2 public submissions instead of 1
Test Output:
Initial: 1 public submission(s) Final: 2 public submission(s) - IDs: [2, 3]
Expected Behavior
When a challenge phase has is_restricted_to_select_one_submission=True:
- Only 1 submission should be public at any given time
- When making a new submission public, the existing public submission should be made private first
- This should work correctly even with concurrent requests
Actual Behavior
- Multiple submissions can become public simultaneously
- The race condition occurs because there is no database-level locking
- Both concurrent requests pass the count() == 1 check at the same time
- Both proceed to make their submissions public
Metadata
Metadata
Assignees
Labels
No labels