The following comment has been added to this issue:

     Author: Howard M. Lewis Ship
    Created: Thu, 19 Aug 2004 3:17 PM
       Body:
Yep, every once in a blue moon it fails.  Caught a stack trace just now:

org.apache.hivemind.ApplicationRuntimeException: Unable to construct service 
hivemind.test.threading.PooledWorker: 
org.apache.hivemind.ApplicationRuntimeException
        at 
org.apache.hivemind.impl.servicemodel.PooledServiceModel.constructPooledService(PooledServiceModel.java:206)
        at 
org.apache.hivemind.impl.servicemodel.PooledServiceModel.obtainPooledService(PooledServiceModel.java:173)
        at 
org.apache.hivemind.impl.servicemodel.PooledServiceModel.getServiceImplementationForCurrentThread(PooledServiceModel.java:157)
        at 
$PooledProxy_fe791cc175_194._service($PooledProxy_fe791cc175_194.java)
        at $PooledProxy_fe791cc175_194.run($PooledProxy_fe791cc175_194.java)
        at $Interceptor_fe791cc17f_195.run($Interceptor_fe791cc17f_195.java)
        at 
org.apache.hivemind.impl.TestServiceModelThreading$RunnableManager.run(TestServiceModelThreading.java:67)
        at java.lang.Thread.run(Thread.java:536)
Caused by: org.apache.hivemind.ApplicationRuntimeException
        at 
org.apache.hivemind.impl.InvokeFactoryServiceConstructor.constructCoreServiceImplementation(InvokeFactoryServiceConstructor.java:100)
        at 
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructCoreServiceImplementation(AbstractServiceModelImpl.java:100)
        at 
org.apache.hivemind.impl.servicemodel.PooledServiceModel.constructPooledService(PooledServiceModel.java:200)
        ... 7 more
Caused by: java.lang.NullPointerException
        at 
org.apache.hivemind.service.impl.BuilderFactory.createCoreServiceImplementation(BuilderFactory.java:48)
        at 
org.apache.hivemind.impl.InvokeFactoryServiceConstructor.constructCoreServiceImplementation(InvokeFactoryServiceConstructor.java:91)
        ... 9 more
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/HIVEMIND-44?page=comments#action_37347

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/HIVEMIND-44

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: HIVEMIND-44
    Summary: Race Conditions in Construction of Threaded Service
       Type: Bug

     Status: Reopened
   Priority: Major

    Project: HiveMind
 Components: 
             framework
   Versions:
             1.0

   Assignee: Howard M. Lewis Ship
   Reporter: Harald Meyer

    Created: Thu, 12 Aug 2004 11:03 AM
    Updated: Thu, 19 Aug 2004 3:17 PM
Environment: J2SDK 1.4.2, Windows XP, Eclipse, Log4J

Description:
Basically the problem occours when two threads simultaneously construct 
instances of threaded service.

You can reconstruct the bug, by creating 10-20 threads in a for loop, and let 
each of this threads call the threaded service. A stack trace similar to this 
should appear:

org.apache.hivemind.ApplicationRuntimeException: Unable to construct service 
Service.ThreadedService1: org.apache.hivemind.ApplicationRuntimeException
        at 
org.apache.hivemind.impl.servicemodel.ThreadedServiceModel.constructServiceForCurrentThread(ThreadedServiceModel.java:162)
        at 
org.apache.hivemind.impl.servicemodel.ThreadedServiceModel.getServiceImplementationForCurrentThread(ThreadedServiceModel.java:139)
        at 
$ThreadedProxy_fe54269949_6._service($ThreadedProxy_fe54269949_6.java)
        at $ThreadedProxy_fe54269949_6.foo($ThreadedProxy_fe54269949_6.java)
        at testing.bugs.TestCase1$1.run(TestCase1.java:50)


As this is time-critical problem it does not always happen. My observation is 
that the longer the construction of the service takes (e.g. a lot of (at least 
3-4) service properties) the more likely the problem occours. It also "helps" 
to have logging at debug level.

If neccessary I've got source code to reproduce the problem (but with SDL 
module descriptors). The same problem occours with pooled service module, too.

To fix this I guess constructServiceForCurrentThread() should be synchronized. 
From looking at the source code of getServiceImplementationForCurrentThread it 
seems like it has to be synchronized, too.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to