velotraveler / potraceroute

Portable TCP/UDP/ICMP traceroute tool, written in Python
GNU General Public License v3.0
15 stars 3 forks source link

Problems executing routine with multithreading or pool #3

Open hgonzalez007 opened 1 month ago

hgonzalez007 commented 1 month ago

We are trying to generate the traceroute for more than 400 devices. The version with a single process works spectacularly, but when using multithreading, calling to class (Traceroute, probe(ttl) ) it appears that it does not work correctly. Some threads abort prematurely, which delivers incorrect traceroute information. The same behavior occurs when using multiprocessing(Pool)

velotraveler commented 1 month ago

Glad to hear you're using potraceroute, and that it works well in single-process mode.

The Traceroute class was not written with thread safety in mind, it's basically a port of the original C-language traceroute with some nice additional features. So your multiprocessing/multithreading results are not surprising.

I'm sure the script could be restructured to make it thread-safe, but it would take some careful planning. I'm not working on potraceroute at the moment - but if you want to submit patches I'd be happy to review and test them.

Thanks again for your interest in potraceroute!

On Thu, Jul 25, 2024 at 06:23:29PM -0700, hgonzalez007 wrote:

We are trying to generate the traceroute for more than 400 devices. The version with a single process works spectacularly, but when using multithreading, calling to class (Traceroute, probe(ttl) ) it appears that it does not work correctly. Some threads abort prematurely, which delivers incorrect traceroute information. The same behavior occurs when using multiprocessing(Pool)

— Reply to this email directly, [1]view it on GitHub, or [2]unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

References

Visible links

  1. https://github.com/velotraveler/potraceroute/issues/3
  2. https://github.com/notifications/unsubscribe-auth/ABFLAW7WOMD4P3KRTIQBDA3ZOGQJDAVCNFSM6AAAAABLPS4KBGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZTCMRSHAYTEMA