You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 addedLatest-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 atLatest-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 inSession.BeginTx
(wrapper around std:database/sql.Conn.BeginTx
). Thectx
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 thecontext 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 removingCtx
works.The text was updated successfully, but these errors were encountered: