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

Context deadline error returned by BeginTX in getAccountInfo #1974

Closed
bartekn opened this issue Nov 22, 2019 · 1 comment
Closed

Context deadline error returned by BeginTX in getAccountInfo #1974

bartekn opened this issue Nov 22, 2019 · 1 comment
Assignees
Labels

Comments

@bartekn
Copy link
Contributor

bartekn commented Nov 22, 2019

What version are you using?

Horizon 0.23.1


Sometimes error starting transaction: beginTx failed: context deadline exceeded error is returned while streaming /acccounts/{id}. In Horizon 0.23.0 we added Latest-Ledger header that includes sequence number that returned data will be consistent with. For example, if you request /accounts/{id} account, all of it's trust lines and data will be have values exactly at Latest-Ledger (what wasn't always true in the old system).

To achieve this, when a request to state endpoints comes we start a Repeatable Read transaction. Now, it's possible to set support/db.Session.Ctx value used in Session.BeginTx (wrapper around std: database/sql.Conn.BeginTx). The ctx value we're using now has a request deadline (55 sec.) set.

Still need to check it out but my guess is that if ctx is cancelled during the lifetime of this transaction the context deadline exceeded will be returned.

Short term fix is probably to remove setting support/db.Session.Ctx, in such case DB query will not be cancelled and will complete.

However, it's possible that we'll implement #1950 in the future. If so, it's worth adding a global code that returns 504 Gateway Timeout for such errors.

For now, I think we should go with the short term fix.

If my guess is right the solution should be -1 commit so adding to Horizon 0.24.0. Ideally, assignee should repro this and ensure removing Ctx works.

@bartekn bartekn added this to the Horizon 0.24.0 milestone Nov 22, 2019
@tamirms tamirms self-assigned this Nov 25, 2019
@bartekn
Copy link
Contributor Author

bartekn commented Dec 2, 2019

Closed in #1977.

@bartekn bartekn closed this as completed Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants