Bug 340006 - Context configuration stops working when webapp is updated
Summary: Context configuration stops working when webapp is updated
Status: ASSIGNED
Alias: None
Product: Virgo
Classification: RT
Component: runtime (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.8.0.M02   Edit
Assignee: Violeta Georgieva CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 08:07 EDT by Nobody - feel free to take it CLA
Modified: 2017-06-16 05:15 EDT (History)
3 users (show)

See Also:


Attachments
WAB (1.76 KB, application/java-archive)
2011-03-15 08:07 EDT, Nobody - feel free to take it CLA
no flags Details
context configuration (89 bytes, text/xml)
2011-03-15 08:08 EDT, Nobody - feel free to take it CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2011-03-15 08:07:32 EDT
Created attachment 191205 [details]
WAB

With the attached WAB in pickup and the attached configuration in:

config/Catalina/localhost

the request dumper valve runs when localhost:8080/samplewab is invoked.

If the WAB is undeployed and redeployed, or simply refreshed, the request dumper valve no longer runs.

The request dumper valve may be seen in action by tailing serviceability/logs/log.log.
Comment 1 Nobody - feel free to take it CLA 2011-03-15 08:08:01 EDT
Created attachment 191206 [details]
context configuration
Comment 2 Nobody - feel free to take it CLA 2011-03-15 08:09:00 EDT
If Virgo Tomcat server is restarted, the request dumper valve then starts running again when the sample WAB is driven.
Comment 3 Violeta Georgieva CLA 2011-05-11 02:16:25 EDT
The problem is a bit different. Here is what happens:

When the application is undeployed, the following  method is invoked: 

org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappClassLoader.clearReferences()

In this method we try to:
- Unregister JDBC drivers loaded by the web application's classloader
- Clear the IntrospectionUtils cache
- Clear the classloader reference in the VM's bean introspector
- Clear the classloader reference in common-logging

Actually the last one invokes:

org.apache.juli.logging.LogFactory.release(this);

This will invoke java.util.logging.LogManager to reset Loggers and to close all  Loggers' handlers.

In Virgo we use the default java.util.logging.LogManager so when the web application is undeployed all Loggers are reset and their handlers are closed.

When the application is deployed again and we make a request, RequestDumperValve tries to log, but there are no handlers that can process this invocation.

In pure Tomcat there is an extension of java.util.logging.LogManager called org.apache.juli.ClassLoaderLogManager

It is made in a way to reset only

org.apache.juli.ClassLoaderLogManager
        ...
327     private void resetLoggers(ClassLoaderLogInfo clLogInfo) {
328     // This differs from LogManager#resetLogger() in that we close not all
329     // handlers of all loggers, but only those that are present in our
330     // ClassLoaderLogInfo#handlers list. That is because our #addLogger(..)
331     // method can use handlers from the parent class loaders, and closing
332     // handlers that the current class loader does not own would be not
333     // good.
        ...

So I tried the following:
- Copied com.springsource.org.apache.juli.extras.springsource-6.0.29.S2-r1559.jar in <Virgo-Home-Dir>/lib
- Added the following to the <Virgo-Home-Dir>/bin/dmk.bat: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

Now I can see the RequestDumperValve logs always i.e. there is no problems any more. But with this LogManager I can see logs only in the console and not in the log files :(

So there two possible solutions:
- to make our java.util.logging.LogManager extension
- to remove org.apache.juli.logging.LogFactory.release(this) from BundleWebappClassLoader.clearReferences()
Comment 4 Nobody - feel free to take it CLA 2011-05-11 03:46:14 EDT
I am nervous about removing the release call from clearReferences as the purpose was to avoid a memory leak and the memory leak would probably return.
Comment 5 Violeta Georgieva CLA 2011-05-11 05:54:09 EDT
(In reply to comment #4)
> I am nervous about removing the release call from clearReferences as the
> purpose was to avoid a memory leak and the memory leak would probably return.

Yes I agree that removing release call from clearReferences method is not a good idea.
So we are going into direction to extend java.util.logging.LogManager?
Comment 6 Nobody - feel free to take it CLA 2011-05-11 07:19:36 EDT
Yes, that's seems like the best direction to explore.
Comment 7 Nobody - feel free to take it CLA 2011-07-19 07:08:25 EDT
Deferring to next release.
Comment 8 Nobody - feel free to take it CLA 2012-09-17 04:51:30 EDT
Since 3.5.0 has shipped, targeting 3.6.0. If this bug is more urgent, please target 3.5.1 and provide a fix.
Comment 9 Nobody - feel free to take it CLA 2012-12-19 05:28:02 EST
Missed 3.6.0, so targetting 3.7.0.
Comment 10 Florian Waibel CLA 2017-02-16 03:21:06 EST
Missed 3.7.0, so targetting 3.8.0.