Skip to content

Write partial build-report.json via shutdown hook on crash #13566

Open

Description

@gnodet

Problem

build-report.json is only written at session end via BuildReportCollector.onSessionEnded().
If the build crashes (OOM, kill -9, uncaught exception that bypasses EventSpy), the
report is lost — including all the diagnostic and timing data collected up to that point.

Proposed fix

Register a JVM shutdown hook in BuildReportCollector that writes a partial report
with whatever data has been collected so far. The report should include a
"status": "CRASHED" or "partial": true field so consumers know it's incomplete.

The normal onSessionEnded() path should deregister the shutdown hook to avoid
double-writing.

Note: kill -9 cannot be intercepted by shutdown hooks. This covers OOM, normal
signals, and uncaught exceptions.

Priority

Low — nice-to-have resilience improvement. The normal path works fine.

Related

🤖 Drafted with Claude Code (Claude Opus 4.6). Reviewed and confirmed by @gnodet before submission.

Activity

  1. added
    enhancement
    on Oct 16, 2026
  2. harshab054 commented on Oct 18, 2026

    @harshab054
    Contributor

    Hi Guillaume,

    I'd like to contribute an implementation for this enhancement.

    I noticed that PR #12695 is still open on "feature/build-report", which is part of the stacked build-output overhaul. Would you prefer that I prepare a follow-up patch against "feature/build-report" now, or wait until the stack is merged into "master" and submit an independent PR?

    I want to ensure the contribution fits your planned direction and avoids conflicts with the ongoing work.

    Thanks!

  3. codewithsinchana commented on Nov 11, 2026

    @codewithsinchana
    Contributor

    Hi, I've implemented a shutdown hook to write a partial build report when Maven terminates unexpectedly before the build session completes. The implementation reuses the existing report collection and persistence logic. Thank you.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmvn4

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions