#47 ✓resolved
jsgoecke

No events when using JRuby

Reported by jsgoecke | December 23rd, 2008 @ 05:12 AM

I have added this code to events.rb:

http://gist.github.com/39298

When I run with the MRI (aka -ahn), I get events just fine. If I switch to JRuby (aka - jahn) I do not get any events nor is an error raised.

Comments and changes to this ticket

  • Jay Phillips

    Jay Phillips December 23rd, 2008 @ 09:16 PM

    • State changed from “new” to “open”
  • jsgoecke

    jsgoecke January 13th, 2009 @ 12:27 PM

    I tested this again with the newly released JRuby 1.1.6, unfortunately the issue persists. I ran a test with MRI, did a reload on the Asterisk CLI and get events. I used JRuby in the same scenario and no events, the log is here:

    http://gist.github.com/46528

  • jsgoecke

    jsgoecke February 4th, 2009 @ 10:20 PM

    Added a bit of debug code and have managed to at least capture at some point where this issue is happening. I added a begin/rescue clause to the manager_interface.rb here:

          def event_message_received(event)
            return if event.kind_of?(ManagerInterfaceResponse) && event["Message"] == "Authentication accepted"
            # TODO: convert the event name to a certain namespace.
            begin
              Events.trigger %w[asterisk manager_interface], event
            rescue => err
              ahn_log.event_error err
              abort
            end
          end
    
    

    And, when an event is generated, I get this error in JRuby:

    INFO event_error: Caught ArgumentError: wrong # of arguments(1 for 2)

    /opt/adhearsion/lib/theatre/invocation.rb:35:in `initialize'
    /opt/adhearsion/lib/theatre.rb:44:in `trigger'
    /opt/adhearsion/lib/theatre.rb:40:in `map'
    /opt/adhearsion/lib/theatre.rb:40:in `trigger'
    /opt/adhearsion/lib/adhearsion/events_support.rb:43:in `trigger'
    /opt/adhearsion/lib/adhearsion/voip/asterisk/manager_interface.rb:203:in `event_message_received'
    /opt/adhearsion/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb:1739:in `message_received'
    
    

    I run a test with the rescue clause in there on MRI and the error is not raised.

  • jsgoecke

    jsgoecke February 4th, 2009 @ 10:52 PM

    Okay, it appears to be somewhere within Theatre and specifically with the standard Monitor library. I added this begin/rescue clause to the theatre/invocation.rb:

      begin
        ahn_log.monitor_issue @returned_value_lock.inspect
        @returned_value_blocker = Monitor::ConditionVariable.new @returned_value_lock
      rescue => err
        ahn_log.monitor_issue err
        abort
      end
    
    

    And, if I inspect the returning lock with MRI (when it works) I get this:

    INFO monitor_issue: #<Monitor:0x18df6e8 @mon_entering_queue=[], @mon_count=0, @mon_owner=nil, @mon_waiting_queue=[]>

    When I do the same with JRuby I get this:

    INFO monitor_issue: #<Monitor:0x521927 @mon_waiting_cond=#<ConditionVariable:0xf15e7a>, @mon_total_waiting=0, @mon_entering_cond=#<ConditionVariable:0x71d99e>, @mon_count=0, @mon_mutex=#<Mutex:0x862be4>, @mon_owner=nil>

    Obviously different, but not sure what the offending difference is yet.

  • Jay Phillips

    Jay Phillips February 10th, 2009 @ 04:30 PM

    • State changed from “open” to “resolved”

    Fixed. I just changed

    
    @returned_value_blocker = Monitor::ConditionVariable.new @returned_value_lock
    

    to

    
    @returned_value_blocker = @returned_value_lock.new_cond
    

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Pages