Skip to content

Commit e26f1dc

Browse files
cursoragentlcian
andcommitted
Add troubleshooting doc for Sentry CLI execution failures in Java
Co-authored-by: lorenzo.cian <[email protected]>
1 parent 21777fc commit e26f1dc

File tree

1 file changed

+77
-0
lines changed
  • docs/platforms/java/common/troubleshooting/sentry-cli-execution-fails

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Sentry CLI Execution Fails
3+
description: "Troubleshoot and resolve sentry-cli execution failures in CentOS environments."
4+
sdk: sentry.java
5+
categories:
6+
- java
7+
- troubleshooting
8+
sidebar_order: 1001
9+
---
10+
11+
The Sentry Maven plugin may fail to execute `sentry-cli` in certain environments, particularly on CentOS 7 with Java 14 or later. This issue is caused by changes in the JVM's process launching mechanism.
12+
13+
## Symptoms
14+
15+
When this issue occurs, you may see:
16+
17+
- No output from `sentry-cli` execution
18+
- Build failures with `SentryCliException`
19+
- Error messages like `Failed to exec spawn helper: pid: X, exit value: 127`
20+
- Empty output files in `/tmp/maven*cli`
21+
22+
## Root Cause
23+
24+
Starting from Java 14, the JVM uses `posix_spawn` under the hood to launch new processes. This can cause issues in certain environments, particularly on older Linux distributions like CentOS 7.
25+
26+
## Solution
27+
28+
Add the following JVM option to switch the launch mechanism to `vfork`:
29+
30+
```bash
31+
-Djdk.lang.Process.launchMechanism=vfork
32+
```
33+
34+
### Maven Configuration
35+
36+
Add the JVM option to your Maven configuration:
37+
38+
```xml {tabTitle:Maven}{filename:pom.xml}
39+
<plugin>
40+
<groupId>io.sentry</groupId>
41+
<artifactId>sentry-maven-plugin</artifactId>
42+
<configuration>
43+
<jvmArgs>
44+
<jvmArg>-Djdk.lang.Process.launchMechanism=vfork</jvmArg>
45+
</jvmArgs>
46+
</configuration>
47+
</plugin>
48+
```
49+
50+
### Command Line
51+
52+
Alternatively, you can pass the JVM option directly when running Maven:
53+
54+
```bash
55+
mvn clean package -Djdk.lang.Process.launchMechanism=vfork
56+
```
57+
58+
### Jenkins Configuration
59+
60+
If running in Jenkins, add the JVM option to your build configuration:
61+
62+
```groovy {tabTitle:Jenkins Pipeline}{filename:Jenkinsfile}
63+
pipeline {
64+
agent any
65+
stages {
66+
stage('Build') {
67+
steps {
68+
sh 'mvn clean package -Djdk.lang.Process.launchMechanism=vfork'
69+
}
70+
}
71+
}
72+
}
73+
```
74+
75+
## Related Issue
76+
77+
For more details about this issue and the investigation process, see [GitHub Issue #169](https://github.com/getsentry/sentry-maven-plugin/issues/169).

0 commit comments

Comments
 (0)