Skip to content

fix(crawlers)!: Retry the request when taking a session or storing its results fails - #2584

Draft
Mantisus wants to merge 3 commits into
apify:v2from
Mantisus:internal-errors-as-request-errors
Draft

Mantisus wants to merge 3 commits into
apify:v2from
Mantisus:internal-errors-as-request-errors

Conversation

@Mantisus

@Mantisus Mantisus commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Description

An error in taking a session for a request, in storing the results of its request handler, or in marking it as handled after the handler succeeded now fails only that request. The crawler retries the request and passes it to the failed_request_handler once no retries are left. Such an error used to end the crawl. Storing the results now gets internal_timeout to finish, and an error from a session pool that's no longer active still ends the crawl. When taking the session failed, the error_handler and the failed_request_handler get a retired session without a proxy.

The crawler now writes the key-value store records first, then adds the requests, and pushes the dataset items last, so a retry after a failed commit pushes the items again only when pushing them failed partway. A retry after a failed mark runs the request handler again, so its results are stored twice. Storage errors don't mark the session as bad.

Issues

Testing

  • New unit tests for the crawler.

✍️ Drafted by Claude Code

@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 3, 2026
@Mantisus Mantisus self-assigned this Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant