Skip to content

[JENKINS-73835] Builds can be deleted while they are still running #16558

@jenkins-infra-bot

Description

@jenkins-infra-bot

Builds can be deleted via the /doDelete REST API, and the delete-builds CLI command while they are still running. The “Delete build” link in the sidepanel of builds is hidden unless !it.building and !it.keepLog, but this is a UI-only restriction. Run.delete has the same issue, but in practice all of the callers that I found in plugins already check whether the build is done building (most calls are in LogRotator implementations where LogRotator.shouldKeepRun handles the issue), but there are some subtle race conditions regarding checking Run.isBuilding instead of Run.isLogUpdated that can lead to LogRotator deleting Pipeline builds while they are in the middle of finishing.

Deleting a build while it is running can cause various kinds of anomalous behavior as the build continues to run despite its configuration directory being deleted, and it is likely that the build will return after a Jenkins restart since build.xml may be rewritten as the build continues running.


Originally reported by dnusbaum, imported from: Builds can be deleted while they are still running
  • assignee: dnusbaum
  • status: Closed
  • priority: Minor
  • component(s): core
  • label(s): 2.479.1-fixed
  • resolution: Fixed
  • resolved: 2024-10-14T18:50:51+00:00
  • votes: 0
  • watchers: 2
  • imported: 2025-11-24
Raw content of original issue

Builds can be deleted via the /doDelete REST API, and the delete-builds CLI command while they are still running. The “Delete build” link in the sidepanel of builds is hidden unless !it.building and !it.keepLog, but this is a UI-only restriction. Run.delete has the same issue, but in practice all of the callers that I found in plugins already check whether the build is done building (most calls are in LogRotator implementations where LogRotator.shouldKeepRun handles the issue), but there are some subtle race conditions regarding checking Run.isBuilding instead of Run.isLogUpdated that can lead to LogRotator deleting Pipeline builds while they are in the middle of finishing.

Deleting a build while it is running can cause various kinds of anomalous behavior as the build continues to run despite its configuration directory being deleted, and it is likely that the build will return after a Jenkins restart since build.xml may be rewritten as the build continues running.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions