adhearsion / adhearsion-asterisk

Asterisk specific features for Adhearsion
http://adhearsion.com
MIT License
17 stars 15 forks source link

Adhearsion::Asterisk.execute_ami_action is asynchronous in adhearsion >= 2.4 #16

Open sjamaan opened 8 years ago

sjamaan commented 8 years ago

While upgrading an Adhearsion application from 2.3 to 2.4 I noticed that my code which interrogates the status of Asterisk queues would ntermittently return everything, nothing, or only some of the entries.

After a bit of debugging, I found that if I run the following in the ahn console:

Adhearsion::Asterisk.execute_ami_action('QueueStatus') do |x|
   puts x.inspect
end; puts "DONE!"

This will print DONE! intermixed with the events in Adhearsion 2.4, while it will print DONE! after all the events in 2.3. I think the new behaviour is a bug, because the documentation for adhearsion-asterisk indicates that execute_ami_action() is (intended to be) synchronous.

I've tried to debug this but the Punchblock code is extremely abstract, and difficult to follow. Any help would be appreciated!

benlangfeld commented 8 years ago

Please provide a log at trace level and Gemfile.lock for both working and broken cases.

sjamaan commented 8 years ago

Here we go:

Gemfile.lock-2.3-ok.txt adhearsion.log-2.3-ok.txt Gemfile.lock-2.4-bad.txt adhearsion.log-2.4-bad.txt

sjamaan commented 8 years ago

Just in case, here are the source Gemfiles: Gemfile-2.3-ok.txt Gemfile-2.4-bad.txt

benlangfeld commented 8 years ago

@sjamaan It would be useful if you would step through available Punchblock versions to determine which release caused this.

sjamaan commented 8 years ago

I'll get back to you on that, might take a few days

sjamaan commented 8 years ago

OK, had time to look into it today already.

The bug occurs somewhere between Punchblock 2.1.1 (which works) and Punchblock 2.2.0 (which doesn't). From the changelog, "Bugfix: Remove per-call/component actors from Asterisk translator for performance/stability super-charge" sounds like a likely culprit. I'm unsure how to actually debug it at this level, though.