michael-o commented on pull request #456: URL: https://github.com/apache/tomcat/pull/456#issuecomment-954898919
> > > Something is wrong with the premise, here. I read through [Spring-28472](https://github.com/spring-projects/spring-boot/issues/28472) and looked at the code for `AprLifecycleListener`. `AprLifecycleListener` should not be shutting-down APR twice. In `AprLifecycleListener.lifecycleEvent`, the `Lifecycle.AFTER_DESTROY` handler uses a static lock for cross-thread synchronization and only calls `terminateAPR` if `AprStatus.isAprAvailable` returns `true`. Notably, `terminateAPR` sets `AprStatus.isAprAvailable` to `false`. > > I can see a theoretical threading problem because `AprStatus.isAprAvailable` and `AprStatus.setAprAvailable` are not synchronized, but the static class members being set are declared `volatile` and should require threads to reload their values appropriately. > > Are you sure it's the shutdown that's causing the failure? That's not the failure. Please read my description again. The first Tomcat instance starts `AprLifecycleListener`. The scond skips it. Shutdown does reverse order, so the second Tomcat now shuts down APR globally, releasing the global structures. The first Tomcat is now shutting down, its `AprConnector` tries to use a sub APR pool/object from a pool which has already been released. See * https://github.com/apache/tomcat-native/blob/c17d3e0e0a594604ff4f30065360aacc688cfb50/native/src/jnilib.c#L243-L262 * https://github.com/apache/tomcat/blob/ae4ee893f99f226fe5fdc8e933313e2e759d0733/java/org/apache/tomcat/jni/Library.java#L102-L109 * https://apr.apache.org/docs/apr/1.6/group__apr__library.html#ga4a91a6b9ff457ead13e670950127761a -- 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: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org