[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #28865 [Core Tor/sbws]: sbws keeps the number of AsyncResults less than the number of threads



#28865: sbws keeps the number of AsyncResults less than the number of threads
-------------------------------+-------------------------------
     Reporter:  teor           |      Owner:  (none)
         Type:  defect         |     Status:  new
     Priority:  Medium         |  Milestone:  sbws: 1.0.x-final
    Component:  Core Tor/sbws  |    Version:  sbws: 1.0.2
     Severity:  Normal         |   Keywords:
Actual Points:                 |  Parent ID:  #28663
       Points:                 |   Reviewer:
      Sponsor:                 |
-------------------------------+-------------------------------
 This ticket is a follow-up to #28864.

 `multiprocessing.Pool` can accept any number of queued `AsyncResult`s:
 https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool

 But sbws waits for 5 seconds when there are `max_pending_results` queued
 `AsyncResult`s:
 https://github.com/torproject/sbws/blob/ee64d76df54ceb3a3c9e1e2a797fd70d68bb0035/sbws/core/scanner.py#L359-L361

 This sbws code is unnecessary, because `Pool` manages its own queue of
 `AsyncResult`s.

 There are two different ways that this code blocks execution:
 * when a result finishes, the `time.sleep(5)` call blocks the thread from
 getting a new `AsyncResult` for up to 5 seconds
 * if `max_pending_results` `AsyncResult`s ever block, the process hangs

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28865>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs