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 startup issues of Tor #1798

Closed
HenrikJannsen opened this issue Mar 15, 2024 · 3 comments · Fixed by #2067
Closed

Fix startup issues of Tor #1798

HenrikJannsen opened this issue Mar 15, 2024 · 3 comments · Fixed by #2067
Assignees
Labels
bug Something isn't working network P2P network, messaging, distributed data storage priority
Milestone

Comments

@HenrikJannsen
Copy link
Contributor

Tor setup sometimes hangs specially at first time using Bisq2.

@HenrikJannsen HenrikJannsen added network P2P network, messaging, distributed data storage bug Something isn't working labels Mar 15, 2024
@HenrikJannsen HenrikJannsen added this to the 2.0.1 milestone Mar 15, 2024
@HenrikJannsen HenrikJannsen modified the milestones: 2.0.1, 2.0.2 Mar 16, 2024
@HenrikJannsen HenrikJannsen changed the title Tor setup hangs at first start Fix startup issues of Tor Mar 17, 2024
@lucasbalieiro
Copy link
Contributor

Hi Guys,

it is my first time running the application and I think i get the issue you are presenting here.

Looking at the logs, I get this:

mar.-17 15:50:59.212 [NetworkService.network-IO-pool-0] ERROR b.d.DesktopApplicationService: Initializing applicationService failed java.util.concurrent.CompletionException: bisq.tor.controller.exceptions.TorBootstrapFailedException: Tor bootstrap timout triggered. at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: bisq.tor.controller.exceptions.TorBootstrapFailedException: Tor bootstrap timout triggered. at bisq.tor.controller.NativeTorController.waitUntilBootstrapped(NativeTorController.java:146) at bisq.tor.TorService.initialize(TorService.java:99) at bisq.network.p2p.node.transport.TorTransportService.initialize(TorTransportService.java:63) at bisq.network.p2p.ServiceNode.getInitializedDefaultNode(ServiceNode.java:229) at bisq.network.p2p.ServiceNodesByTransport.lambda$getInitializedDefaultNodeByTransport$1(ServiceNodesByTransport.java:133) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ... 3 common frames omitted

Another thing that I notice, every time that I run the application it goes a bit further in the Bootstrap %.

first stoped with 3%, then 6%, 12.50%, 12.75%

Hope that it helps.

alvasw added a commit to alvasw/bisq2 that referenced this issue Mar 23, 2024
alvasw added a commit to alvasw/bisq2 that referenced this issue Mar 23, 2024
alvasw added a commit to alvasw/bisq2 that referenced this issue Mar 23, 2024
Consumers can asynchronously subscribe to directory events with the Flow components.

Ref: bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Mar 23, 2024
alvasw added a commit to alvasw/bisq2 that referenced this issue Mar 23, 2024
Presently, we parse Tor's log file to detect when the control port is ready. This is unstable and could break with any Tor update. A better approach is to use Tor's 'ControlPortWriteToFile' config option and parse the control port from that file.

Ref: bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Mar 23, 2024
Use the flow-component-based DirectoryWatcher to wait for the control port file and parse the control port file with the ControlPortFileParser afterward.

Ref: bisq-network#1798
@alvasw alvasw reopened this Mar 30, 2024
alvasw added a commit to alvasw/bisq2 that referenced this issue Mar 30, 2024
To select the Tor control port, we bind to a random port, close it and
pass the port number to Tor. It can happen that Tor tries to bind to the
port before it is closed.  In this case, the Tor startup will fail
because Tor will never print a line containing "[notice] Opened Control
listener connection (ready) on ". Up until now, Bisq monitored the Tor
log file to know when the control port is ready. Now Tor writes the
control port to a file and Bisq reads that file.

Ref: bisq-network#1798
@djing-chan djing-chan modified the milestones: 2.0.2, 2.0.3 Mar 30, 2024
@HenrikJannsen HenrikJannsen modified the milestones: 2.0.3, 2.0.4 Apr 9, 2024
alvasw added a commit to alvasw/bisq2 that referenced this issue Apr 14, 2024
To select the Tor control port, we bind to a random port, close it and
pass the port number to Tor. It can happen that Tor tries to bind to the
port before it is closed.  In this case, the Tor startup will fail
because Tor will never print a line containing "[notice] Opened Control
listener connection (ready) on ". Up until now, Bisq monitored the Tor
log file to know when the control port is ready. Now Tor writes the
control port to a file and Bisq reads that file.

Ref: bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Apr 15, 2024
To select the Tor control port, we bind to a random port, close it and
pass the port number to Tor. It can happen that Tor tries to bind to the
port before it is closed.  In this case, the Tor startup will fail
because Tor will never print a line containing "[notice] Opened Control
listener connection (ready) on ". Up until now, Bisq monitored the Tor
log file to know when the control port is ready. Now Tor writes the
control port to a file and Bisq reads that file.

Ref: bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Apr 15, 2024
To select the Tor control port, we bind to a random port, close it and
pass the port number to Tor. It can happen that Tor tries to bind to the
port before it is closed.  In this case, the Tor startup will fail
because Tor will never print a line containing "[notice] Opened Control
listener connection (ready) on ". Up until now, Bisq monitored the Tor
log file to know when the control port is ready. Now Tor writes the
control port to a file and Bisq reads that file.

Ref: bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Apr 15, 2024
To select the Tor control port, we bind to a random port, close it and
pass the port number to Tor. It can happen that Tor tries to bind to the
port before it is closed.  In this case, the Tor startup will fail
because Tor will never print a line containing "[notice] Opened Control
listener connection (ready) on ". Up until now, Bisq monitored the Tor
log file to know when the control port is ready. Now Tor writes the
control port to a file and Bisq reads that file.

Ref: bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Apr 15, 2024
When the Tor network is under load, the bootstrap process takes multiple
minutes. Tor informs us about the progress with BootstrapEvent's until
Tor is ready.

Fixes bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Apr 26, 2024
To select the Tor SOCKS5 port, we bind to a random port, close it and
pass the port number to Tor. It can happen that Tor tries to bind to
the port before it is closed. In this case, the Tor startup will fail.

Ref: bisq-network#1798
alvasw added a commit to alvasw/bisq2 that referenced this issue Apr 26, 2024
To select the Tor SOCKS5 port, we bind to a random port, close it and
pass the port number to Tor. It can happen that Tor tries to bind to
the port before it is closed. In this case, the Tor startup will fail.

Ref: bisq-network#1798
@Raviu56
Copy link

Raviu56 commented Aug 7, 2024

Actually issue is not solved, I'm using v2.0.4 on Linux, It keeps bootstraping Tor 7% or 11% then "Itializing applicationService failed" and shutdown.
v1.9.17 works fine.

@alvasw
Copy link
Contributor

alvasw commented Sep 25, 2024

Hi @Raviu56,

Could try v2.1.0 and report back?
https://github.com/bisq-network/bisq2/releases/tag/v2.1.0

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working network P2P network, messaging, distributed data storage priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants