minvws / nl-kat-coordination

OpenKAT scans networks, finds vulnerabilities and creates accessible reports. It integrates the most widely used network tools and scanning software into a modular framework, accesses external databases such as shodan, and combines the information from all these sources into clear reports. It also includes lots of cat hair.
https://openkat.nl
European Union Public License 1.2
126 stars 58 forks source link

Connection reset/refused/timeout on multiple requests #3477

Open zcrt opened 1 month ago

zcrt commented 1 month ago

Describe the bug Connection reset/refused/timeout on multiple requests. Possibly to octopoes. Behaviour exists when using the API, but that is less of a problem. More of a problem is the actions that take place on multiple organisations, such as rerunning bits.

To Reproduce Try adding many organisations through the API or Try rerunning all bits when there are many organisations

Expected behavior Smooth Octopoes/KAT

OpenKAT version https://github.com/minvws/nl-kat-coordination/commit/980415375c372e6f32086ce55078e8e5533f456b

Failed reasons include: 'timed out', '[Errno 104] Connection reset by peer', '[Errno 111] Connection refused'

underdarknl commented 1 month ago

Im guessing this is due to the fact that these api calls are doing async work in their backends, and or are taking longer than your script is waiting before it sends out a new call.

This would then end up using all available resources / server connections somewhere along the stack.

zcrt commented 1 month ago

It happens in about 6% of the cases, likely directly after another for a few organisations.

https://github.com/minvws/nl-kat-coordination/blob/980415375c372e6f32086ce55078e8e5533f456b/rocky/rocky/views/organization_list.py#L43

Could we fix it by adding a retry or random sleep here? Or is there a way to allow more connections?