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

No exception thrown if tor port binding fails. #6

Open
mattcollier opened this issue Mar 24, 2015 · 1 comment
Open

No exception thrown if tor port binding fails. #6

mattcollier opened this issue Mar 24, 2015 · 1 comment

Comments

@mattcollier
Copy link
Contributor

if one executes two instances of the following code:

var dataDir = __dirname + '/demo-data';
var thsBuilder = require('ths');
var ths = new thsBuilder(dataDir);

ths.start(false, function() {
  console.log('ths has started.');
});

The second instance fails without any error or exception. By enabling some logging on line 396:

console.log('[tor Process] ', data.toString('utf8')); 

I can see the cause of the issue:

[tor Process]  Mar 24 09:44:30.437 [notice] Tor v0.2.5.10 (git-43a5f3d91e726291) running on Linux with Libevent 2.0.21-stable, OpenSSL 1.0.1k and Zlib 1.2.8.
Mar 24 09:44:30.437 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Mar 24 09:44:30.437 [notice] Read configuration file "/home/matt/thstiming/demo-data/ths-data/torrc".
[tor Process]  Mar 24 09:44:30.441 [notice] Opening Socks listener on 127.0.0.1:9999
Mar 24 09:44:30.441 [warn] Could not bind to 127.0.0.1:9999: Address already in use. Is Tor already running?
Mar 24 09:44:30.441 [notice] Opening Control listener on 127.0.0.1:9998
Mar 24 09:44:30.441 [warn] Could not bind to 127.0.0.1:9998: Address already in use. Is Tor already running?
Mar 24 09:44:30.441 [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
Mar 24 09:44:30.441 [err] Reading config failed--see warnings above.

During development, I have encountered zombie tor processes which cause unexpected behavior. Catching this type of error would be helpful.

@abenmrad
Copy link
Member

abenmrad commented Apr 2, 2015

[In dev branch] Added a bindingError event, that receives the error that cannot be bound.

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

2 participants