<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-2"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <br>
      Thanks!<br>
    <br>
      The idea of using EventConsumer per connection seemed pretty
    natural for me - thus my surprise at your warning as I'd expect that
    it's a standard way to use events. Well, it shows I'm a newbie to FS
    ;)<br>
    <br>
      Regards,<br>
      Karol<br>
    <br>
    <br>
    On 11/28/2011 09:26 PM, Anthony Minessale wrote:
    <blockquote
cite="mid:CAKbxfG_i0kuS0avW63JEAEEkK3pohen_CYdr5rafSiaK+LDXWA@mail.gmail.com"
      type="cite">you can do whatever you wish.  I was just warning you
      that nobody has really pushed event binding and unbinding in such
      a way before which may explain how you uncovered that issue.
       Usually things that bind stay resident for a long time.  
      <div>
        <br>
        <br>
        <div class="gmail_quote">2011/11/28 Karol Golab <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:karol@tls.pl">karol@tls.pl</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <div bgcolor="#ffffff" text="#000000"> <br>
                Well, I have a Perl script run as part of a dialplan and
              the script creates an EventConsumer. Thus I have one bind
              / unbind pair for each connection. Is this somehow wrong /
              against what the EventConsumer API was planned for?<br>
                How could I have a single bind/unbind in this case?<br>
              <br>
                As for choosing event socket and C application vs a
              script - what is the main difference / reason to switch:
              performance of some other issues? My CPU seems to have
              some cycles to spare.<br>
              <br>
                Regards,<br>
              <font color="#888888">   Karol</font>
              <div>
                <div class="h5"><br>
                  <br>
                  <br>
                  On 11/28/2011 05:36 PM, Anthony Minessale wrote:
                  <blockquote type="cite">you're probably right but I
                    wonder what you are doing that is binding and
                    unbinding so much?
                    <div>The bind and unbind was designed to be called
                      once when the module is loaded and called again
                      when it exits.</div>
                    <div><br>
                    </div>
                    <div>My fear is you are using the embedded scripting
                      event handers in some quick repeating fashion.</div>
                    <div><br>
                    </div>
                    <div>I did a commit to flip that case around but I
                      don't encourage you to use embedded scripts for
                      heavy event traffic, that's what event socket is
                      for and if you have the C skills to debug this,
                      you might want to try a C app ;)</div>
                    <div><br>
                      <br>
                      <div class="gmail_quote">2011/11/28 Brian West <span
                          dir="ltr">&lt;<a moz-do-not-send="true"
                            href="mailto:brian@freeswitch.org"
                            target="_blank">brian@freeswitch.org</a>&gt;</span><br>
                        <blockquote class="gmail_quote" style="margin:
                          0pt 0pt 0pt 0.8ex; border-left: 1px solid
                          rgb(204, 204, 204); padding-left: 1ex;">
                          <div style="word-wrap: break-word;">Please
                            post it to <a moz-do-not-send="true"
                              href="http://jira.freeswitch.org"
                              target="_blank">jira.freeswitch.org</a>
                            <div><br>
                            </div>
                            <font color="#888888">
                              <div>/b</div>
                            </font>
                            <div>
                              <div><br>
                                <div>
                                  <div>On Nov 28, 2011, at 2:31 AM,
                                    Karol Golab wrote:</div>
                                  <br>
                                  <blockquote type="cite"><span
                                      style="border-collapse: separate;
                                      font-family: Helvetica;
                                      font-style: normal; font-variant:
                                      normal; font-weight: normal;
                                      letter-spacing: normal;
                                      line-height: normal; text-indent:
                                      0px; text-transform: none;
                                      white-space: normal; word-spacing:
                                      0px; font-size: medium;"><br>
                                        Hi!<br>
                                      <br>
                                        I've noticed some strange code
                                      in src/switch_event.c - could
                                      someone<span> </span><br>
                                      smarter (&amp; knowing the
                                      mentioned code) please take a
                                      look?<br>
                                      <br>
                                        The problem is in the order of
                                      calls to locks BLOCK &amp; RWLOCK
                                      - it<span> </span><br>
                                      differs between functions:<br>
                                      <br>
                                      switch_event_bind_removable<br>
                                              switch_mutex_lock(BLOCK);<br>
        switch_thread_rwlock_wrlock(RWLOCK);<br>
                                      <br>
                                      switch_event_unbind_callback<br>
    switch_thread_rwlock_wrlock(RWLOCK);<br>
                                          switch_mutex_lock(BLOCK);<br>
                                      <br>
                                      switch_event_unbind<br>
    switch_thread_rwlock_wrlock(RWLOCK);<br>
                                          switch_mutex_lock(BLOCK);<br>
                                      <br>
                                        As I understand this may lead to
                                      an outright deadlock between bind<span> </span><br>
                                      and unbind.<br>
                                      <br>
                                        I stumbled upon this code while
                                      debugging what seems like
                                      deadlocks<span> </span><br>
                                      in our test FS installation put
                                      under some heavy load. The load is
                                      about<span> </span><br>
                                      25 new event subscribers per
                                      second (destroyed few seconds
                                      later) and<span> </span><br>
                                      about 700 events per second.<br>
                                      <br>
                                        Regards,<br>
                                        Karol<br>
                                    </span></blockquote>
                                </div>
                                <br>
                              </div>
                            </div>
                          </div>
                          <br>
