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

Cannot run multiple Tor instances #14

Open
Selyatin opened this issue Mar 5, 2021 · 7 comments
Open

Cannot run multiple Tor instances #14

Selyatin opened this issue Mar 5, 2021 · 7 comments

Comments

@Selyatin
Copy link

Selyatin commented Mar 5, 2021

I'm trying to run multiple tor instances for browser automation and each instance will connect to it's Tor instance so that each one of them will use a different IP, the issue is when I'm trying to launch Tor multiple times I'm getting this error.

**
INTERNAL ERROR: Raw assertion failed in Tor 0.4.4.7 at /home/shiro/Documents/Project/target/debug/build/libtor-sys-99c3932bcfc8d9f9/out/tor-src/src/ext/csiphash.c:123: the_siphash_key_is_set
**

OS/Distribution: Kubuntu 20.10

@afilini
Copy link
Member

afilini commented Mar 6, 2021

I think this is actually by design, unfortunately. Tor uses a lot of global variables to store its internal state, which means that multiple instances running at the same time would conflict with each other because they would share those variables.

Note that this is different if you run multiple processes, because each of them would get its own set of variables. But with libtor everything is running in a single process, which makes it impossible to isolate them.

I'll keep this issue open to see if somehow there's a way to add support for it, but I personally don't really have any idea unfortunately.

@somehowchris
Copy link
Contributor

@Selyatin this might. be the solution for you https://docs.rs/mitosis/0.1.1/mitosis/

@JeremyRubin
Copy link

it might make sense -- since we can't really do much with the libtor object anyways -- to always run it fork'ed.

Otherwise, I'd recommend making the builder type failable using a library global that only allows one instance to run.

(Hit up on this when writing tests that spawn > 1 tor instance)

@somehowchris
Copy link
Contributor

BTW there is arti which is a complete rewrite of tor in pure rust, which has isolated clients

@afilini
Copy link
Member

afilini commented Aug 31, 2022

Is any of you aware of a way to load a shared library multiple times at different addresses? If we can figure out how to do that, then we can clean up this commit and use it to load separate sets of global variables at different addreses. At least on unix systems.

@JeremyRubin
Copy link

JeremyRubin commented Aug 31, 2022 via email

@JeremyRubin
Copy link

@somehowchris arti seems cool but probably for the project i'm doing i'd rather use the mainline tor.

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

No branches or pull requests

4 participants