GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [core] Fix #6869: Don't hide analysis Error behind AssertionError by adangel · Pull Request #7296 · pmd/pmd

Conversation

@adangel

@adangel adangel commented Nov 5, 2026

Copy link
Copy Markdown
Member

Describe the PR

In multi-threaded mode, an Error thrown during one file's analysis (e.g. a StackOverflowError) was
replaced by AssertionError: Closed listener but not all files have been processed from
DeterministicOutputListenerWrapper.close(). The real cause was lost and the report output was empty.

Reproducer: https://github.com/adangel/scratchpad/tree/pmd-repro-6869-assertion-error

Cause

  1. PmdRunnable rethrows the Error (fail fast, unless -Dpmd.error_recovery is set).
  2. MultiThreadProcessor.close() rethrew it right away and called shutdownNow(), without waiting
    for the files that were still running in other threads.
  3. IOUtil.closeAll only catches Exception, so the Error skipped joining the remaining language analyses.
  4. PmdAnalysis closed the listeners in a finally. The wrapper still had buffered reports (a running
    file hadn't reported yet), so it threw the AssertionError, which replaced the original Error.
    The wrapped renderer was never closed.

Single-threaded mode (--threads 0) isn't affected, because no file can finish out of order.

Changes

  • MultiThreadProcessor.close(): on an Error, still call shutdownNow() so queued files aren't
    started, but wait for the running files before rethrowing. Errors from other files that failed in the
    meantime are added as suppressed. The result matches the single-threaded mode: the files before the
    failure are reported and the original Error is thrown.
  • PmdAnalysis:
    • every language analysis is joined, even if one of them throws an Error.
    • if the analysis already failed, a failure while closing the listeners is logged and added as
      suppressed instead of replacing the original failure (like try-with-resources does).
  • DeterministicOutputListenerWrapper.close(): always close the wrapped listener, so renderers flush
    their output even when the check fails. The AssertionError (with the details from [core] chore: Report unprocessed files in DeterministicOutputListenerWrapper #7181) stays as a
    sanity check.

With the reproducer, PMD now fails with the original StackOverflowError and writes a partial report for
the files that finished.

Related issues

  • Fix [core] AssertionError in DeterministicOutputListenerWrapper.close() under high file/violation count with multithreading #6869
  • Follow-up to [core] chore: Report unprocessed files in DeterministicOutputListenerWrapper #7181, which improved the AssertionError message

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adangel @claude
[core] Fix pmd#6869: Don't hide analysis Error behind AssertionError
c3d82e7
When one file's analysis threw an Error in multi-threaded mode,
MultiThreadProcessor rethrew it without waiting for the files that
were still running. PmdAnalysis then closed the listeners while
reports were still buffered in the DeterministicOutputListenerWrapper,
which threw an AssertionError that replaced the original Error.

- MultiThreadProcessor: on an Error, don't start queued files, but
  wait for the running files before rethrowing. Further Errors are
  added as suppressed.
- PmdAnalysis: close all language analyses even if one throws an
  Error. A failure while closing the listeners is added as suppressed
  to the original failure instead of replacing it.
- DeterministicOutputListenerWrapper: always close the wrapped
  listener, even if not all files have been processed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@pmd-actions-helper

pmd-actions-helper Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-11-05 19:26:42+00:00 for c3d82e7)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 9, 2026
[core] IntelliJ and DeterministicOutputListenerWrapperTest #7306
Open
[core] Fix #7306: Don't close System.out in DeterministicOutputListenerWrapperTest #7346
Open

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[core] AssertionError in DeterministicOutputListenerWrapper.close() under high file/violation count with multithreading

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@adangel
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.