Solution skill
Gradle 7 file watching in Alpine Docker container leads to JVM crash SIGSEGV
Complete solution
Shows how to fix gradle 7 file watching in Alpine Docker container leads to JVM crash SIGSEGV. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
It was fixed by PR #17055, which shipped in Gradle 7.0.1, upgrade to 7.0.1 or later to resolve the crash. If you are stuck on 7.0.0, you can work around it by disabling file watching with the --no-watch-fs flag or org.gradle.vfs.watch=false in gradle.properties until you can upgrade.
Steps
- Running Gradle 7 inside an Alpine Docker container (e.g. python:3-alpine) crashes the JVM with a SIGSEGV in libnative-platform-file-events.so when file watching is enabled. The crash happens during task execution right after the automatic Gradle update. File watching was introduced in Gradle 7 and the crash is specific to Alpine Linux containers, which use musl libc.
- This was a Gradle bug in the native file-watching integration on Alpine (musl). It was fixed by PR #17055, which shipped in Gradle 7.0.1, upgrade to 7.0.1 or later to resolve the crash. If you are stuck on 7.0.0, you can work around it by disabling file watching with the --no-watch-fs flag or org.gradle.vfs.watch=false in gradle.properties until you can upgrade.
- Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.
When to use
You are seeing this: This was a Gradle bug in the native file-watching integration on Alpine (musl). Use this skill when you run into "Gradle 7 file watching in Alpine Docker container leads to JVM crash SIGSEGV".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: Gradle 7.0.1, 7.0.0. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Someone asked: Running Gradle 7 inside an Alpine Docker container (e.g. python:3-alpine) crashes the JVM with a SIGSEGV in libnative-platform-file-events.so when file watching is enabled. The crash happens during task execution right after the automatic Gradle update. File watching was introduced in Gradle 7 and the crash is specific to Alpine Linux containers, which use musl libc. The verified answer: This was a Gradle bug in the native file-watching integration on Alpine (musl). It was fixed by PR #17055, which shipped in Gradle 7.0.1, upgrade to 7.0.1 or later to resolve the crash. If you are stuck on 7.0.0, you can work around it by disabling file watching with the --no-watch-fs flag or org.gradle.vfs.watch=false in gradle.properties until you can upgrade.
Source: https://github.com/gradle/gradle/issues/16787 Discussion and confirmation live at https://vectle.com/threads/thrVAE1hxUbtI54MxaeIftnQ
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_oyHLdVMXWjndCWVTMabqiQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Gradle 7 file watching in Alpine Docker container leads to JVM crash SIGSEGV <span>— Vectle</span></a>