configure -XX:ErrorFile to write JVM crash logs to app log directory #3649#3951
Conversation
ef1f037 to
e6104a6
Compare
These placeholders get resolved by application code, not JVM code. Therefore this mechanism won't work and we need to identify feasible paths as noted in the linked issue. Alternatively, a PR in the JDK is needed to add further variables to the config created by jpackage. |
|
Hi @overheadhunter, Thanks for clarifying that jpackage placeholders ( To address #3649’s goal of predictable crash log locations, I propose using OS temp directories, which are writable and align with JVM fallback behavior (per Oracle docs). Suggested changes:
Alternatively, a “never-existing” path (e.g., Does this approach work, or are other paths preferred? Thanks for your guidance! |
This comment was marked as outdated.
This comment was marked as outdated.
|
I need to correct my self. The documentation says:
From my point of view, it is better to always specify the path to a non existent one for deterministic behaviour. @dhruvbajpai29 Can you update the PR? Please also update the github workflow files ( |
d855538 to
771e9bc
Compare
WalkthroughAdds a JVM option to jpackage invocations in three GitHub Actions workflows to fix the JVM fatal-error log path. .github/workflows/appimage.yml and .github/workflows/mac-dmg.yml now include Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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: 0
🧹 Nitpick comments (2)
.github/workflows/win-exe.yml (1)
169-169: Use forward slashes for Windows path; add timestamp to avoid collisions.Double backslashes are usually fine, but forward slashes avoid escaping issues and are consistent with other options here. Also consider
%tfor uniqueness.- --java-options "-XX:ErrorFile=C:\\nonexistent\\hs_err_pid%p.log" + --java-options "-XX:ErrorFile=C:/nonexistent/hs_err_pid%p_%t.log".github/workflows/mac-dmg.yml (1)
139-139: Same as Linux: verify fallback with unwritable path; consider%t.Please confirm a log is still emitted (and where) on macOS with Temurin 24.0.1+9 when
/nonexistentis used. Adding%thelps avoid overwriting in quick successive crashes.- --java-options "-XX:ErrorFile=/nonexistent/hs_err_pid%p.log" + --java-options "-XX:ErrorFile=/nonexistent/hs_err_pid%p_%t.log"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
dist/linux/appimage/build.shis excluded by!**/dist/**dist/mac/dmg/build.shis excluded by!**/dist/**dist/win/build.ps1is excluded by!**/dist/**
📒 Files selected for processing (3)
.github/workflows/appimage.yml(1 hunks).github/workflows/mac-dmg.yml(1 hunks).github/workflows/win-exe.yml(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-17T12:55:22.351Z
Learnt from: infeo
PR: cryptomator/cryptomator#2666
File: .github/workflows/win-exe.yml:0-0
Timestamp: 2025-06-17T12:55:22.351Z
Learning: In the Cryptomator Windows build workflow, the debug launcher (CryptomatorDebug) should be included in every build as an additional, non-standard executable, not conditionally based on the isDebug input. This design provides users with debugging capabilities when needed without affecting the normal user experience.
Applied to files:
.github/workflows/win-exe.yml
🔇 Additional comments (1)
.github/workflows/appimage.yml (1)
136-136: Confirm fallback on invalid ErrorFile path; optionally include%tsuffix across all packaging– Verify with Temurin 24.0.1+9 that a crash using
-XX:ErrorFile=/nonexistent/...still emits an error log (and note its actual output location).
– To avoid name collisions, apply this tweak in:• .github/workflows/appimage.yml (line 136)
• dist/mac/dmg/build.sh (line 118)
• dist/linux/appimage/build.sh (line 92)
• dist/win/build.ps1 (line 157)Proposed refactor:
- --java-options "-XX:ErrorFile=/nonexistent/hs_err_pid%p.log" + --java-options "-XX:ErrorFile=/nonexistent/hs_err_pid%p_%t.log"
771e9bc to
66af351
Compare
|
Hi @infeo and @overheadhunter, thanks for the guidance! Updated the pr to use a non-existent path for deterministic behavior. Please review and let me know if any further changes are needed. Thanks |
There was a problem hiding this comment.
Two things:
- don't use "nonexistent" as path name. It would be super confusing if this path really exists.
- Don't call the file hserrorpid. Also here, a it is not clear which process created it. And users need to be able to easily identify the files.
My suggestion: [ROOT]/cryptomator/cryptomator_crash.log
There is only by very low chance a directory in the root called "cryptomator". Even if it exists, the crash log is placed in a related directory. And by naming the file, the user can easily identify it.
66af351 to
42ff619
Compare
|
Hi @infeo, I've updated the PR based on your feedback, and it's ready for review. I appreciate all your guidance. |
infeo
left a comment
There was a problem hiding this comment.
Remove the "%p" modifier from the name. This prevents an accumulation of crash logs.
42ff619 to
93bb4c6
Compare
|
Hi @infeo, my apologies. I've removed the %p modifier as requested and updated the pr. |
Closes #3649.
Changes
-XX:ErrorFileto thejpackage--java-optionsin the build scripts for Linux (dist/linux/build.sh), macOS (dist/mac/build.sh), and Windows (dist/windows/build.ps1).@{userhome}for Linux/macOS,@{localappdata}for Windows) to align with the app’s log directory (-Dcryptomator.logDir), ensuringhs_err_pid*.logfiles are stored in user-specific locations:~/.local/share/Cryptomator/logs(Linux),~/Library/Logs/Cryptomator(macOS), and%LOCALAPPDATA%\Cryptomator(Windows).Motivation
Addresses issue #3649 by redirecting JVM crash logs to the same directory as Cryptomator’s regular logs, simplifying log collection for support. The
-XX:ErrorFileflag is set during the jpackage build phase to achieve this.Implementation Details
@{userhome}and@{localappdata}to dynamically resolve to the user’s log directory at runtime, overcoming the limitation noted by @infeo (user account names are unknown at build time, and jpackaged apps cannot read environment variables like$HOME). These placeholders are already used in the scripts for-Dcryptomator.logDir, ensuring consistency.Addressing issues
$APPDIR-equivalent for user home. The placeholders (@{userhome},@{localappdata}) serve this purpose, matching the existing script structure.Testing
mvn clean install.-XX:ErrorFileappears in the launcher config file ( with unexpanded placeholders (@{userhome}/...).-wrote a Java class that used Unsafe to trigger a JVM crash, ran it with the same
-XX:ErrorFileoption i added to the build script, and confirmed that the crash log was created in the expected directory.-XX:ErrorFilebehavior and consistency with existing placeholder usage in the scripts. Open to suggestions for safe crash testing methods.@infeo @overheadhunter Please review and provide any feedback or suggestions.