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

Fix: queued scan count #850

Merged
merged 2 commits into from Feb 8, 2023
Merged

Fix: queued scan count #850

merged 2 commits into from Feb 8, 2023

Conversation

jjnicola
Copy link
Member

@jjnicola jjnicola commented Feb 3, 2023

What:
Add lock for start_scan
Jira: SC-755

Why:
Avoid a race condition counting the amount of queued scans when many task
are started at the same time. This leads into wrong queue position
number shown in the logs and could jump the max_queued_scans setting
in some cases.

How:
start many task (25) at the same time and check the position in the queue. There should not be repeated position numbers for different tasks.

Checklist:

  • Tests
  • PR merge commit message adjusted

@jjnicola jjnicola requested a review from a team as a code owner February 3, 2023 11:39
@jjnicola jjnicola enabled auto-merge (squash) February 3, 2023 11:39
ospd/command/command.py Outdated Show resolved Hide resolved
Avoid a race condition counting the amount of queued scans when many task
are started at the same time. This bug leaded into wrong queue position
number shown in the logs and could jump the max_queued_scans setting
in some cases.
@jjnicola jjnicola merged commit fd35308 into main Feb 8, 2023
@jjnicola jjnicola deleted the queue-count branch February 8, 2023 09:09
mergify bot pushed a commit that referenced this pull request Feb 8, 2023
Wait 0, 10, 20, 30, ..., or 90 miliseconds when add a new scan in the queue.
This try to avoid a race condition counting the amount of queued scans when many task
are started at the same time. This leads into wrong queue position
number shown in the logs and could jump the max_queued_scans setting
in some cases.

(cherry picked from commit fd35308)

# Conflicts:
#	poetry.lock
jjnicola added a commit that referenced this pull request Feb 8, 2023
* Fix: queued scan count (#850)

Wait 0, 10, 20, 30, ..., or 90 miliseconds when add a new scan in the queue.
This try to avoid a race condition counting the amount of queued scans when many task
are started at the same time. This leads into wrong queue position
number shown in the logs and could jump the max_queued_scans setting
in some cases.

(cherry picked from commit fd35308)

# Conflicts:
#	poetry.lock

* Fix: issue with poetry.lock file

---------

Co-authored-by: Juan José Nicola <juan.nicola@greenbone.net>
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.

None yet

2 participants