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

[BACKPORT] Falling back from fallback #6577

Merged
merged 4 commits into from Oct 28, 2021

Conversation

molnard
Copy link
Collaborator

@molnard molnard commented Oct 26, 2021

This PR trying to solve the problem that if the client's fallback mechanism is activated there is no going back for normal operation. We see use cases when users just start Wasabi and do mixing for days without further action. This feature can be a solution for them.

  • Set up the timeout properly, 24 hours?
  • Implement this on master.

@molnard
Copy link
Collaborator Author

molnard commented Oct 26, 2021

Currenly I am getting this when set fallback to false.

2021-10-26 16:54:44 ERROR       WasabiSynchronizer (337)        System.Net.Http.HttpRequestException: Forbidden
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

Full Log:

2021-10-26 16:48:03 INFO        Global (314)    Start connecting to nodes...
2021-10-26 16:48:03 INFO        Global (338)    Start synchronizing filters...
2021-10-26 16:48:06 DEBUG       BestEffortEndpointConnector (106)       Connections: 0, Currently allow only onions: False.
2021-10-26 16:48:16 ERROR       PeriodicRunner (73)     WalletWasabi.Exceptions.TorSocks5FailureResponseException: Tor SOCKS5 proxy responded with HostUnreachable.
   at WalletWasabi.TorSocks5.TorSocks5Client.ConnectToDestinationAsync(String host, Int32 port, Boolean isRecursiveCall) in WalletWasabi\TorSocks5\TorSocks5Client.cs:line 249
   at WalletWasabi.TorSocks5.TorHttpClient.SendAsync(HttpRequestMessage request, CancellationToken cancel) in WalletWasabi\TorSocks5\TorHttpClient.cs:line 195
   at WalletWasabi.TorSocks5.TorHttpClient.SendAsync(HttpMethod method, String relativeUri, HttpContent content, CancellationToken cancel) in WalletWasabi\TorSocks5\TorHttpClient.cs:line 112
   at TorHttpClientExtensions.SendAndRetryAsync(ITorHttpClient client, HttpMethod method, HttpStatusCode expectedCode, String relativeUri, Int32 retry, HttpContent content, CancellationToken cancel) in WalletWasabi\Extensions\TorHttpClientExtensions.cs:line 20
   at WalletWasabi.WebClients.Wasabi.WasabiClient.GetVersionsAsync(CancellationToken cancel) in WalletWasabi\WebClients\Wasabi\WasabiClient.cs:line 243
   at WalletWasabi.WebClients.Wasabi.WasabiClient.CheckUpdatesAsync(CancellationToken cancel) in WalletWasabi\WebClients\Wasabi\WasabiClient.cs:line 258
   at WalletWasabi.Services.UpdateChecker.ActionAsync(CancellationToken cancel) in WalletWasabi\Services\UpdateChecker.cs:line 58
   at WalletWasabi.Bases.PeriodicRunner.ExecuteAsync(CancellationToken stoppingToken) in WalletWasabi\Bases\PeriodicRunner.cs:line 53
2021-10-26 16:48:19 ERROR       WasabiSynchronizer (337)        WalletWasabi.Exceptions.TorSocks5FailureResponseException: Tor SOCKS5 proxy responded with HostUnreachable.
   at WalletWasabi.TorSocks5.TorSocks5Client.ConnectToDestinationAsync(String host, Int32 port, Boolean isRecursiveCall) in WalletWasabi\TorSocks5\TorSocks5Client.cs:line 249
   at WalletWasabi.TorSocks5.TorHttpClient.SendAsync(HttpRequestMessage request, CancellationToken cancel) in WalletWasabi\TorSocks5\TorHttpClient.cs:line 195
   at WalletWasabi.TorSocks5.TorHttpClient.SendAsync(HttpMethod method, String relativeUri, HttpContent content, CancellationToken cancel) in WalletWasabi\TorSocks5\TorHttpClient.cs:line 112
   at TorHttpClientExtensions.SendAndRetryAsync(ITorHttpClient client, HttpMethod method, HttpStatusCode expectedCode, String relativeUri, Int32 retry, HttpContent content, CancellationToken cancel) in WalletWasabi\Extensions\TorHttpClientExtensions.cs:line 20
   at WalletWasabi.WebClients.Wasabi.WasabiClient.GetSynchronizeAsync(uint256 bestKnownBlockHash, Int32 count, Nullable`1 estimateMode, CancellationToken cancel) in WalletWasabi\WebClients\Wasabi\WasabiClient.cs:line 56
   at System.Threading.Tasks.TaskExtensions.WithAwaitCancellationAsync[T](Task`1 me, CancellationToken cancel, Int32 waitForGracefulTerminationMilliseconds) in WalletWasabi\Extensions\TaskExtensions.cs:line 33
   at WalletWasabi.Services.WasabiSynchronizer.<>c__DisplayClass60_0.<<Start>b__0>d.MoveNext() in WalletWasabi\Services\WasabiSynchronizer.cs:line 184
