-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve handling when unable to connect to tor #2399
Improve handling when unable to connect to tor #2399
Conversation
Issue: If an IOException is raised when attempting to create tor and the hidden service, the application will just quit without any indication to the user. One particular scenario where this occurs is mentioned in bisq-network#2398. Cause: There is an explicit statement to exit the application when an IOException is raised. Fix: Rather than just exit the application, show an error message and inform the user what went wrong.
Thanks @devinbileck for intercepting this exception early enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has been on my list for quite some time now. Thanks! utAck
Yes, this happened in China, the GFW prevent us connecting TOR, and the Bisq application quit without any dialogs. |
@freimair If there is a tor connection problem the tor settings windows should get displayed. There the user can choose a plugable transport or other custom settings. |
@ManfredKarrer I agree that it should appear in the case of a connection/communication problem. But in this case it is a setup problem (i.e. cant setup/launch tor in the first place) so there is no need since changing connection settings would have no effect. |
@ManfredKarrer yes, @devinbileck is right - this code path is mainly used when trying to use system tor. when the connection fails there is nothing we can do. |
System.exit(1); | ||
UserThread.execute(() -> { | ||
setupListeners.stream().forEach(s -> s.onSetupFailed(new RuntimeException(e.getMessage()))); | ||
}); | ||
} catch (Throwable ignore) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@freimair Since I removed restartTor(throwable.getMessage());
from onFailure below since I didn't want it to be called after handling IOException above, perhaps I should add it to this ignored exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can force onSuccess
by return null;
after triggering the onSetupFailed
and let the onFailure
be?
And yes, this class cries for being refactored :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact we are already doing that. Let me review this again. I should be able to add restartTor back to onFailure.
@freimair Integrating configuration for system tor into the settings page sounds like a good idea to me. Perhaps you can open an issue? |
@devinbileck Is there anything you want to add to this PR, otherwise I would give it an utACK as well and merge it to master for the upcoming release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Issue: If an IOException is raised when attempting to create
tor and the hidden service, the application will just quit without
any indication to the user. One particular scenario where this occurs
is mentioned in #2398.
Cause: There is an explicit statement to exit the application when an
IOException is raised.
Fix: Rather than just exit the application, show an error message
and inform the user what went wrong.