philo-he commented on PR #13728: URL: https://github.com/apache/gluten/pull/13728#issuecomment-7125388323
> Thanks for the fix. We may need to check how this works with the fix #11896? @zhztheplayer, #11896 removed the detach calls because libhdfs detaches its own threads at exit, from a pthread key destructor (`hdfsThreadDestructor`) that still uses its cached `JNIEnv*`. If we detached first, libhdfs would crash (GLUTEN-11895). This PR keeps that rule: it never detaches while a thread is running, and at thread exit it always lets libhdfs go first. Our destructor skips its first call and only acts on its second one, which glibc runs after every other key destructor, including libhdfs's. By then a thread that libhdfs used is already detached, so we do nothing; only threads used by Gluten alone get detached by us. `JniThreadExitTest` covers both orders of the two keys. Removing the "skip first call" step fails the test where libhdfs's key is newer, which is the GLUTEN-11895 case. -- 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]
