contextVersion NullPointerException due to race condition

2024-02-29 Thread FRANTS Patrick
Not sure this is the right mailing list or that it should go to dev.



One of our unit tests will occasionally have a null pointer exception durin=

g shutdown. Unfortunately I have not been able to create a small reproducti=

on yet.



The scenario is as follows.



  *   SpringApplicationShutdownHook calls Tomcat.stop() and a contextVersio=

n used by a SSE request is removed through MapperListener.unregisterContext

  *   A tomcat thread processes an IOException ("Connection reset by peer")=

 exception for that SSE request and ends up in Mapper.map() and gets a null=

 result

from contextObjectToContextVersionMap.get(context). In the end this causes =

a NullPointerException in internalMapWrapper when

calling contextVersion.path.length()





This seems to be only in Tomcat 10.1.12+. Tomcat 10.1.11 does not have the =

problem.



Regards,



Patrick


This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Syst?mes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data 
privacy policy as described on our website. Should you have any questions 
related to personal data protection, please contact 3DS Data Protection Officer 
https://www.3ds.com/privacy-policy/contact/



How to properly enable logging in "org.apache.catalina.core.StandardContext"

2024-02-29 Thread David Karr
In our SpringBoot services, we sometimes run into situations where we get
an exception like this:

org.springframework.context.ApplicationContextException: Unable to start
web server; nested exception is
org.springframework.boot.web.server.WebServerException: Unable to start
embedded Tomcat


It doesn't provide any meaningful root cause.  I've googled how to get more
verbosity from this, but the results are so varied and often conflicting,
and I've never found a strategy that works. It appears that the logger used
in Catalina is not directly compatible with logback, or I'm not figuring
out the correct logger name to use.

I was finally able to figure out why this particular failure was happening,
but that was by carefully stepping through the code and finding new
breakpoints to drill down further. I saw references to the "juli" framework
for logging, which I had seen mentioned in the threads that talk about
getting these logs, but I was never able to get it to work.

As opposed to using my serious debugging skills, I'd like to figure out how
to simply increase the Tomcat logging levels so we can get better
information.