Skip to content

Commit 622fb93

Browse files
gmathy2104claude
andcommitted
chore: bump version to 2.3.1 and update documentation
Updated version across all files and documentation for v2.3.1 release: - api.py: Updated FastAPI version and health endpoint version - tests/test_api_integration.py: Updated version assertion - README.md: Updated version badge and title - CHANGELOG.md: Added comprehensive v2.3.1 release notes Changes include: - Detailed documentation of the race condition fix - Explanation of the problem, root cause, and solution - Testing verification notes - Use cases where the bug could occur 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7729fec commit 622fb93

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ All notable changes to Pi Camera Service will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.3.1] - 2025-11-22
9+
10+
### Fixed
11+
12+
#### Critical Race Condition in Camera Reconfiguration
13+
- **CRITICAL BUG FIX**: Added global lock to prevent race conditions in concurrent camera reconfiguration
14+
- **Problem**: Multiple simultaneous requests to change resolution or framerate could cause:
15+
- Service crashes with "Failed to set framerate" errors
16+
- Internal server errors and deadlocks
17+
- Streaming interruptions and inconsistent camera state
18+
- **Root cause**: While `StreamingManager` and `CameraController` had internal locks, there was no global lock protecting the complete stop→reconfigure→start sequence at the API level
19+
- **Solution**: Added `_reconfiguration_lock` (RLock) in `api.py` to serialize all reconfiguration operations
20+
- **Impact**: Concurrent requests to `/v1/camera/resolution` and `/v1/camera/framerate` now execute sequentially and safely
21+
- **Testing**: Verified with multiple concurrent requests - all now succeed without errors or crashes
22+
23+
This was an intermittent, timing-dependent bug that could occur when:
24+
- UI sends multiple rapid configuration changes
25+
- Automation scripts make concurrent API calls
26+
- Multiple clients access the API simultaneously
27+
828
## [2.3.0] - 2025-11-22
929

1030
### Added

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Production-ready **FastAPI** microservice for controlling Raspberry Pi Camera (libcamera/Picamera2) with **H.264 streaming** to **MediaMTX** via RTSP.
44

5-
**Version 2.3** - Dynamic framerate control with intelligent clamping and comprehensive camera capabilities!
5+
**Version 2.3.1** - Critical race condition fix + Dynamic framerate control with intelligent clamping!
66

7-
[![Version](https://img.shields.io/badge/version-2.3.0-blue.svg)](https://github.com/gmathy2104/pi-camera-service/releases)
7+
[![Version](https://img.shields.io/badge/version-2.3.1-blue.svg)](https://github.com/gmathy2104/pi-camera-service/releases)
88
[![Python](https://img.shields.io/badge/python-3.9+-green.svg)](https://www.python.org/)
99
[![FastAPI](https://img.shields.io/badge/FastAPI-0.121+-teal.svg)](https://fastapi.tiangolo.com/)
1010
[![License](https://img.shields.io/badge/license-MIT-orange.svg)](LICENSE)
@@ -381,7 +381,7 @@ sudo journalctl -u pi-camera-service -f
381381
"status": "healthy",
382382
"camera_configured": true,
383383
"streaming_active": true,
384-
"version": "2.3.0"
384+
"version": "2.3.1"
385385
}
386386
```
387387

camera_service/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
168168
app = FastAPI(
169169
title="Pi Camera Service",
170170
description="API for controlling Raspberry Pi camera and streaming to MediaMTX via RTSP",
171-
version="2.3.0",
171+
version="2.3.1",
172172
lifespan=lifespan,
173173
)
174174

@@ -478,7 +478,7 @@ def health_check() -> HealthResponse:
478478
status="healthy" if camera_controller is not None else "initializing",
479479
camera_configured=camera_controller._configured if camera_controller else False,
480480
streaming_active=streaming_manager.is_streaming() if streaming_manager else False,
481-
version="2.3.0",
481+
version="2.3.1",
482482
)
483483

484484

tests/test_api_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_health_endpoint(self) -> None:
6262
assert data["status"] == "healthy"
6363
assert "camera_configured" in data
6464
assert "streaming_active" in data
65-
assert data["version"] == "2.3.0"
65+
assert data["version"] == "2.3.1"
6666

6767
print("✓ Health endpoint working")
6868

0 commit comments

Comments
 (0)