kolibri
kolibri copied to clipboard
server.pid reads empty while the starting server rewrites it, failing the DEB install smoke test
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
PIDPlugin.set_pid_file(kolibri/utils/server/__init__.py:385) opensserver.pidwith"w", so the file is empty between truncate and write.- A starting server rewrites the file on ENTER, START, SERVING, ZIP_SERVING and RUN. The HTTP port answers before the last rewrites.
check_server_interpreterinplatforms/debian/tests/install_smoke_test.shreads the first line right after port 8080 answers. In that window it gets an empty PID andreadlink /proc//exeprints nothing._read_pid_filereturnsSTATUS_PID_FILE_INVALIDon the same empty read, sokolibri statusandkolibri stopcan hit it too.- The
DEB install tests / Install test (ubuntu:24.04, no system python3)job failed this way on PR #15692, which changes only QTI frontend files: https://github.com/learningequality/kolibri/actions/runs/40482850475/job/122121833972
Errors and logs
PASS: Kolibri is responding on port 8080 (attempt 1)
FAIL: Kolibri server runs on '', expected /opt/kolibri/python/bin/python3.*
Steps to reproduce
- Install the DEB from any PR build in
ubuntu:24.04without systempython3. - Run
platforms/debian/tests/install_smoke_test.sh. - It fails intermittently at
check_server_interpreter.
Acceptance Criteria
- [ ] A reader of
server.pidnever sees an empty or partial file while the server writes it. - [ ] A test fails when
server.pidcan be read between truncate and write.
AI usage
Claude Code traced the CI failure to the PID-file write and drafted this issue while handling CI on #15692.
Plan: Readers of server.pid never see an empty or partial file while the server rewrites it (#15693).
- [ ] Write
server.pidatomically - [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
- When Windows refuses
os.replace(open reader), fall back to the in-place write; if strict atomicity is wanted there, this becomes a retry and the fallback test changes. - Fixed temp name, not
mkstemp; if two servers can start on oneKOLIBRI_HOMEat once, their temp writes collide and this needsmkstemp.
Written by rtibblesbot, an LLM-based coding agent.