2021-10-26 16:48:26 INFO        TorProcessManager (282) Backend onion unreachable - using fallback mechanism.
2021-10-26 16:49:06 INFO        WasabiSynchronizer (292)        Downloaded filters for blocks from 2100873 to 2100877.
2021-10-26 16:49:06 INFO        PeriodicRunner (119)    Exception stopped coming. It came for 50.1786869 seconds, 1 times: TorSocks5FailureResponseException: Tor SOCKS5 proxy responded with HostUnreachable.
2021-10-26 16:49:37 INFO        WasabiSynchronizer (288)        Downloaded filter for block 2100878.
2021-10-26 16:54:28 INFO        TorProcessManager (300) Trying to reach backend's onion.
2021-10-26 16:54:44 ERROR       WasabiSynchronizer (337)        System.Net.Http.HttpRequestException: Forbidden
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

   at System.Net.Http.HttpResponseMessageExtensions.ThrowRequestExceptionFromContentAsync(HttpResponseMessage me) in WalletWasabi\Extensions\HttpResponseMessageExtensions.cs:line 107
   at WalletWasabi.WebClients.Wasabi.WasabiClient.GetSynchronizeAsync(uint256 bestKnownBlockHash, Int32 count, Nullable`1 estimateMode, CancellationToken cancel) in WalletWasabi\WebClients\Wasabi\WasabiClient.cs:line 59
   at System.Threading.Tasks.TaskExtensions.WithAwaitCancellationAsync[T](Task`1 me, CancellationToken cancel, Int32 waitForGracefulTerminationMilliseconds) in WalletWasabi\Extensions\TaskExtensions.cs:line 33
   at WalletWasabi.Services.WasabiSynchronizer.<>c__DisplayClass60_0.<<Start>b__0>d.MoveNext() in WalletWasabi\Services\WasabiSynchronizer.cs:line 184

I think the problem is here somewhere @kiminuo ?

image

@kiminuo
Copy link
Collaborator

kiminuo commented Oct 26, 2021

Could you please try with this commit: kiminuo@59b2957?

@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 27, 2021
@molnard
Copy link
Collaborator Author

molnard commented Oct 27, 2021

Could you please try with this commit: kiminuo@59b2957?

It is working fine with this. It is a bit smelly, you see this as the final solution?

@molnard molnard marked this pull request as ready for review October 27, 2021 14:56
@kiminuo
Copy link
Collaborator

kiminuo commented Oct 27, 2021

Could you please try with this commit: kiminuo@59b2957?

It is working fine with this. It is a bit smelly, you see this as the final solution?

I find it quite elegant actually as WW1 does not support switching from https to http and vice versa. We can probably come up with a different solution but I don't really have a better solution at the moment. If you have any other idea, please share it here.

Obviously, we have much better Tor networking code in WW2 but I'm not sure how much time it would take to backport it.

@kiminuo
Copy link
Collaborator

kiminuo commented Oct 27, 2021

Code LGTM.

@molnard
Copy link
Collaborator Author

molnard commented Oct 28, 2021

I take a look at this again and it is good. Can you check this on master as well? We do not want to bump into this same issue again there.

@molnard molnard merged commit 21420ae into zkSNACKs:bp_1_1_13_0 Oct 28, 2021
@molnard molnard deleted the fallbackback branch October 28, 2021 11:31
@kiminuo kiminuo mentioned this pull request Nov 19, 2021
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 this pull request may close these issues.

None yet

2 participants