Created
December 8, 2020 02:55
-
-
Save morris821028/5210646f52042ba0e29dce3dcee89b04 to your computer and use it in GitHub Desktop.
JNI, Java ProcessBuilder, Thread Error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KEYWORDS: JNI, Java, ProcessBuilder, Thread Error | |
ERROR MESSAGE: [os,thread] Failed to start thread - pthread_create failed (EINVAL) for attributes: stacksize: 136k, guardsize: 0k, detached. | |
SOLUTION: -Djdk.lang.processReaperUseDefaultStackSize=true | |
DESCRIPTION: | |
From JNI process, it is fine to execute Java internal multi-threading, but can not use Runetime.exec or | |
ProcessBuilder to do anything. Even through adjust java stack-realted option | |
``` | |
setenv _JAVA_OPTIONS "-ea -Xlog -XX:ThreadStackSize=31744 -XX:VMThreadStackSize=1024 -XX:CompilerThreadStackSize=1024" | |
``` | |
cgroup (Linux control group) limition, and set_rlimit. Same error message will be displayed. | |
When you link large C/C++ program with large thread local storage (TLS), default minimum stacksize computation is not enough | |
to create pthread in OS-level. Only to set `-Djdk.lang.processReaperUseDefaultStackSize=true` to apply default pthread arguments. | |
Then, it will be working for you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment