camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: svn commit: r1409651 - in /camel/trunk: components/camel-cxf/src/test/java/org/apache/camel/component/cxf/ examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/
Date Fri, 16 Nov 2012 08:56:41 GMT
On Fri, Nov 16, 2012 at 12:08 AM, Daniel Kulp <dkulp@apache.org> wrote:
>
> OK.  Was able to reproduce this with the IBM JDK 7 on Linux.
>
> I would consider this a bug in the JDK's garbage collector.   It is being overly aggressive,
IMO.   The code basically looks like:
>
> client = … create client …
> try {
>     client.callMethod(…)
> } catch (Exception) {
> ..
> }
> …. never reference the client object again …
>
> At some point in there, the GC is deciding it can garbage collect the client proxy since
it's never used again.   That causes the finalizer to be called which "closes" the ClientImpl
which nulls out everything.   A simple fix is to add something like:
>
> client.getClass();
>
> after the call which forces the client to hang around.  But this definitely is strange
behavior.   Not sure what we can do to work around it.  :-(   No idea why the GC is deciding
it can be collected before the method even returns.  Not good.   It really shouldn't be garbage
collecting and finalizing something that is obviously still on the stack.
>

Hmm yeah not a good situation.

Just noticed this issue as well on AIX JDK6

[aix5] $ /home/hudson/tools/maven-3.0.2/bin/mvn -f pom.xml
-Dlabel=aix5 -Djdk=jdk6 --settings /home/hudson/.m2/m3-settings.xml -V
-B -fae clean install
Apache Maven 3.0.2 (r1056850; 2011-01-08 18:58:10-0600)
Java version: 1.6.0, vendor: IBM Corporation
Java home: /usr/java6_64/jre
Default locale: en_US, platform encoding: ISO8859-1
OS name: "aix", version: "5.3", arch: "ppc64", family: "unix"




Failed

org.apache.camel.loanbroker.webservice.version.LoanBrokerWSTest.testInvocation

Failing for the past 1 build (Since #24 )
Took 10 sec.
add description
Stacktrace

java.lang.NullPointerException
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:369)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
	at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:81)
	at $Proxy66.getLoanQuote(Unknown Source)
	at org.apache.camel.loanbroker.webservice.version.LoanBrokerWSTest.testInvocation(LoanBrokerWSTest.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
	at org.junit.rules.RunRules.evaluate(RunRules.java:18)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:119)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:101)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
	at $Proxy0.invoke(Unknown Source)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:74)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)


