ConversationIds are not always unique
-------------------------------------

                 Key: TUSCANY-2077
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2077
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Core Runtime
    Affects Versions: Java-SCA-1.2
         Environment: Windows XP SP2, Intel Core 2 CPU, 2.6, 2GB Ram, jdk 
1.5.0_10 
            Reporter: Daniel Stucky


The attached test works fine if I do NOT mark method run() in Aplha with 
@OneWay. 

The goal is to call Alpha.run() multiple times "concurrently" by using @OneWay.
If I DO mark it with @OneWay sometimes the following error occurs
Here is the command line output with line numbers:

 1: Starting ...
 2: test.composite ready !!!
 3: GammaImpl:GammaImpl(), conversationId=null
 4: Gamma:start(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
 5: GammaImpl:GammaImpl(), conversationId=null
 6: Gamma:start(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
 7: Gamma:hasNext(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
 8: Gamma:next(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
 9: value=id_0, conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
10: Gamma:hasNext(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
11: Gamma:next(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
12: value=id_1, conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
13: Gamma:hasNext(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
14: Gamma:next(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
15: value=id_2, conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
16: Gamma:hasNext(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
17: Gamma:hasNext(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
18: Gamma:next(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
19: Gamma:next(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
20: value=id_0, conversationId=3c6df219-e61c-4327-94dc-1cd2b3a08f78
21: value=id_3, conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
22: Gamma:hasNext(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
23: Gamma:next(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
24: value=id_4, conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
25: Gamma:hasNext(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
26: Gamma:stop(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6
27: GammaImpl:GammaImpl(), conversationId=null
28: Gamma:hasNext(), conversationId=dcde1a3f-8eb0-4e33-84fd-80d7359432b2
29: java.lang.NullPointerException
        at services.GammaImpl.hasNext(GammaImpl.java:40)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:109)
        at 
org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108)
        at 
org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
        at 
org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108)
        at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:287)
        at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:155)
        at $Proxy14.hasNext(Unknown Source)
        at services.AlphaImpl.run(AlphaImpl.java:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:109)
        at 
org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108)
        at 
org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor$1.run(NonBlockingInterceptor.java:71)
        at org.apache.tuscany.sca.core.work.Jsr237Work.run(Jsr237Work.java:61)
        at 
org.apache.tuscany.sca.core.work.ThreadPoolWorkManager$DecoratingWork.run(ThreadPoolWorkManager.java:214)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
30: Gamma:stop(), conversationId=5297f3ca-8c6e-4b65-a5e6-5c4fee0457b6


This is a strange problem that is not always reproduceable but only from time 
to time. I guess it's a concurrency issue. At first I've seen this only while 
debugging, but I managed to get the exception using sleep().

In line 3-5 two instances of Gamma are created and on each the method start is 
called. Note that both use the same conversationID. This should not be the case!
In line 27 another instance of  Gamma is created. Why ? No method start() is 
called !
Then in line in method hasNext() the conversationId suddenly is 
dcde1a3f-8eb0-4e33-84fd-80d7359432b2. I guess it is the firts method executed 
on this new instance, thus creating a new conversationId. And as no start() was 
called, the internal list is not initialized but NULL.

Is there a conceptual problem with my code? 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to