added time delay between requests to run parallel module scans #1016
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
Fix for issue #616. The issue is likely happening due to race conditions with python's garbage collector trying to delete a loop that's running causing the
BaseEventLoop.__del__
exception, which causes the _sock exception. The simple fix for this is to give a small delay to in between each request to let threads finish execution and let python handle the deletion properly.If we run the following command with this change,
We get the complete output without errors. It should also be noted that the delay doesn't cause problems in parallel execution because we only delay threads. Using
await asyncio.sleep()
also won't matter much because there are no async tasks to handle control to.Additionally, since its the CPU handling the threads, with time.sleep() it removes the asleep thread from the queue, hence sleep here won't block execution for other threads.
Type of change
Checklist
make pre-commit
, it didn't generate any changesmake test
, all tests passed locally