Skip to content

Fix retry on submit timeout#3407

Open
mkoura wants to merge 3 commits intomasterfrom
fix_submit_timeout_retry
Open

Fix retry on submit timeout#3407
mkoura wants to merge 3 commits intomasterfrom
fix_submit_timeout_retry

Conversation

@mkoura
Copy link
Copy Markdown
Collaborator

@mkoura mkoura commented Apr 10, 2026

This pull request focuses on improving the reliability and robustness of transaction submission to the Cardano Submit API by increasing timeouts and enhancing error handling. The changes also include a dependency update of cardano-clusterlib to a version that improves timeout handling for submit with cardano-cli.

Timeout and Error Handling Improvements:

  • Increased the default timeout for CLI commands in custom_clusterlib.py from 120 seconds to 300 seconds to prevent premature failures during long-running operations.
  • Increased the HTTP request timeout in post_cbor from 60 seconds to 300 seconds and removed the use of contextlib.suppress for ReadTimeout, allowing better error visibility and handling.
  • Improved error handling in submit_tx by explicitly catching requests.exceptions.ReadTimeout and storing the exception for later use, ensuring that timeouts are retried and handled appropriately. [1] [2]

Dependency Updates:

  • Updated the cardano-clusterlib dependency in pyproject.toml to version >=0.10.2,<0.11.0 to stay current with upstream changes and bug fixes.

Code Cleanup:

  • Removed the unused contextlib import from submit_api.py as it is no longer needed after the refactor.

mkoura added 2 commits April 10, 2026 20:00
Update cardano-clusterlib dependency from 0.10.1 to 0.10.2 in pyproject.toml and uv.lock.
The default timeout in ClusterLib.run_cli was increased from 120 to 300 seconds to better accommodate longer-running submit command.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves transaction submission robustness by increasing timeouts for both cardano-cli calls and cardano-submit-api HTTP requests, and by refining timeout handling during submit retries. It also updates the cardano-clusterlib dependency to pick up upstream timeout-related fixes.

Changes:

  • Bump default cardano-cli timeout in the custom ClusterLib wrapper (120s → 300s).
  • Increase submit-api CBOR POST timeout (60s → 300s) and adjust retry/timeout handling to surface ReadTimeout and retry at the submit_tx level.
  • Update cardano-clusterlib dependency to >=0.10.2,<0.11.0 (and refresh uv.lock accordingly).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
cardano_node_tests/utils/submit_api.py Increases HTTP timeout and updates retry/timeout handling for submit-api submissions.
cardano_node_tests/utils/custom_clusterlib.py Extends the default CLI timeout to reduce premature failures on long-running commands.
pyproject.toml Bumps cardano-clusterlib dependency version constraint.
uv.lock Locks resolved dependency update for cardano-clusterlib 0.10.2.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make transaction submission via the Cardano Submit API more robust under slow/unresponsive conditions by increasing timeouts and refining retry/error handling, while also updating cardano-clusterlib to a newer patch release.

Changes:

  • Bumped cardano-clusterlib dependency to >=0.10.2,<0.11.0 (and updated the lockfile accordingly).
  • Increased HTTP submit timeout in post_cbor (60s → 300s) and adjusted retry behavior for MempoolTxTooSlow.
  • Increased default cardano-cli timeout in the custom ClusterLib wrapper (120s → 300s) and added explicit ReadTimeout handling in submit retries.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
uv.lock Locks cardano-clusterlib to 0.10.2 artifacts and updates dependency specifier.
pyproject.toml Updates declared cardano-clusterlib version range to include 0.10.2+.
cardano_node_tests/utils/submit_api.py Raises timeouts, removes ReadTimeout suppression, and refines submit retry logic.
cardano_node_tests/utils/custom_clusterlib.py Increases default CLI timeout to reduce premature failures in long-running commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mkoura mkoura force-pushed the fix_submit_timeout_retry branch 2 times, most recently from eb22d9f to ea6bb09 Compare April 10, 2026 22:45
…dling

- Remove use of contextlib.suppress for ReadTimeout, handle with try/except instead.
- Increase post timeout from 60s to 300s for more robust network handling.
- Refactor retry logic to properly handle "MempoolTxTooSlow" and ReadTimeout cases.
- Improve error tracking and reporting in submit_tx, ensuring exceptions are captured and retried appropriately.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves reliability of transaction submission via the Cardano Submit API by extending timeouts and refining retry/timeout handling, along with bumping the cardano-clusterlib dependency to pick up upstream timeout fixes.

Changes:

  • Increase default cardano-cli timeout in custom_clusterlib.py (120s → 300s).
  • Increase Submit API HTTP timeout (60s → 300s) and adjust retry/error handling in submit_api.py.
  • Update cardano-clusterlib dependency to >=0.10.2,<0.11.0 (and lockfile).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
uv.lock Lockfile bump for cardano-clusterlib 0.10.2.
pyproject.toml Dependency constraint updated to cardano-clusterlib (>=0.10.2,<0.11.0).
cardano_node_tests/utils/submit_api.py Longer HTTP timeout; retry/timeout handling changes for submit via submit-api.
cardano_node_tests/utils/custom_clusterlib.py Default CLI timeout increased to 300s.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -168,6 +168,8 @@ def submit_tx(
utxo_data = cluster_obj.g_query.get_utxo(utxo=txins[0])
if not utxo_data:
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