[OPENENGSB-1735] testHandleCallsParallel fails sometimes Created: 18/Jun/11  Updated: 28/May/14  Resolved: 24/Apr/12

Status: Closed
Project: OpenEngSB
Component/s: framework
Affects Version/s: None
Fix Version/s: openengsb-3.0.0.M1

Type: Bug Priority: Major
Reporter: Christoph Gritschenberger Assignee: Christoph Gritschenberger
Resolution: Fixed Votes: 0
Labels: archived


 Description   

I did a little investigation and I think I found out why:
The problem seems to be in the private method
DefaultOsgiUtilsService.waitForServiceFromTracker(ServiceTracker, long)

It does the following to the tracker:
tracker.open()
tracker.waitforService()
tracker.close()

Now two threads do this concurrently this might fail:
T1: tracker.open()
T2: tracker.open()
T1: tracker.waitforService()
T1: tracker.cose()
T2: tracker.waitforService() -> returns null

The question is, what do we do about it.
I think this is an actual problem (not just in this test).

I think making the function synchronized is a bad solution.
I thought we could just skip closing the tracker (tried it, and did not encounter the bug since).



 Comments   
Comment by Christoph Gritschenberger [ 18/Jun/11 ]

Should trackers in service-proxies always stay open?
should we provide a way to cleanup the proxies?

Comment by Andreas Pieber [ 20/Jun/11 ]

the interesting question is what happens if a tracker is not closed/cleanedup. I'm somehow afraid that this adds a big overhead if the openengsb runs for some time. So I'm not sure if I really like that they are openned all the time. I think it would be preferable to have an option to cleanup them. Maybe manually or find all unused by a reaper thread? Something similar the file-utils have for files?

Comment by Christoph Gritschenberger [ 20/Jun/11 ]

There are cases we actually want them to stay opened, like the global-references in the workflow-engine.
However I think we have some throw-away proxies in there too.

Comment by Andreas Pieber [ 20/Jun/11 ]

well, this wont work against the approach of registering some trackers for automatic close-down. Maybe we could make this a little bit more intelligent?

Comment by Christoph Gritschenberger [ 20/Jun/11 ]

We clean up the proxies obtained with the existing methods, and add some methods to retrieve permanent proxies.

Comment by Andreas Pieber [ 20/Jun/11 ]

yeah, this sounds definitely easier +1

Comment by Andreas Pieber [ 20/Jun/11 ]

can you scatch an idea in code?

Comment by Christoph Gritschenberger [ 24/Apr/12 ]

OK, this didn't happen for a while now.
It seems some implementation has changed that the test now always runs green.

It does happen when two threads operate on the same proxy, so I created a new (simpler) one.
I added a little sync, so that it works now.

Generated at Fri Nov 24 10:15:56 CET 2017 using JIRA 6.3.13#6344-sha1:62d2b41c1ddfd5b5a56568898407231b0d9c17cb.