bitflicker64 commented on code in PR #3360:
URL: https://github.com/apache/hugegraph/pull/3360#discussion_r4306904119


##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh:
##########
@@ -16,6 +16,60 @@
 # limitations under the License.
 #
 
+function record_jvm_startup_diagnostics() {
+    JVM_STARTUP_TIME=$(date -u +'%Y-%m-%d %H:%M:%S.%N UTC')
+    JVM_STARTUP_LOG_OFFSET=$(stat -c %s ./logs/hugegraph-server.log 
2>/dev/null || echo 0)
+    JVM_STARTUP_STDOUT_OFFSET=$(stat -c %s ./logs/hugegraph-server-stdout.log 
2>/dev/null || echo 0)
+}
+
+function print_jvm_thread_hint() {
+    local kind
+    kind=$(awk '
+        /pthread_create.*\(EPERM\)|pthread_create.*Operation not permitted/ { 
denied = 1 }
+        /[Tt]hread.*Operation not permitted/ { denied = 1 }

Review Comment:
   Minor: This rule matches any line that contains "thread" before "Operation 
not permitted", not only thread-creation failures. Two kinds of startup output 
have that shape. First, the JVM's handler for an uncaught exception prints 
`Exception in thread "main" ...`, and `HugeGraphServer.main` rethrows startup 
failures. With `STDOUT_MODE=false` that line lands in 
`logs/hugegraph-server-stdout.log`, which is now scanned first. Second, the 
log4j pattern `[%t]` puts thread names such as `pool-3-thread-1` into every 
`hugegraph-server.log` line, and that file is scanned in the default image. So 
a startup that fails on a file EPERM (a bind mount refusing chmod or chown, for 
example) is reported as `JVM thread creation was denied (EPERM)` with seccomp 
advice. I fed both shapes to this head's `print_jvm_thread_hint`, and both 
printed the denied hint:
   
   ```
   Exception in thread "main" java.nio.file.FileSystemException: 
/hugegraph-server/rocksdb-data/m/LOCK: Operation not permitted
   2026-10-18 11:36:00 [pool-3-thread-1] [ERROR] o.a.h.b.s.r.RocksDBStore - 
Failed to open RocksDB: IO error: lock: Operation not permitted
   ```
   
   Line 28 already covers both HotSpot spellings (`pthread_create failed 
(EPERM)` and `pthread_create ... Operation not permitted`), so this rule adds 
only these false matches.
   
   Requested change: drop this rule. If it targets a specific JVM message that 
does not mention `pthread_create`, narrow it to that message, for example 
`Failed to start thread`. Then add a negative fixture: an unrelated `Operation 
not permitted` line in the new stdout or server-log bytes, asserting that the 
denied hint is not printed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to