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 href="mailto:karol@tls.pl">karol@tls.pl</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  
    
  
  <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></div><div class="h5"><br>
    <br>
    <br>
    On 11/28/2011 05:36 PM, Anthony Minessale wrote:
    <blockquote type="cite">you&#39;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&#39;t encourage
        you to use embedded scripts for heavy event traffic, that&#39;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 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 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&#39;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 href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
            <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
            <br>
            FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
            <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
            <br>
            Official FreeSWITCH Sites<br>
            <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
            <a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
            <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
            <br>
            FreeSWITCH-dev mailing list<br>
            <a href="mailto:FreeSWITCH-dev@lists.freeswitch.org" target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a><br>
            <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
            UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
            <a 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 href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
        ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
        Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br>
        <br>
        AIM: anthm<br>
        <a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
        GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
        IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a>
        #freeswitch<br>
        <br>
        FreeSWITCH Developer Conference<br>
        <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
        <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
        pstn:<a href="tel:%2B19193869900" value="+19193869900" target="_blank">+19193869900</a><br>
      </div>
      <pre><fieldset></fieldset>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

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

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-dev mailing list
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org" target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a>
<a 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 href="mailto:Karol.Golab@tls.pl" target="_blank">Karol.Golab@tls.pl</a>
      www: <a 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 href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a 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 href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>
</div>