_________________________________________________________________________<br>
                          Professional FreeSWITCH Consulting Services:<br>
                          <a moz-do-not-send="true"
                            href="mailto:consulting@freeswitch.org"
                            target="_blank">consulting@freeswitch.org</a><br>
                          <a moz-do-not-send="true"
                            href="http://www.freeswitchsolutions.com"
                            target="_blank">http://www.freeswitchsolutions.com</a><br>
                          <br>
                          FreeSWITCH-powered IP PBX: The CudaTel
                          Communication Server<br>
                          <a moz-do-not-send="true"
                            href="http://www.cudatel.com"
                            target="_blank">http://www.cudatel.com</a><br>
                          <br>
                          Official FreeSWITCH Sites<br>
                          <a moz-do-not-send="true"
                            href="http://www.freeswitch.org"
                            target="_blank">http://www.freeswitch.org</a><br>
                          <a moz-do-not-send="true"
                            href="http://wiki.freeswitch.org"
                            target="_blank">http://wiki.freeswitch.org</a><br>
                          <a moz-do-not-send="true"
                            href="http://www.cluecon.com"
                            target="_blank">http://www.cluecon.com</a><br>
                          <br>
                          FreeSWITCH-dev mailing list<br>
                          <a moz-do-not-send="true"
                            href="mailto:FreeSWITCH-dev@lists.freeswitch.org"
                            target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a><br>
                          <a moz-do-not-send="true"
                            href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev"
                            target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
                          UNSUBSCRIBE:<a moz-do-not-send="true"
                            href="http://lists.freeswitch.org/mailman/options/freeswitch-dev"
                            target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
                          <a moz-do-not-send="true"
                            href="http://www.freeswitch.org"
                            target="_blank">http://www.freeswitch.org</a><br>
                          <br>
                        </blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <div><br>
                      </div>
                      -- <br>
                      Anthony Minessale II<br>
                      <br>
                      FreeSWITCH <a moz-do-not-send="true"
                        href="http://www.freeswitch.org/"
                        target="_blank">http://www.freeswitch.org/</a><br>
                      ClueCon <a moz-do-not-send="true"
                        href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
                      Twitter: <a moz-do-not-send="true"
                        href="http://twitter.com/FreeSWITCH_wire"
                        target="_blank">http://twitter.com/FreeSWITCH_wire</a><br>
                      <br>
                      AIM: anthm<br>
                      <a moz-do-not-send="true"
                        href="mailto:MSN%3Aanthony_minessale@hotmail.com"
                        target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
                      GTALK/JABBER/<a moz-do-not-send="true"
                        href="mailto:PAYPAL%3Aanthony.minessale@gmail.com"
                        target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
                      IRC: <a moz-do-not-send="true"
                        href="http://irc.freenode.net" target="_blank">irc.freenode.net</a>
                      #freeswitch<br>
                      <br>
                      FreeSWITCH Developer Conference<br>
                      <a moz-do-not-send="true"
                        href="mailto:sip%3A888@conference.freeswitch.org"
                        target="_blank">sip:888@conference.freeswitch.org</a><br>
                      <a moz-do-not-send="true"
                        href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org"
                        target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
                      pstn:<a moz-do-not-send="true"
                        href="tel:%2B19193869900" value="+19193869900"
                        target="_blank">+19193869900</a><br>
                    </div>
                    <pre><fieldset></fieldset>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a moz-do-not-send="true" href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a moz-do-not-send="true" href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a moz-do-not-send="true" href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-dev mailing list
