[MGNLEE-645] Cannot stop Magnolia since tomcat upgrade Created: 17/Jun/21  Updated: 26/Apr/22  Resolved: 25/Mar/22

Status: Closed
Project: Magnolia DX Core
Component/s: None
Affects Version/s: 6.2.7, 6.2.15, 6.2.17
Fix Version/s: 6.2.18

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Michael Duerig
Resolution: Fixed Votes: 1
Labels: foundation_team, maintenance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File hanging-tomcat.log    
Issue Links:
Cloners
is cloned by MGNLUI-7052 Use daemon threads for result collect... Closed
Issue split
split to MAGNOLIA-8362 Add debug logging for tracking System... Closed
Relates
relates to MAGNOLIA-8384 ThreadLocal leaking SystemRepositoryS... Open
causality
relation
is related to MGNLTOMCAT-18 Update to Tomcat 9.0.43 or later Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Date of First Response:

 Description   

Since the upgrade MGNLTOMCAT-18 it's not possible to stop 6.2 normally. Instead you have to kill it. The same tomcat upgrade on 5.7 does not suffer from this issue.



 Comments   
Comment by Christopher Chard [ 01/Feb/22 ]

And I thought it was only me... happens to us as well

Comment by Maxime Michel [ 28/Feb/22 ]

FTR mduerig is reporting having seen this issue in his IDE with an old Tomcat version (9.0.10). This makes us doubt this being from the Tomcat upgrade. Also, additional debugging information can be found in the attached thread dump.

dai.ha any reason you never submitted your patch as a PR?

Comment by Maxime Michel [ 28/Feb/22 ]

TODO: move this ticket to the project where the actual issue is coming from. (UI?)

Comment by Richard Gange [ 28/Feb/22 ]

Sounds good. I wasn't entirely sure it was tomcat. Looking back through the changelog MGNLTOMCAT-18 caught my eye. I thought maybe it was related. Perhaps it's the AtmosphereFramework that's creating the problem. That didn't exist yet in 5.7 as far as I know...

Comment by Dai Ha [ 02/Mar/22 ]

mmichel, at that time I was just merely fix for local setup, and these investigations are for preference only and I was take care other topics. For now, what I can say is the problems are still there till now, as mentioned previously, the branch on ui helps most in my case.

Comment by Michael Duerig [ 17/Mar/22 ]

Re. the h2 driver leak:

org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [magnoliaAuthor] registered the JDBC driver [org.h2.Driver] 
but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

The h2 driver is registered automatically as part of Java's service provider mechanism and is apparently not unregistered on shutdown. It is unclear to me whose responsibility this would even be and whether the service provider mechanism even support this. In any case the impact of not deregistering the driver is minimal as there is only ever one static instance being used.

We should not deregister the driver along with the persistent manager (as proposed in this patch), as it might still be used from an other persistent manager.

Best solution IMO is to do nothing (apart from maybe documenting as know issue) and rely on Tomcat doing the right thing.

/cc dai.ha 

Comment by Michael Duerig [ 25/Mar/22 ]

I could not reproduce the thread local leak. Filed MAGNOLIA-8362 for adding logging to help tracing down the leak when it occurs again.

Generated at Mon Feb 12 05:31:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.