Repository navigation
Don't let one failed WebKit export check crash the poller - #276
Open
DanielRyanSmith wants to merge 1 commit into
Open
DanielRyanSmith wants to merge 1 commit into
DanielRyanSmith wants to merge 1 commit into
Conversation
The WebKit export poller handled each pull request in an async `forEach` callback. The surrounding `try`/`catch` doesn't see errors thrown in those callbacks, so any failure became an unhandled rejection, which exits the process on current Node. One bad response from bugs.webkit.org (or GitHub, or Specref) for one PR therefore killed the whole poll before any PR was approved, and the instance with it. This happened on both full polls after #274 was deployed. Empty responses from bugs.webkit.org (for the history of bug 283585, then for bug 298271) crashed the process ~37s into each poll, so none of the export PRs that were waiting for approval got approved. Move the poller into `lib/webkit-poller.js` so it can be tested, and handle the pull requests one at a time, catching and logging errors for each so that the rest are still checked. Skipped PRs are retried on the next poll. Handling them one at a time also stops the poller from sending ~100 simultaneous requests to bugs.webkit.org. As before, a failure to add labels is logged and doesn't stop the PR from being approved. Some or all of the code in this commit was generated by an AI agent. Assisted-by: AI agent
DanielRyanSmith
force-pushed
the
fix-webkit-poller-crash
branch
from
October 22, 2026 18:27
063a771 to
3146dd5
Compare
DanielRyanSmith
marked this pull request as ready for review
October 22, 2026 18:27
Collaborator
Author
|
I ran this change against the real wpt repository and bugs.webkit.org through a full WebKit export poll, and it seems to work as intended, including approving this PR: web-platform-tests/wpt#64029 |
Member
Before you start on that, you should just review #271 which does that! |
Member
|
Looking closer, everything this PR does is already done by #271, except for the refactoring away from index.js. Given that was already awaiting review, it would've been good to just get that landed! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the bot polled for bug information from bugs.webkit.org, occasionally the response would be empty, which crashed the whole process. This change makes it so that an occasional empty response doesn't crash things. It may be that large number of requests all at once are getting throttled, but this should allow partial recovery at the very least.
Details
The WebKit export poller handled each pull request in an async
forEachcallback. The surroundingtry/catchdoesn't see errors thrown in those callbacks, so any failure became an unhandled rejection, which exits the process on current Node. One bad response from bugs.webkit.org (or GitHub, or Specref) for one PR therefore killed the whole poll, and the instance with it, before any PR was approved.Since #274 was deployed, this has happened on every full poll, so the WebKit export PRs that are waiting for approval still haven't been approved:
invalid json response body at https://bugs.webkit.org/rest/bug/283585/history?...invalid json response body at https://bugs.webkit.org/rest/bug/298271?...The failing bug changes from poll to poll, and the same requests succeed when made on their own, so this looks like bugs.webkit.org sometimes returning empty responses when the poller sends ~100 logged-in requests at once. Before #274, the same pattern crashed the bot on other transient errors, e.g. an
ECONNRESETfrom api.specref.org on 2026-10-21.Changes
lib/webkit-poller.jsso it can be tested (index.jsstarts the server when it's loaded).#N: Unable to check WebKit export; will retry on the next poll.) so the rest are still checked. Skipped PRs are retried on the next poll.Checked N WebKit-exported pull requests; M failed.webkitExportlog entry for each PR, a failure to add labels still doesn't stop the PR from being approved, and a failure to list PRs is still caught and logged byindex.js.Testing
npm testpasses (lint, 84 tests, coverage). The newtest/webkit-poller.jscovers:forEach(async …)insidetry/catchpattern exits Node 24 with code 1 when one callback throws.Notes
/rest/bug?id=A,B,C&include_fields=id,see_alsoand/rest/bug/A/history?ids=B&ids=C), so a poll could make about 2–4 Bugzilla requests instead of ~100. That also makes polls fast again. Reusing connections inlib/bugs-webkit.jswith a capped keep-alive agent is another option. This PR keeps the minimal crash fix separate; the per-PR error handling is needed either way.labelModel.post(n, labels, dryRun), but its signature is(issue, labels, log, dryRun), so--dry-rundoesn't stop labels from being added.Some or all of the code in this change was generated by an AI agent.