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 and improve txsub package #695

Merged
merged 6 commits into from
Sep 27, 2018
Merged

Fix and improve txsub package #695

merged 6 commits into from
Sep 27, 2018

Conversation

bartekn
Copy link
Contributor

@bartekn bartekn commented Sep 26, 2018

This commit fixes an issue that caused sending Timeout responses to client submitting transactions. The problem was present in TransactionByHashAfterLedger function: it was checking the result of the transaction in History DB and, when it was not found, in Core DB but with ledger sequence after the latest ingested ledger. Given the fact that Horizon ingests only successful transactions it was impossible to find results for some of the failed transactions (especially those failed at the consensus level that require more time to process).

SubmissionTimeout was changed to 30 seconds because HTTP clients in SDKs usually timeout in 60 seconds. We want SubmissionTimeout to be lower than that to make sure that they read the response before the client timeout and 30 seconds is 6 ledgers (with avg. close time = 5 sec), enough for stellar-core to drop the transaction if not added to the ledger and ask client to try again by sending a Timeout response.

It also contains improved logging in txsub package.

This commit fixes an issue that caused sending `Timeout` responses to
client submitting transactions. The problem was present in
`TransactionByHashAfterLedger` function: it was checking the result of
the transaction in History DB and, when it was not found, in Core DB but
with ledger sequence after the latest ingested ledger. Given the fact
that Horizon ingests only successful transactions it was impossible to
find results for some of the failed transactions (especially those
failed at the consensus level that require more time to process).

`SubmissionTimeout` was changed to 30 seconds because HTTP clients in
SDKs usually timeout in 60 seconds. We want `SubmissionTimeout` to be
lower than that to make sure that they read the response before the
client timeout and 30 seconds is 6 ledgers (with avg. close time = 5
sec), enough for stellar-core to drop the transaction if not added to
the ledger and ask client to try again by sending a `Timeout` response.

It also contains improved logging in `txsub` package.
@MonsieurNicolas
Copy link
Contributor

this seems fine as a quick fix but we should make sure to fix this when we ingest failed transactions: there is an inherent race condition with that approach as it's possible that core deletes transactions for old ledgers as soon as Horizon completes its ingestion

@bartekn
Copy link
Contributor Author

bartekn commented Sep 26, 2018

there is an inherent race condition with that approach as it's possible that core deletes transactions for old ledgers as soon as Horizon completes its ingestion

Thanks for reminding about this.

Testing it at horizon-testnet.stellar.org and results are great so far! 504s dropped to 0. Going to leave it there for a couple hours and then release Horizon 0.14.2 with this PR and other small improvements on master.

screen shot 2018-09-26 at 22 07 14

@bartekn bartekn merged commit 6d76a3d into master Sep 27, 2018
@bartekn bartekn deleted the fix-txsub branch September 27, 2018 11:24
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 this pull request may close these issues.

2 participants