Skip to content

Decide How to handle Transaction Submission Timeout #558

Description

@b-yap

Context

It seems like resubmissions of Stellar transactions sometimes failed due to race conditions. This was probably because the same Stellar account was used by two vault clients (or in this case, two integration test jobs running at the same time) thus the sequence number increased during the resubmissions.

From the failed CI:

ERROR transfer_stellar_asset{request_type=Redeem request_id=0xb4e5d0da87b0b1ad3cf0ed0295721d23be3dce617cb6667c5c41afbf82df62fb}: wallet::horizon::responses: Response returned an error: HorizonSubmissionError { title: "Transaction Submission Timeout", status: 504, reason: "Your transaction submission request has timed out. This does not necessarily mean the submission has failed. Before resubmitting, please use the transaction hash provided in extras.hash to poll the GET /transactions endpoint for sometime and check if it was included in a ledger.", result_code_op: [], envelope_xdr: None }

After returning the same transaction, there must have been race conditions, as the next error that appeared:

ERROR transfer_stellar_asset{request_type=Redeem request_id=0xb4e5d0da87b0b1ad3cf0ed0295721d23be3dce617cb6667c5c41afbf82df62fb}: wallet::horizon::responses: Response returned an error: HorizonSubmissionError { title: "Transaction Failed", status: 400, reason: "tx_bad_seq", result_code_op: [], envelope_xdr: Some("AAAAAgAAAABIAqJ3gBZp7ZPNNB6lqFRtrHwsVORcDOsAk9uqkBeoEwAAAGQAACygAAABHAAAAAAAAAABAAAAHERCOWR0ODFLZUxzVUhOVzRFU0dCTHlCNHl6akIAAAABAAAAAQAAAABIAqJ3gBZp7ZPNNB6lqFRtrHwsVORcDOsAk9uqkBeoEwAAAAEAAAAAvLWEHHR8B5HLUxEsvLtwpqTLhqOB93KKa2mitHztRHAAAAABVVNEQwAAAAAU0ZYxsDcX2auaNm4QMh7iZucux2yrYZDwoTNtSCKfiwAAAAAAABODAAAAAAAAAAGQF6gTAAAAQAgHmNMxHyjTF1s4R4vIieggkkHbHCYY69Ccgd+TwouhD0laCxZOhF+MJ6UiF5XdWWoaPk75PAXw7tBKOc6Skw0=") }

Discuss how to handle this:

  • Follow the instructions about polling /transactions;
  • Do not perform resubmission for Transaction Submission Timeouts;
  • Stay as is; no code changes

TODO / Conclusion (based on comments)

  • Reduce the DEFAULT_MAX_BACKOFF_DELAY_IN_SECS from 60 to 10 seconds to make it less likely that this race condition is introduced.

This is not a 100% failsafe mechanism. However, we already generally assume that every vault is only run once, so the vault operator can circumvent this edge case simply by following the guidelines we put in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions