-
Notifications
You must be signed in to change notification settings - Fork 40
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
Reduce number of concurrent DNS lookups in Machine Tracker #2917
Reduce number of concurrent DNS lookups in Machine Tracker #2917
Conversation
92e6afa
to
e85b842
Compare
It doesnt really do much parsing, the saving part is the most significant function of it
e85b842
to
cf29469
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 5.10.x #2917 +/- ##
==========================================
- Coverage 60.21% 59.52% -0.69%
==========================================
Files 601 602 +1
Lines 43981 43308 -673
==========================================
- Hits 26481 25780 -701
- Misses 17500 17528 +28 ☔ View full report in Codecov by Sentry. |
c13be7e
to
9e1383d
Compare
9e1383d
to
3d0afbe
Compare
The reactor will by default log exceptions that occur in the coiterator, resulting in nothing being raised. Code using the asyncdns lib except certain errors to occur when something is wrong so this should keep the current asyncdns interfacing intact, at the cost of taking longer to fail
3d0afbe
to
93fca87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like putting lipstick on a pig. It's still ugly, but it works - great work 😆
I have a feeling this will be revisited again at some point in the future (hopefully when we replace Twisted with asyncio)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like putting lipstick on a pig. It's still ugly, but it works - great work 😆
I have a feeling this will be revisited again at some point in the future (hopefully when we replace Twisted with asyncio)
I changed the base to the new stable branch, which caused my old review to be dismissed - so posting the same again.
Fixes #2669
Limits concurrent parallel lookups to 100 at a time.
Tested manually that machine tracker no longer crashes from hitting the file descriptor limit with
ulimit
set as low as 200 on a search with 4096 results. This would previously crash instantlyThe amount of parallel lookups should perhaps be configurable but that can be separate pr if we see the need
A practical change I made is that saving the results from a lookup to the dict
self.results
will now happen during the parallel lookups, instead of at the end. I made this change simply because usingCooperator
changes how theDefferedList
we use look like. Instead of all the separate lookup tasks being in the list, the list now contains 100 iterators.I dont know how to add a callback to the list that will actually be able to go through all the results produced instead of just going over the iterators themselves, so I moved the saving step to be part of the smaller work units.
Errors that were previously raised by themselves are now eaten up by the
Cooperator
. Tried to fix this by saving all errors then raising the first one that occurred. I expect this keeps the interfacing with theasyncdns
module intact, but side effect is that it will only raise the exceptions after its done running, so its slower to fail