Skip to content
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

Fix multi-threading issue #173

Closed
KingAkeem opened this issue Oct 12, 2019 · 7 comments
Closed

Fix multi-threading issue #173

KingAkeem opened this issue Oct 12, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@KingAkeem
Copy link
Member

KingAkeem commented Oct 12, 2019

Describe the bug
We're using multi threading to display links and Python isn't great at handling threads due to the GIL so this causes stalling when trying to display several hundred (at minimum) links. I'm thinking that the solution in this case is to process the links asynchronously instead, it may not be as fast but it'll be stable.

To Reproduce

  1. python3 torBot.py -u https://hiddenwikitor.org

Expected behavior
LInks are retrieved until user cancels operation or all links have been found.

@KingAkeem KingAkeem added this to the TorBot V1.4 milestone Oct 12, 2019
@PSNAppz PSNAppz added the Hacktoberfest HackToberFest 2023 label Oct 13, 2019
@dblclik
Copy link

dblclik commented Oct 13, 2019

I’d like to tackle this—thinking multiprocessing.Pool.apply_async() will help nicely here, but we’ll have to fetch the results from async as they come in, can’t recall offhand if handling this with a for left open for streaming data will work or not 🤷‍♂️

@KingAkeem
Copy link
Member Author

I'm working on this currently but my solution deals with using Golang. If you're able to write something in Python that has similar performance then that would be fine by me.

@dblclik
Copy link

dblclik commented Oct 13, 2019

@KingAkeem - Golang would be easier for this for sure, but I think there may be a way to do it in Python.

How were you planning on tying this project to a Golang based multithreaded URL analyzer?

@KingAkeem
Copy link
Member Author

I'm going to try just using Go without any attempts at optimization since one of our bottlenecks is I/O, I think simply using Go to perform the request and print the status while provide a significant speed increase. After that, I'll run each request in a separate goroutine and take advantage of Go's built-in concurrency.

@KingAkeem
Copy link
Member Author

I have a somewhat working prototype currently. You can check our this PR: #174 and this repo contains the Golang code that's being used as a plugin https://github.com/KingAkeem/display_status

@dblclik
Copy link

dblclik commented Oct 13, 2019

Sounds good, I'll un-assign myself from this issue. I'll take a look at the PR too 👍

@KingAkeem
Copy link
Member Author

Sounds good to me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants