Skip to content

Gracefully handle InvalidTestcaseError in variant and minimize tasks - #5406

Merged
dylanjew merged 1 commit into
dylanj/task-errors-3from
dylanj/task-errors-4
Aug 6, 2026
Merged

Gracefully handle InvalidTestcaseError in variant and minimize tasks#5406
dylanjew merged 1 commit into
dylanj/task-errors-3from
dylanj/task-errors-4

Conversation

@dylanjew

@dylanjew dylanjew commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Catch errors.InvalidTestcaseError when retrieving testcase entities in utask_preprocess and utask_postprocess of variant_task and minimize_task, returning cleanly without raising an unhandled exception.

Variant tasks are notoriously error prone because we attempt to repro a crash by fanning out across builds/platforms which might not be supported combinations for whatever reasons. The goal here is to reduce the noise from expected failures so we can alert on real issues.

b/542644855

Testing

deployed to dev. haven't seen any of these new metrics yet but no errors either.

Related PRs

  1. Capture user defined errors separately from UNHANDLED_EXCEPTION #5402
  2. Skip incompatible jobs in variant_task.utask_preprocess #5403
  3. Short-circuit duplicate/deleted testcases when processing/scheduling tasks #5405
  4. This PR: Gracefully handle InvalidTestcaseError in variant and minimize tasks #5406

@dylanjew
dylanjew requested a review from javanlacerda July 30, 2026 18:25
@dylanjew
dylanjew force-pushed the dylanj/task-errors-4 branch from e66fc23 to d286fd8 Compare July 31, 2026 18:14
@dylanjew
dylanjew force-pushed the dylanj/task-errors-4 branch from d286fd8 to 2482cce Compare August 3, 2026 14:01
@dylanjew
dylanjew force-pushed the dylanj/task-errors-4 branch from 2482cce to 15c335a Compare August 3, 2026 20:32
…ask utasks

Catch `errors.InvalidTestcaseError` when retrieving testcase entities in utask_preprocess and utask_postprocess of variant_task and minimize_task, returning cleanly without raising an unhandled exception.
@dylanjew
dylanjew force-pushed the dylanj/task-errors-4 branch from 15c335a to cfa9011 Compare August 6, 2026 14:56
@dylanjew
dylanjew merged commit d25c272 into master Aug 6, 2026
23 checks passed
@dylanjew
dylanjew deleted the dylanj/task-errors-4 branch August 6, 2026 15:14
dylanjew added a commit that referenced this pull request Aug 6, 2026
In `_MetricRecorder.__exit__`, check whether the exception inherits from
`errors.Error `or `testcase_manager.TestcaseManagerError` and record the
coresponding error_condition instead of `'UNHANDLED_EXCEPTION'`.

We want to alert based on `UNHANDLED_EXCEPTION`, and these user defined
Errors represent exceptional but expected scenariors in Clusterfuzz
where the task is not meant to succeed. For example, there is no build
for a variant task that we triggered, or the fuzzer is no longer valid.
In these cases, we typically want to ACK the task and skip it, but these
expected errors make it hard to set up alerts on real issues.

Here's an example of
[logs](https://cloudlogging.app.goo.gl/yMccrYFjRKxeJ1G68) of 2 deleted
Testcases going through the Variant task, failing, and getting retried
multiple times and triggering an alert due to the postprocess error rate
spikes above 20%

b/542644855

### Testing
deployed to dev. haven't seen any of these new metrics yet but no errors
either.

### Related PRs

1. **This PR:** #5402 
2. #5403 
3. #5405 
4. #5406
dylanjew added a commit that referenced this pull request Aug 6, 2026
Catch `TargetNotFoundError` and `InvalidFuzzerError` in
variant_task.utask_preprocess, logging a warning and returning None to
cleanly skip incompatible jobs without logging an exceptional metric.

When we schedule variant tasks, we aggressively schedule variant tasks
to determine whether the crash can repro on other platforms/builds. We
don't know whether all of these are valid combiniations, so many of
these tasks can fail when trying to set up the build.

Note: hide whitespace

b/542644855

### Testing
deployed to dev. haven't seen any of these new metrics yet but no errors
either.

### Related PRs

1. #5402 
2. **This PR:** #5403 
3. #5405 
4. #5406
dylanjew added a commit that referenced this pull request Aug 6, 2026
…tasks (#5405)

During post minimize tasks, if a test case is deleted or marked
duplicate for whatever reason, we should not continue processing the
post minimize tasks. This PR stops scheduling and processing for these
tasks.

In `commands.process_command_impl`, short-circuit and ack the message if
a testcase-based task receives a deleted or duplicate testcase. In
`task_creation.create_postminimize_tasks`, skip scheduling tasks on
duplicate testcases.

Note: hide whitespace

b/542644855

### Testing
deployed to dev. haven't seen any of these new metrics yet but no errors
either.

### Related PRs

1. #5402 
2. #5403 
3. **This PR:** #5405 
4. #5406
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.

3 participants