Repository navigation
fix(build): clean stale meson lockfile before setup - #2486
Conversation
On Windows, meson <= 1.10.x crashed cryptically in DirectoryLock.__enter__ when the underlying lockfile open() raised an OSError (e.g., from a stale lockfile left by a killed or abandoned meson process). meson 1.11.0 (PR #2483) fixed the crash itself, but the underlying cause -- a stale meson-private/meson.lock file -- still produces an avoidable setup failure on Windows. This patch adds a small helper cleanup_stale_meson_lockfile() that removes the stale lockfile before invoking meson setup, eliminating the failure entirely. The helper is tolerant of file-in-use errors: on failure it logs and continues so the caller still sees the underlying meson error (now visible thanks to the 1.11.0 bump). Call sites: - ci/meson/build_config.py: setup_meson_build() -- before main meson setup invocation (and before the cache-clear retry). - ci/wasm_build.py: ensure_meson_configured() -- before the initial setup and the reconfigure paths. - ci/wasm_build.py: _recover_stale_wasm_build() -- before the self-healing reconfigure attempt. Closes #2484. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a Windows-only helper to remove stale ChangesStale Meson Lockfile Cleanup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ci/meson/build_config.py`:
- Around line 400-429: The function cleanup_stale_meson_lockfile currently
unconditionally unlinks the meson-private/meson.lock file and catches OSError
without explicitly handling KeyboardInterrupt and without restricting the
behavior to Windows; change it to only attempt removal when running on Windows
(use platform.system() or equivalent) and move a KeyboardInterrupt except clause
ahead of the generic OSError handler so SIGINT is re-raised; specifically, guard
the lockfile.unlink call inside a Windows-only branch in
cleanup_stale_meson_lockfile and add an explicit except KeyboardInterrupt: raise
before the except OSError as e: logging/ts_print path that returns False.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b339a14c-084a-4ccb-8265-8d44869b3dda
📒 Files selected for processing (2)
ci/meson/build_config.pyci/wasm_build.py
Apply two corrections to cleanup_stale_lockfile() per CodeRabbit review on PR #2486 (thread 3262492253): - Add Windows-only platform guard via os.name != "nt". The stale lockfile cleanup is only needed for the Windows DirectoryLock bug. On POSIX, the build system uses fcntl/flock (advisory), so removing an in-use lockfile could let a concurrent setup bypass the lock. - Add explicit KeyboardInterrupt handling before the OSError handler, routed through handle_keyboard_interrupt() per project convention. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Closes #2484. Follow-up to #2483 (which bumped the meson floor to 1.11.0 and replaced the cryptic NoneType crash with the real underlying OSError).
On Windows, an abandoned or killed meson process leaves a stale
meson-private/meson.lockfile. The nextmeson setupinvocation hits that stale lock and fails — meson 1.11.0 surfaces the error cleanly now, but the failure itself is avoidable.This patch adds a small helper
cleanup_stale_meson_lockfile()that removes the stale lockfile before invoking meson setup. The helper is tolerant of file-in-use errors on Windows: on failure it logs and continues, so the caller still sees the real underlying error from meson.Call sites
ci/meson/build_config.py::setup_meson_build()— before the main meson setup invocation and before the cache-clear retry.ci/wasm_build.py::ensure_meson_configured()— both the initial setup and the reconfigure-on-source-change branches.ci/wasm_build.py::_recover_stale_wasm_build()— before the self-healing reconfigure attempt.Test plan
bash test --cpp— all tests pass (304/304)bash lint— passmeson-private/, (b) stale lockfile present, (c) lockfile absent.🤖 Generated with Claude Code
Summary by CodeRabbit