<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Ronald,<br>
    <br>
    Perfect - thanks for the help - I just uploaded the fix on SVN.<br>
    <br>
    Best regards,<br>
    Bogdan<br>
    <br>
    On 01/19/2012 06:23 PM, Ronald Cepres wrote:
    <blockquote
cite="mid:CAGCQ4Jp=kp1sbCe3paFyoVBG0Zn10U7JsyqD+YFPA7cb0fiCoQ@mail.gmail.com"
      type="cite">Hi Bogdan,
      <div><br>
      </div>
      <div>OpenSIPS didn't crash anymore after I used your patch. Thanks
        for the help!&nbsp;</div>
      <div><br>
      </div>
      <div>Regards,</div>
      <div>Ronald<br>
        <br>
        <div class="gmail_quote">On Wed, Jan 18, 2012 at 11:35 PM,
          Ronald Cepres <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:rbcepres@gmail.com">rbcepres@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">Hi Bogdan,
            <div><br>
            </div>
            <div>Thanks for the quick patch. I'll try it out tomorrow
              and let you know the result at the end of the day.</div>
            <div><br>
            </div>
            <div>Regards,</div>
            <div>Ronald
              <div>
                <div class="h5"><br>
                  <br>
                  <div class="gmail_quote">On Tue, Jan 17, 2012 at 11:21
                    PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:bogdan@opensips.org"
                        target="_blank">bogdan@opensips.org</a>&gt;</span>
                    wrote:<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"> Hi Ronald,<br>
                        <br>
                        Thanks for the useful information - find
                        attached a patch that should fix the problem -
                        please apply it, recompile and let me know if
                        works ok - if yes, I will update on SVN.<br>
                        <br>
                        The crash seams to be triggered by a bogus SIP
                        message where the parsing of the first line
                        fails - and this message hits the pike route
                        crashing in some parsing functions.<br>
                        <br>
                        Regards,<br>
                        Bogdan
                        <div>
                          <div><br>
                            <br>
                            On 01/16/2012 06:08 AM, Ronald Cepres wrote:
                            <blockquote type="cite">Hi Bogdan,
                              <div><br>
                              </div>
                              <div>Thanks for your reply.</div>
                              <div><br>
                              </div>
                              <div>The crash happened often (every less
                                than hour) on live traffic, but I was
                                not able to reproduce the bug on my own.</div>
                              <div>Here's the last part of OpenSIPS logs
                                that I saved after the crash:</div>
                              <div><br>
                              </div>
                              <div>
                                <div>Jan 13 09:31:39 ASTPROD-03 kernel:
                                  [25303999.864022] opensips[12133]:
                                  segfault at 0 ip 080f639c sp bfffc620
                                  error 4 in opensips[8048000+139000]</div>
                                <div>Jan 13 09:31:39 ASTPROD-03
                                  /sbin/opensips[12133]:
                                  INFO:core:parse_first_line: method not
                                  followed by SP</div>
                                <div>Jan 13 09:31:39 ASTPROD-03
                                  /sbin/opensips[12133]:
                                  INFO:core:parse_first_line: bad
                                  message</div>
                                <div>Jan 13 09:31:39 ASTPROD-03
                                  /sbin/opensips[12133]:
                                  ERROR:core:parse_msg:
                                  message=&lt;-15#015#012REGISTER sip:<a
                                    moz-do-not-send="true"
                                    href="http://server.example.com"
                                    target="_blank">server.example.com</a>;transport=tcp

                                  SIP/2.0#015#012Via: SIP/2.0/TCP
                                  client.example.com:13851;rport;branch=z9hG4bKPj-HwYov6D5txKI6aVe5WxpubPXFTKtkHM#015#012Max-Forwards:

                                  70#015#012From: &lt;<a
                                    moz-do-not-send="true"
                                    href="mailto:sip%3Auser@server.example.com"
                                    target="_blank">sip:user@server.example.com</a>&gt;;tag=e3o0uokXbnsOsn0HWFiw2Pn5D2TuAcmB#015#012To:

                                  &lt;<a moz-do-not-send="true"
                                    href="mailto:sip%3Auser@server.example.com"
                                    target="_blank">sip:user@server.example.com</a>&gt;#015#012Call-ID:

                                  m2n.UnXe-HLK-XaiL0m6sWnOF1lQ71O.#015#012CSeq:
                                  26361 REGISTER#015#012User-Agent:
                                  12Connect Lite SIP
                                  v3.0#015#012Contact: <a
                                    moz-do-not-send="true">&lt;sip:user@client.example.com:13851;transport=tcp;ob&gt;</a>#015#012Expires:

                                  300#015#012Allow: PRACK, INVITE, ACK,
                                  BYE, CANCEL, UPDATE, SUBSCRIBE,
                                  NOTIFY, REFER, MESSAGE,
                                  OPTIONS#015#012Content-Length:
                                  &nbsp;0#015#012#015#012&gt;</div>
                                <div>Jan 13 09:31:39 ASTPROD-03
                                  /sbin/opensips[12133]:
                                  ERROR:core:receive_msg: parse_msg
                                  failed</div>
                                <div>Jan 13 09:31:40 ASTPROD-03
                                  /sbin/opensips[12145]:
                                  CRITICAL:core:receive_fd: EOF on 38</div>
                                <div>Jan 13 09:31:40 ASTPROD-03
                                  /sbin/opensips[12106]:
                                  INFO:core:handle_sigs: child process
                                  12133 exited by a signal 11</div>
                                <div>Jan 13 09:31:40 ASTPROD-03
                                  /sbin/opensips[12106]:
                                  INFO:core:handle_sigs: core was
                                  generated</div>
                                <div>Jan 13 09:31:40 ASTPROD-03
                                  /sbin/opensips[12106]:
                                  INFO:core:handle_sigs: terminating due
                                  to SIGCHLD</div>
                                <br>
                                <div class="gmail_quote"> On Sun, Jan
                                  15, 2012 at 8:45 PM, Bogdan-Andrei
                                  Iancu <span dir="ltr">&lt;<a
                                      moz-do-not-send="true"
                                      href="mailto:bogdan@opensips.org"
                                      target="_blank">bogdan@opensips.org</a>&gt;</span>
                                  wrote:<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"> Hi Ronald,<br>
                                      <br>
                                      The crash happens on a reply and
                                      not a request - see the frame 14,
                                      where "buf" (the buffer containing
                                      the <br>
                                      sip message) shows a reply like
                                      text.<br>
                                      <br>
                                      But the is_method() should not
                                      crash at all....before diving into
                                      debugging:<br>
                                      &nbsp;&nbsp;&nbsp; 1) can you reproduce this
                                      crash ?<br>
                                      &nbsp;&nbsp;&nbsp; 2) before the crash, do you
                                      see any errors in the logs<br>
                                      <br>
                                      Regards,<br>
                                      Bogdan
                                      <div>
                                        <div><br>
                                          <br>
                                          On 01/13/2012 01:16 PM, Ronald
                                          Cepres wrote: </div>
                                      </div>
                                      <blockquote type="cite">
                                        <div>
                                          <div>Hi all,
                                            <div><br>
                                            </div>
                                            <div>I'm using OpenSIPS
                                              1.7.1 and based from the
                                              attached back trace, it
                                              crashed when it is trying
                                              to parse the method of a
                                              REGISTER message received
                                              by the server, triggered
                                              by pike route.</div>
                                            <div> <br>
                                            </div>
                                            <div>Here is a snippet of my
                                              opensips.cfg:</div>
                                            <div>...</div>
                                            <div>
                                              <div>loadmodule "pike.so"</div>
                                              <div>modparam("pike",
                                                "sampling_time_unit",
                                                30)</div>
                                              <div>modparam("pike",
                                                "reqs_density_per_unit",
                                                75)</div>
                                              <div>modparam("pike",
                                                "check_route", "pike")</div>
                                            </div>
                                            <div>...</div>
                                            <div>
                                              <div>route[pike] {</div>
                                              <div>&nbsp; &nbsp; &nbsp; &nbsp; if (($si ==
                                                $Ri) || ($si ==
                                                "192.168.1.60") || ($si
                                                == " 192.168.1.61") ||
                                                ($si == "
                                                192.168.1.65")) {</div>
                                              <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                                &nbsp; drop;</div>
                                              <div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
                                              <div>&nbsp; &nbsp; &nbsp; &nbsp; if
                                                (!is_method("REGISTER"))
                                                {</div>
                                              <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop;</div>
                                              <div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
                                              <div>}</div>
                                            </div>
                                            <div> ...</div>
                                            <div><br>
                                            </div>
                                            <div>Basically, I just want
                                              to check REGISTER messages
                                              only on the pike route.
                                              Does anyone have a
                                              workaround on this?</div>
                                            <div><br>
                                            </div>
                                            <div>FWIW, should I also
                                              post this on the dev list?</div>
                                            <div> <br>
                                            </div>
                                            <div>Thanks!</div>
                                            <div><br>
                                            </div>
                                            <div>Regards,</div>
                                            <div>Ronald</div>
                                          </div>
                                        </div>
                                        <pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><span><font color="#888888">
</font></span></pre>
                                        <span><font color="#888888"> </font></span></blockquote>
                                      <span><font color="#888888"> <br>
                                          <br>
                                          <pre cols="72">-- 
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
OpenSIPS solutions and "know-how"</pre>
                                        </font></span></div>
                                  </blockquote>
                                </div>
                                <br>
                              </div>
                            </blockquote>
                            <br>
                            <br>
                            <pre cols="72">-- 
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
OpenSIPS solutions and "know-how"</pre>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
OpenSIPS solutions and "know-how"</pre>
  </body>
</html>