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

Generic: All chain service instances failed #983

Closed
yaslama opened this issue May 23, 2024 · 3 comments · Fixed by #989
Closed

Generic: All chain service instances failed #983

yaslama opened this issue May 23, 2024 · 3 comments · Fixed by #989
Assignees

Comments

@yaslama
Copy link
Member

yaslama commented May 23, 2024

LOG {"level": "TRACE", "line": "put; add idle connection for ("https", mempool.emzy.de)"}
LOG {"level": "DEBUG", "line": "pooling idle connection for ("https", mempool.emzy.de)"}
LOG {"level": "ERROR", "line": "Call to chain service https://mempool.emzy.de/api failed: error decoding response body: expected value at line 1 column 1"}
LOG {"level": "TRACE", "line": "client tx closed"}
LOG {"level": "TRACE", "line": "pool closed, canceling idle interval"}
LOG {"level": "TRACE", "line": "State::close_read()"}
LOG {"level": "TRACE", "line": "State::close_write()"}
LOG {"level": "TRACE", "line": "flushed({role=client}): State { reading: Closed, writing: Closed, keep_alive: Disabled }"}
LOG {"level": "TRACE", "line": "shut down IO complete"}
LOG Generic: All chain service instances failed

@ok300
Copy link
Contributor

ok300 commented May 23, 2024

We log the raw response on debug for all calls we make in ChainService:

https://github.com/breez/breez-sdk/blob/529340447a1ff377850a43d6c192eb293114b69f/libs/sdk-core/src/input_parser.rs#L261-L269

I think if the user would set this logger to DEBUG

https://github.com/breez/breez-sdk/blob/529340447a1ff377850a43d6c192eb293114b69f/libs/sdk-core/src/breez_services.rs#L1702

the logs would include the raw response body.

@roeierez
Copy link
Member

It seems that we are not checking the status code before attempting to deserialize the json. mempool space returns 404 for example for an not found transaction:
07c9d3fbffc20f96ea7c93ef3bcdf346c8a8456c25850ea76be62b24a7cf690c

We should only attempt to deserialize the json if we got 200 response.
any other status code should return an error immediately.
The error details in such cases are included as raw text in the response body so logging this plus the original request on error is a good idea to understand what happened here.

@roeierez
Copy link
Member

Digging a bit more it seems that there are several existing channels that their funding transactions are not found onchain:

f135ed194147cd5f29f429b1561bc49a38755b222b3f2996a974c6ca5615a096
8e03c585a995666d117d37037fc36fcd50f335206f7cbd4ce1d351f64dc00fb5
f128623e3a1057ac91d50cb4c50ba8791ba95130b7e191dc19e7b5002d9e3d50

While we attempting to find their corresponding closing tx we are using this API:
https://mempool.space/api/tx/{txid}/outspends

Which fails from the reason I mentioned above.
So in addition to being more robust in interpreting chain service result, we should be tollerant while looking for the closing tx on chain (which happens during sync) and not fail the sync if we fail to fetch the closing tx.

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

Successfully merging a pull request may close this issue.

3 participants