SIGKILL used instead of SIGTERM when force-killing backup process
Priority: High Component: backup.py Type: Bug
Description
When the --force flag is used and a previous backup is still running, the code sends SIGKILL to terminate it. This doesn't allow the previous process to clean up resources, release locks, or remove incomplete backups.
Location
curateipsum/backup.py:128
Current Code
os.kill(pid,signal.SIGKILL)
Problem
SIGKILL (signal 9) cannot be caught or ignored by the process, preventing graceful cleanup. This could leave:
Incomplete backup directories
Unclosed file descriptors
Corrupted backup metadata
Proposed Solution
Send SIGTERM first, wait briefly, then escalate to SIGKILL if needed:
_lg.warning("Sending SIGTERM to process %d",pid)os.kill(pid,signal.SIGTERM)time.sleep(5)if_pid_exists(pid):_lg.warning("Process %d didn't terminate, sending SIGKILL",pid)os.kill(pid,signal.SIGKILL)
Impact
High - Current behavior can leave backup directory in inconsistent state.
# SIGKILL used instead of SIGTERM when force-killing backup process
**Priority:** High
**Component:** backup.py
**Type:** Bug
## Description
When the `--force` flag is used and a previous backup is still running, the code sends `SIGKILL` to terminate it. This doesn't allow the previous process to clean up resources, release locks, or remove incomplete backups.
## Location
`curateipsum/backup.py:128`
## Current Code
```python
os.kill(pid, signal.SIGKILL)
```
## Problem
`SIGKILL` (signal 9) cannot be caught or ignored by the process, preventing graceful cleanup. This could leave:
- Incomplete backup directories
- Unclosed file descriptors
- Corrupted backup metadata
## Proposed Solution
Send `SIGTERM` first, wait briefly, then escalate to `SIGKILL` if needed:
```python
_lg.warning("Sending SIGTERM to process %d", pid)
os.kill(pid, signal.SIGTERM)
time.sleep(5)
if _pid_exists(pid):
_lg.warning("Process %d didn't terminate, sending SIGKILL", pid)
os.kill(pid, signal.SIGKILL)
```
## Impact
**High** - Current behavior can leave backup directory in inconsistent state.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
SIGKILL used instead of SIGTERM when force-killing backup process
Priority: High
Component: backup.py
Type: Bug
Description
When the
--forceflag is used and a previous backup is still running, the code sendsSIGKILLto terminate it. This doesn't allow the previous process to clean up resources, release locks, or remove incomplete backups.Location
curateipsum/backup.py:128Current Code
Problem
SIGKILL(signal 9) cannot be caught or ignored by the process, preventing graceful cleanup. This could leave:Proposed Solution
Send
SIGTERMfirst, wait briefly, then escalate toSIGKILLif needed:Impact
High - Current behavior can leave backup directory in inconsistent state.