[jboss-jira] [JBoss JIRA] (WFCORE-3210) Wildfly module isolation not working consistently

Nuno Godinho de Matos (JIRA) issues at jboss.org
Mon Aug 28 17:20:00 EDT 2017


    [ https://issues.jboss.org/browse/WFCORE-3210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454923#comment-13454923 ] 

Nuno Godinho de Matos commented on WFCORE-3210:
-----------------------------------------------

Hi James,

Two things.
First,  it would be great if you could guide me to the trick to do what you said in your reply.
Namely, how exactly hand I get my log4jwildfly.properties file configuration - which I do not deploy per application - i want to be using at Widlfly wide level - to get used. 
What I have right now, as you have summarized, is the subsytem logging ehanced with a custome handler that does this rooting for the hole wildfly.
And then my handler, once it is configuration with the jboss.server.log.dir - will read the log4jwildfly.properties and set itself to rout to log4j.

And finally, it will also reload its configuration if detects a timestamp change in the log4jwildfly.properties file - to adapt to any dynamic changes set by a user.
There multiple custom handlers in this properties file.
And we have no intention of setting log4j.properties on a per deployment/war configuration.
We want this coinfiguration to be cross cutting for a running instance.
It would be great if there is a better approach than what I am doing.


The second point is the issue I am seing.
So as I explain in the thread.
When I first create a wildfly domain, I typically see on the first startup of the new wildfly standalone domain errors like this:

{panel}
A "org.apache.log4j.PatternLayout" object is not assignable to a "org.apache.log4j.Layout" variable.
2017-08-25 14:50:59,597 ERROR [stderr] (Controller Boot Thread)
log4j:ERROR The class "org.apache.log4j.Layout" was loaded by
2017-08-25 14:50:59,598 ERROR [stderr] (Controller Boot Thread)
log4j:ERROR [ModuleClassLoader for Module "company.org.apache.log4j1:main" from local module loader @5b1d2887
(finder: local module finder @46f5f779 (roots: C:\dev\appserver\wildfly\wildfly-10.1.0.Final\modules,C:\dev\appserver\wildfly\wildfly-10.1.0.Final\modules\system\layers\base))]
whereas object of type
2017-08-25 14:50:59,598 ERROR [stderr] (Controller Boot Thread) log4j:ERROR
"org.apache.log4j.PatternLayout" was loaded by [ModuleClassLoader for Module "org.jboss.log4j.logmanager:main" <----- This guy has common classes
from local module loader @5b1d2887 (finder: local module finder @46f5f779 (roots: C:\dev\appserver\wildfly\wildfly-10.1.0.Final\modules,C:\dev\appserver\wildfly\wildfly-10.1.0.Final\modules\system\layers\base))].
{panel}


This errors then immediately disappear on the 2nd, 3rd an nth deployment.

Then, If I decide I want to start the stanalone domain using eclipse.
i can open eclipse and tell it to start the server.
The first time I do this, I get the above errors of class loading.
If I then stop the server, the 2nd, 3rd and nth tries the startup goes flawlessly and log routing is working perfectly just like I want it to be.
If I stop starting with eclipse, and switch back to starting via bat file, the same story.
The first try I have problems, the 2nd the problems on class loading go away.

And I believe that with the module setup I have shown on the wildfly thread, I simply should never get this class loading error from within the custom handler.
For the custom handler I have written, there simply should exist none of the org.jboss.log4j classes, because the module of this handler is trying by all means possible to ask for wildfly to isolate it from the bundled log4j.

So that is the issue.

Many thanks.


> Wildfly module isolation not working consistently
> -------------------------------------------------
>
>                 Key: WFCORE-3210
>                 URL: https://issues.jboss.org/browse/WFCORE-3210
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: Logging, Modules
>    Affects Versions: 2.2.0.Final
>            Reporter: Nuno Godinho de Matos
>
> There is an underministic bug on the module layer of wildfly, whereby the boot logic of the application server is not ensured to give the appropriate module isolation - which can lead to unexpected boot classpath problems.
> An example of this phenomena is given on the wildfly forum thread:
> https://developer.jboss.org/thread/275839
> In this example, we have the logging subsystem setup to use a custome handler.
> The custom handler wishes to have acces to the JUL extension classes on the org.jboss.logmanger module, but wishes to do have no relationship with the org.apache.log4j packages associated to the wildfly org.jboss.log4j module.
> What we see in this example is that an application gets from wildfly mixed behavior.
> Most of the time, during boot, the processes works without problem, where the custom handler runs isolated from the undersired log4j libraries within wildfly.
> But other times the application boot procedure will not go smoothly with the custom handler having processes routing JUL LogRecords events into the bundled log4j because the application server has loaded some of the classes that exist the org.jboss.log4j module.
> And as we know when the same class is loaded by different class loaders, then that class that orinates from class loader A cannot be assigned to the corresponding class of class loader B, even if the classes are exactly the same.
> This is not an isolated issue.
> There are also open issues on the wildfly forum reporting on startup problems on the logging subsystme where sometimes the LogManager class had not yet been loaded, and sometimes this issue goes away.
> This is an indication of some deep issue engrained into the module loading, where the module isolation behavior is not ensured to work all the time and that the boot procedure is not deterministically reliable. 
> It should not be that the application server some time starts successfully and others not.
> Booting wildfly should always result in the same outcode.
> Problems of this nature with class loading problems should either always happen if the configuration is not done properly or never happen if the configuration is proper.
> In the case of thread:
> https://developer.jboss.org/thread/275839
> Our belief is that the configuration is doing all it possible can to request the necessary module isolation from base packages and the outcome where log4j class load problems take place should never be allowed to happen.
> Many thanks.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list