yaooqinn opened a new issue, #13788:
URL: https://github.com/apache/gluten/issues/13788

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   With `spark.gluten.sql.columnar.libpath=<dir>/libvelox.so`, the first query 
that fetches native metrics crashes the JVM:
   
   ```
   #  SIGSEGV (0xb) ...
   V  [libjvm.so+0x9d35dd]  jni_NewObjectV+0xbd
   C  [libgluten.so+...]  JNIEnv_::NewObject(_jclass*, _jmethodID*, ...)
   C  [libgluten.so+...]  
Java_org_apache_gluten_metrics_IteratorMetricsJniWrapper_nativeFetchMetrics
   ```
   
   Cause: in libpath mode `VeloxListenerApi` passes only `libvelox.so` to 
`System.load`. `libgluten.so` is mapped by the dynamic linker as a dependency, 
so its `JNI_OnLoad` never runs and core JNI globals such as 
`metricsBuilderClass` stay null. The default bundled load loads `libgluten.so` 
first and is not affected.
   
   Repro: Spark 4.1.1 local, a 2-stage aggregate over parquet (`select k, 
count(id), sum(id) ... group by k`), `libpath` pointing at a locally built 
`libvelox.so`. Loading `libgluten.so` with `System.load` before the session 
starts avoids the crash.
   
   ### Gluten version
   
   main branch
   
   ### Spark version
   
   Spark-4.1.x
   
   ### Spark configurations
   
   `spark.plugins=org.apache.gluten.GlutenPlugin`, 
`spark.gluten.sql.columnar.libpath=<build>/releases/libvelox.so`, off-heap 
enabled, `ColumnarShuffleManager`.
   
   ### System information
   
   Linux x86_64, JDK 17
   
   ### Relevant logs
   
   See the stack above.
   


-- 
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