[concurrency-interest] ForkJoin executing a task more than once?

Ron Pressler ron.pressler at gmail.com
Sat Apr 30 10:56:36 EDT 2011

Sorry, my bad.
I'd missed a caught exception that resulted in a re-forking of the same task

On Fri, Apr 29, 2011 at 9:11 PM, Ron Pressler <ron.pressler at gmail.com>wrote:

> Oops, a typo. I meant to say that in the older version I'd get one
> execution by the "executeSubmission" method or something of the sort and
> another by the "executeStolen" method, or something of the sort etc.
> It appears that sometimes a task can be executed twice, once directly from
> the submission queue and once when it's stolen. Is this a race condition in
> ForkJoinPool, or am I doing something wrong?
> I also forgot to mention that I'm using the pool in the asynchronous mode,
> since I never need to join any task.
> On Fri, Apr 29, 2011 at 9:05 PM, Ron Pressler <ron.pressler at gmail.com>wrote:
>> Hi.
>> I have a ForkJoinTask that forks into subtasks, but I don't need to join
>> any of the tasks (they have side-effects), only to wait upon the completion
>> of the ancestor and all its offspring. To do that, I use a phaser. Before
>> forking a sub-task, I register the phaser (for the newly forked task), and
>> upon each task's completion, I arrive and deregister.
>> However, I sometimes have a situation of too many phaser arrivals.
>> With a previous version of jsr166y I used to get an IllegalStateException
>> saying that I'm deregistering an unregistered party, and with the current
>> version I simple arrive on a terminated phaser.
>> Looking into the problem, I've discovered that a task may be executed more
>> than once by the pool. In the previous version, I'd get one execution by the
>> "executeSubmission" method or something of the sort (I don't remember its
>> exact name), and in the current version I get two executions, each from a
>> different call-site to "executeTask" at the ForkJoinThreadPool.scan method.
>> What is going on?
>> Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110430/f7478375/attachment.html>

More information about the Concurrency-interest mailing list