[Soot-list] Race condition in Heros

Marc-Andre Laverdiere-Papineau marc-andre.laverdiere-papineau at polymtl.ca
Fri Jan 25 07:40:26 EST 2013


Hi Eric,

It shows that I wrote in a hurry. Having a baby in the house is fun :)

It is a deadlock, actually. Most times, the analysis is over in a few 
minutes. In other times, it doesn't complete in >15 minutes, and my CPU 
usage is down. I infer from this that the analysis completed, but there 
was a race condition between the notify and the wait that make it so 
that wait never returns.

Having worked with ExecutorService, the trick that I used was to load 
the executor up front with all the work units that needed to be treated, 
then call shutdown(), which will allow the backlog to be processed, then 
loop around awaitTermination().

Obviously, that works only when you know for sure that you won't have 
more work units. I think the solver code I see there assumes that an 
empty worklist will stay empty, so that trick will work.

IIRC, I needed to change the default queue, because the standard Java 
API was giving one with a bound in the number of jobs it would accept.

You would have to use the constructor of the ThreadPoolExecutor instead 
of the convenience methods in Executors.

P.S. I get this feeling that I've almost written the code here ;) I may 
have a bit of time later to work on a patch.

Marc-André Laverdière-Papineau
Doctorant - PhD Candidate

On 13-01-25 03:02 AM, Eric Bodden wrote:
> Hi Marc-Andre.
>
> We did have a problem with races in the past but not recently. Having
> said that, it's quite possible there are some left.
>
>> I'm attaching a screenshot. It looks like there is a timing issue between
>> the notify and wait calls.
>
> Well, the screenshot is not telling me much except that the main
> thread is waiting for its result, which seems fine.
>
> What problem do you observe? Do you get different results on different runs?
>
>> I suggest using proper Java 5+ concurrency APIs instead of a homebrew one -
>> says the guy who tripped his feet a lot on that :)
>
> The problem is that, to the best of my knowledge, the API does not
> quite fit the problem at hand. But if you have good suggestions on how
> else to coordinate the threads, please be my guest.
>
>> I can spend a bit of time on it tomorrow if nobody sees an obvious fix until
>> then :)
>
> I just wished there was a truly usable race detection tool.
>
> Eric
>


More information about the Soot-list mailing list