Terminating concurrence via over_if not working?

21 views
Skip to first unread message

Alex

unread,
Feb 15, 2012, 5:37:57 PM2/15/12
to openwfe...@googlegroups.com
Hi there,

I am writing a workflow with concurrence participants (or branches). I want the concurrence to terminate once one branch returns with a field of a specific value (say 'true'). So here is my conceived workflow def:

Ruote.process_definition :name=>"Test", :revision=>"1" do
  sequence do
    set :field=>"my_field", :value=>"false"
    concurrence :over_if=>"${f:my_field}" do
      alpha
      beta
      gamma
    end
    echo "=== my_field: ${f:my_field}"
    zeta
  end
end

When one participant (say beta) is returned with field 'my_field' being set to true (as echo showed), I checked the remaining participants in storage, and still see alpha and gamma remained uncanceled. I can see that the call back 'on_cancel' on storage participant gets called (but an error of 'method_missing' was thrown, see output below). I don't think it's due to this error because if I use :count=>1 to terminate  the concurrence, the same error gets thrown but other participants did get canceled. 

We are running ruote 2.2.1 (for some reason we cannot move to 2.3.x yet). Has anyone encountered the similar issue? Is it a bug in earlier version(s) of ruote? I'd appreciate it if any of you can shed me some light on what is going on.

As I said, initially I thought the error had something to do with the storage (HashStorage) I used in test, and this is the stack trace when canceling participants process gets called:

  ArgumentError
  negative array size (or size too big)
  .rvm/gems/ruby-1.8.7-p352/gems/rspec-core-2.2.0/lib/rspec/core/extensions/kernel.rb:22:in `(null)'
  .rvm/gems/ruby-1.8.7-p352/gems/rspec-core-2.2.0/lib/rspec/core/extensions/kernel.rb:22:in `method_missing'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/storage/hash_storage.rb:102:in `delete'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/part/storage_participant.rb:109:in `on_cancel'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:203:in `send'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:203:in `participant_send'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:194:in `each'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:194:in `participant_send'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:134:in `dispatch_cancel'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:46:in `handle'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:292:in `process'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:198:in `step'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:93:in `run'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `run_in_thread'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `initialize'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `new'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `run_in_thread'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/dashboard.rb:87:in `initialize'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/dashboard.rb:87:in `each'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/dashboard.rb:87:in `initialize'

I changed storage by using MongoDbStorage, I still saw similar error when a participant was returned:

  ArgumentError
  negative array size (or size too big)
  .rvm/gems/ruby-1.8.7-p352/gems/rspec-core-2.2.0/lib/rspec/core/extensions/kernel.rb:22:in `(null)'
  .rvm/gems/ruby-1.8.7-p352/gems/rspec-core-2.2.0/lib/rspec/core/extensions/kernel.rb:22:in `method_missing'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-mongodb-f583d47f0e96/lib/ruote-mongodb/mongodb_storage.rb:99:in `delete'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/part/storage_participant.rb:109:in `on_cancel'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:203:in `send'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:203:in `participant_send'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:194:in `each'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:194:in `participant_send'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:134:in `dispatch_cancel'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/svc/dispatch_pool.rb:46:in `handle'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:292:in `process'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:198:in `step'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:93:in `run'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `run_in_thread'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `initialize'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `new'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/worker.rb:104:in `run_in_thread'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/dashboard.rb:87:in `initialize'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/dashboard.rb:87:in `each'
  .rvm/gems/ruby-1.8.7-p352/bundler/gems/ruote-b66b34f1315c/lib/ruote/dashboard.rb:87:in `initialize'

John Mettraux

unread,
Feb 15, 2012, 5:56:54 PM2/15/12
to openwfe...@googlegroups.com

On Wed, Feb 15, 2012 at 02:37:57PM -0800, Alex wrote:
>
> We are running ruote 2.2.1 (for some reason we cannot move to 2.3.x yet).

Hello Alex,

welcome to ruote's mailing list.

Quick question: what commit SHA for the ruote 2.2.1 you are using? (2.2.0 is
the latest gem out).


Thanks in advance,

--
John Mettraux - http://lambda.io/processi

Alex

unread,
Feb 15, 2012, 6:20:08 PM2/15/12
to openwfe...@googlegroups.com
Hi John,

Thanks for quick reply. We used to take the edge of your ruote repo in our app, but encountered some problem when the master branch got updated to 2.3. We had to stay on 2.2.1 before we sort something out to move forward, so I forked ruote with this latest commit SHA: b66b34f1315c4bc99acec8d5db07e62160a4b896.

Thanks,
Alex


Alex

unread,
Feb 15, 2012, 6:21:30 PM2/15/12
to openwfe...@googlegroups.com
My forked version is at  https://github.com/alexw668/ruote/.

John Mettraux

unread,
Feb 15, 2012, 6:23:00 PM2/15/12
to openwfe...@googlegroups.com

Ah yes, sorry, it was already visible in your backtrace.

I will try to write a script that reproduces your issue.

Stay tuned,

Alex

unread,
Feb 15, 2012, 6:38:36 PM2/15/12
to openwfe...@googlegroups.com
Thanks!

John Mettraux

unread,
Feb 16, 2012, 1:06:06 AM2/16/12
to openwfe...@googlegroups.com
Hello Alex,

the bug you found affected 2.2.0 and 2.3.0 as well.

Here is the fix:

https://github.com/jmettraux/ruote/commit/aaa18ff2b9445ab57068979cfedb5f9234ea0b76

For your fork, you simply have to replace this line:

https://github.com/alexw668/ruote/blob/master/lib/ruote/exp/fe_concurrence.rb#L312

with:

if h.children.empty?

I guess I don't have to fix the second part of the issue (the backtrace)
since you won't need to call cancel out of the blue now.

It shouldn't be a problem using 2.3.0, it's only a change of version
number. If I can help you stay up to date, I'd be glad to help.


Many thanks for identifying this serious issue!

Cheers,

Alex

unread,
Feb 16, 2012, 12:18:43 PM2/16/12
to openwfe...@googlegroups.com
Wow, thanks John for your quick work! It fixes the problem! 

For now I will apply the change in our fork and will move on to 2.3 once we resolve other issues that prevented us from moving forward.

Thanks again,
Alex
Reply all
Reply to author
Forward
0 new messages