>
>
> Dan
>
>
>
>
>
>
>
>
>
> On Nov 15, 2012, at 2:51 PM, Daniel Kulp <dkulp@apache.org> wrote:
>
>>
>> On Nov 15, 2012, at 9:09 AM, Willem jiang <willem.jiang@gmail.com> wrote:
>>> The bus is set on the client side to avoid the NPE , The most CXF related Unit
tests are shutdown the bus after test to clean up the resources on the server side.
>>> As Claus mentioned we just found the NPE is thrown from the CXF client invoke
method when running the test from AIX (both 1.6.x and 1.7.x)
>>>
>>> I saw there is a IBM JDK 6 test running against CXF trunk, but I don't see this
kind of NPE is thrown from CXF tests as We get from AIX like this
>>>
>>> Running org.apache.cxf.aegis.exception.ExceptionTest Exception in thread "default-workqueue-2"
>>> java.lang.NullPointerException at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:720)
>>> at org.apache.cxf.transport.local.LocalDestination$SynchronousConduit$1$1.run(LocalDestination.java:99)
>>> at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:426)
>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
>>> at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:351)
>>> at java.lang.Thread.run(Thread.java:779)
>>> Tests run: 4, Failures: 0, Errors: 1, Skipped: 1, Time elapsed: 60.493 sec <<<
FAILURE!
>>> testHeaders(org.apache.cxf.aegis.exception.ExceptionTest) Time elapsed: 60.154
sec <<< ERROR!
>>> java.lang.NullPointerException
>>> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:369)
>>> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
>>> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
>>> at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:81)
>>> at $Proxy28.sayHiWithException(Unknown Source)
>>
>> The Bus would be null at this point.   Not sure how that can happen.  It's one of
two things:
>>
>> 1) The bus is passed in as null, which would be really bad
>> 2) The client has been destroyed, thus making the bus null.
>>
>> I would breakpoint the constructors (or add a "assert bus != null" line there, the
test should be enabling assertions) and if it's null, try and figure that out.
>>
>> Dan
>>
>>
>>
>>
>>>
>>>
>>> Any suggestion is appreciated.
>>>
>>> --
>>> Willem Jiang
>>>
>>> Red Hat, Inc.
>>> FuseSource is now part of Red Hat
>>> Web: http://www.fusesource.com | http://www.redhat.com
>>> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>>>         http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
>>> Twitter: willemjiang
>>> Weibo: willemjiang
>>>
>>>
>>>
>>> On Thursday, November 15, 2012 at 9:47 PM, Claus Ibsen wrote:
>>>
>>>> Hi
>>>>
>>>> Dan thanks for sharing this. I guess we should go over the example
>>>> tests and make sure they shutdown properly.
>>>> Those tests Willem is trying to fix, hasn't been surfaced as often, as
>>>> these tests is run last.
>>>> And as many times the CI server may not get so far.
>>>>
>>>> What we have seen is that these tests fails more often on AIX, than
>>>> the other platforms.
>>>> Though we reached the end of the test suite (eg it was able to attempt
>>>> all tests)
>>>>
>>>> So we (I guess its my work to do) can enable the AIX tests again, as
>>>> we have a "complete picture" now, where those examples tests are the
>>>> last issues covered.
>>>>
>>>> BTW: Any chance you guys have seen AIX test failures in Apache CXF
>>>> project itself? And if so do you guys run on both Java6 and Java7?
>>>>
>>>> A piece of a stracetrace shows NPE in CXF itself, but it may be a side
>>>> effect of something else.
>>>>
>>>> 2012-11-13 17:51:20,388 [main ] WARN PhaseInterceptorChain
>>>> - Interceptor for
>>>> {http://version.webservice.loanbroker.camel.apache.org/}LoanBrokerWS#{http://version.webservice.loanbroker.camel.apache.org/}getLoanQuote
>>>> has thrown exception, unwinding now
>>>> java.lang.NullPointerException
>>>> at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:90)
>>>>
>>>>
>>>>
>>>> On Thu, Nov 15, 2012 at 1:47 PM, Daniel Kulp <dkulp@apache.org (mailto:dkulp@apache.org)>
wrote:
>>>>>
>>>>> Willem,
>>>>>
>>>>> If BusFactory.newInstance().createBus() is doing something different
than BusFactory.getDefaultBus(), then likely there is a test ahead of it that doesn't have
a proper teardown that is shutting down the bus. That needs to get fixed.
>>>>>
>>>>> More importantly, you are now creating a bus and not shutting it down
anywhere. Thus, you are now possibly causing issues for the next tests. I'm OK with creating
the new bus to make sure you get a clean slate, but make sure it gets shutdown.
>>>>>
>>>>> Dan
>>>>>
>>>>>
>>>>>
>>>>> On Nov 15, 2012, at 12:32 AM, ningjiang@apache.org (mailto:ningjiang@apache.org)
wrote:
>>>>>
>>>>>> Author: ningjiang
>>>>>> Date: Thu Nov 15 05:32:26 2012
>>>>>> New Revision: 1409651
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=1409651&view=rev
>>>>>> Log:
>>>>>> Try to fix the camel-cxf related test failures
>>>>>>
>>>>>> Modified:
>>>>>> camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
>>>>>> camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMixedModeRouterTest.java
>>>>>> camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java
>>>>>> camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java
>>>>>>
>>>>>> Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
>>>>>> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java?rev=1409651&r1=1409650&r2=1409651&view=diff
>>>>>> ==============================================================================
>>>>>> --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
(original)
>>>>>> +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
Thu Nov 15 05:32:26 2012
>>>>>> @@ -104,7 +104,7 @@ public class CxfConsumerTest extends Cam
>>>>>> ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
>>>>>> clientBean.setAddress(SIMPLE_ENDPOINT_ADDRESS);
>>>>>> clientBean.setServiceClass(HelloService.class);
>>>>>> - clientBean.setBus(BusFactory.getDefaultBus());
>>>>>> + clientBean.setBus(BusFactory.newInstance().createBus());
>>>>>>
>>>>>> HelloService client = (HelloService) proxyFactory.create();
>>>>>>
>>>>>>
>>>>>> Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMixedModeRouterTest.java
>>>>>> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMixedModeRouterTest.java?rev=1409651&r1=1409650&r2=1409651&view=diff
>>>>>> ==============================================================================
>>>>>> --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMixedModeRouterTest.java
(original)
>>>>>> +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMixedModeRouterTest.java
Thu Nov 15 05:32:26 2012
>>>>>> @@ -30,6 +30,7 @@ import org.apache.camel.component.cxf.co (http://org.apache.camel.component.cxf.co)
>>>>>> import org.apache.camel.converter.jaxp.XmlConverter;
>>>>>> import org.apache.camel.impl.DefaultCamelContext;
>>>>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>>>>> +import org.apache.cxf.BusFactory;
>>>>>> import org.apache.cxf.binding.soap.SoapHeader;
>>>>>> import org.apache.cxf.endpoint.Server;
>>>>>> import org.apache.cxf.frontend.ClientFactoryBean;
>>>>>> @@ -145,7 +146,8 @@ public class CxfMixedModeRouterTest exte
>>>>>> ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
>>>>>> ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
>>>>>> clientBean.setAddress(ROUTER_ADDRESS);
>>>>>> - clientBean.setServiceClass(HelloService.class);
>>>>>> + clientBean.setServiceClass(HelloService.class);
>>>>>> + clientBean.setBus(BusFactory.newInstance().createBus());
>>>>>>
>>>>>> HelloService client = (HelloService) proxyFactory.create();
>>>>>> return client;
>>>>>>
>>>>>> Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java
>>>>>> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java?rev=1409651&r1=1409650&r2=1409651&view=diff
>>>>>> ==============================================================================
>>>>>> --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java
(original)
>>>>>> +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java
Thu Nov 15 05:32:26 2012
>>>>>> @@ -25,6 +25,7 @@ import javax.xml.ws.Endpoint;
>>>>>> import org.apache.camel.builder.RouteBuilder;
>>>>>> import org.apache.camel.test.AvailablePortFinder;
>>>>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>>>>> +import org.apache.cxf.BusFactory;
>>>>>> import org.apache.cxf.frontend.ClientProxyFactoryBean;
>>>>>> import org.junit.BeforeClass;
>>>>>> import org.junit.Test;
>>>>>> @@ -66,6 +67,7 @@ public class CxfPayLoadBareSoapTest exte
>>>>>> ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
>>>>>> factory.setServiceClass(BareSoapService.class);
>>>>>> factory.setAddress(PROXY_URL);
>>>>>> + factory.setBus(BusFactory.newInstance().createBus());
>>>>>> BareSoapService client = (BareSoapService) factory.create();
>>>>>>
>>>>>> client.doSomething();
>>>>>>
>>>>>> Modified: camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java
>>>>>> URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java?rev=1409651&r1=1409650&r2=1409651&view=diff
>>>>>> ==============================================================================
>>>>>> --- camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java
(original)
>>>>>> +++ camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java
Thu Nov 15 05:32:26 2012
>>>>>> @@ -38,7 +38,8 @@ public final class Client {
>>>>>> ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
>>>>>> clientBean.setAddress(address);
>>>>>> clientBean.setServiceClass(LoanBrokerWS.class);
>>>>>> - clientBean.setBus(BusFactory.getDefaultBus());
>>>>>> + // just create a new bus for use
>>>>>> + clientBean.setBus(BusFactory.newInstance().createBus());
>>>>>> return (LoanBrokerWS) proxyFactory.create();
>>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Daniel Kulp
>>>>> dkulp@apache.org - http://dankulp.com/blog
>>>>> Talend Community Coder - http://coders.talend.com
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> -----------------
>>>> Red Hat, Inc.
>>>> FuseSource is now part of Red Hat
>>>> Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
>>>> Web: http://fusesource.com
>>>> Twitter: davsclaus
>>>> Blog: http://davsclaus.com
>>>> Author of Camel in Action: http://www.manning.com/ibsen
>>>
>>>
>>>
>>
>> --
>> Daniel Kulp
>> dkulp@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message