Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues

Bug 1010

Summary: Multiple calls on same proxy are not thread safe
Product: JacORB Reporter: Alon <alon_hessing>
Component: ORBAssignee: Mailinglist to track bugs <jacorb-bugs>
Status: RESOLVED FIXED    
Severity: critical CC: jacorb
Priority: P5    
Version: 3.5   
Hardware: PC   
OS: Windows NT   
Attachments: example

Description Alon 2015-05-28 02:42:58 UTC
In Delegate class getReplyGroup method is not thread safe:
    private ReplyGroup getReplyGroup (ClientConnection connectionToUse)
This part of code can cause that if 2 threads are works in parallel one can works with ReplyGroup that didn't pass the postInit method:
            ReplyGroup g = new ReplyGroup (this, profile);
            group = groups.putIfAbsent (profile, g);
            if (group == null)
            {
                group = g;
                group.postInit();
            }

Why the postInit method is not part of the constructor? This would have solve the problem?

See below stack trace of the exception I got because of this problem:
(got NullPointerException)

at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:475)
                at org.jacorb.orb.Delegate.invoke(Delegate.java:1232)
                at org.jacorb.orb.Delegate.invoke_internal(Delegate.java:1244)
                at org.jacorb.orb.Delegate._invoke_internal(Delegate.java:1415)
                at org.jacorb.orb.ReplyGroup.addHolder(ReplyGroup.java:92)

Thanks.
Comment 1 Nick Cross 2015-05-28 03:28:08 UTC
Can you reproduce this easily? Can you provide a test case?
Comment 2 Alon 2015-06-07 08:07:04 UTC
Created attachment 463 [details]
example
Comment 3 Alon 2015-06-07 08:07:59 UTC
Comment on attachment 463 [details]
example

Simple example - just run it to reproduce the problem
Comment 4 Nick Cross 2015-06-08 05:13:06 UTC
Verified ; thanks for the test case!
Comment 5 Alon 2015-07-05 11:17:38 UTC
Hi,
We are currently looks for a work around until the bug will be fixed.
We thought about adding some dummy method to each service and call it after the stub creation.
Do you think this will overcome the problem?
Thanks
Comment 6 Nick Cross 2015-07-06 09:17:44 UTC
Apologies for the delay in merging your fix. Fix is now committed to head with SHA

f2585e489eb26e32d6e8b68409cd27895a433edc
Comment 7 Alon 2015-07-07 02:18:48 UTC
Thanks for the fast respone.
Do you know when I can expect for a new version that contains the fix?
I would like to understand if it worth for me to write code that overcome the problem or wait for the next release.
Thanks again.
Comment 8 Nick Cross 2015-07-08 04:47:25 UTC
Currently we don't have immediate plans for a micro release. If several fixes are submitted then the plans may change.

You could take the source from https://github.com/JacORB/JacORB/ and compile it yourself if you wish.