<a moz-do-not-send="true" href="mailto:FreeSWITCH-dev@lists.freeswitch.org" target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a>
<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a>
UNSUBSCRIBE:<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a>
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
                  </blockquote>
                  <br>
                  <br>
                </div>
              </div>
              <div class="im">
                <pre cols="72">  Karol

-- 
   e-mail: <a moz-do-not-send="true" href="mailto:Karol.Golab@tls.pl" target="_blank">Karol.Golab@tls.pl</a>
      www: <a moz-do-not-send="true" href="http://www.tls.pl" target="_blank">http://www.tls.pl</a>
signature: not found

  company: TLS-Technologie Spółka z ograniczoną odpowiedzialnością z siedzibą w Warszawie przy ul. Polnej 50 00-644; KRS 0000073337 (XII Wydział Gospodarczy KRS); NIP 526-25-78-091; VAT ID PL5262578091; REGON 017349442; kap. zak. 50000,00 zł

</pre>
              </div>
            </div>
            <br>
_________________________________________________________________________<br>
            Professional FreeSWITCH Consulting Services:<br>
            <a moz-do-not-send="true"
              href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
            <a moz-do-not-send="true"
              href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
            <br>
            FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
            <a moz-do-not-send="true" href="http://www.cudatel.com"
              target="_blank">http://www.cudatel.com</a><br>
            <br>
            Official FreeSWITCH Sites<br>
            <a moz-do-not-send="true" href="http://www.freeswitch.org"
              target="_blank">http://www.freeswitch.org</a><br>
            <a moz-do-not-send="true" href="http://wiki.freeswitch.org"
              target="_blank">http://wiki.freeswitch.org</a><br>
            <a moz-do-not-send="true" href="http://www.cluecon.com"
              target="_blank">http://www.cluecon.com</a><br>
            <br>
            FreeSWITCH-dev mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev"
              target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
            UNSUBSCRIBE:<a moz-do-not-send="true"
              href="http://lists.freeswitch.org/mailman/options/freeswitch-dev"
              target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
            <a moz-do-not-send="true" href="http://www.freeswitch.org"
              target="_blank">http://www.freeswitch.org</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        Anthony Minessale II<br>
        <br>
        FreeSWITCH <a moz-do-not-send="true"
          href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>
        ClueCon <a moz-do-not-send="true"
          href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
        Twitter: <a moz-do-not-send="true"
          href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br>
        <br>
        AIM: anthm<br>
        <a moz-do-not-send="true"
          href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>
        GTALK/JABBER/<a moz-do-not-send="true"
          href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
        IRC: <a moz-do-not-send="true" href="http://irc.freenode.net">irc.freenode.net</a>
        #freeswitch<br>
        <br>
        FreeSWITCH Developer Conference<br>
        <a moz-do-not-send="true"
          href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br>
        <a moz-do-not-send="true"
          href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
        pstn:+19193869900<br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a class="moz-txt-link-freetext" href="http://www.cudatel.com">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>

FreeSWITCH-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-dev">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">  Karol

-- 
   e-mail: <a class="moz-txt-link-abbreviated" href="mailto:Karol.Golab@tls.pl">Karol.Golab@tls.pl</a>
      www: <a class="moz-txt-link-freetext" href="http://www.tls.pl">http://www.tls.pl</a>
signature: not found

  company: TLS-Technologie Spółka z ograniczoną odpowiedzialnością z siedzibą w Warszawie przy ul. Polnej 50 00-644; KRS 0000073337 (XII Wydział Gospodarczy KRS); NIP 526-25-78-091; VAT ID PL5262578091; REGON 017349442; kap. zak. 50000,00 zł

</pre>
  </body>
</html>