THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#152 - t_reply 302 redirects use wrong to-tag after fr_inv_timer fires
User who did this - Daniel-Constantin Mierla (miconda)
----------
Hi Andrew, is this really SIP RFC requirement or even compliant? Thinking of serial/parallel forking, several and different To-tags can go back to caller within many 1xx replies. They have to be discarded and the one in final reply has to be considered good, so IMO the phone is buggy.
What happens if there is a parallel forking and there are many 1xx, but then timeout and 302? Which branch is considered good? Furthermore, one may have the redirect server as separate Kamailio instance, so on timeout of previous branches a new one is sent to redirect server which replies directly 302, having no idea of the branches in main proxy. What happens then, polycom will ignore it?
I understand it solves an issue with some Polycoms, but I don't think it is the right approach to make this default in the proxy. Ideally Polycom will solve the bug. If it has to be "fixed" in the proxy, then it has to be something optional/configurable, with at less impact as possible on default behaviour.
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=152#comment277
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task is now closed:
FS#155 - msg_parser memory leak
User who did this - Daniel-Constantin Mierla (miconda)
Reason for closing: Fixed
Additional comments about closing: Thanks! Patch v2 applied to GIT master branch and will be backported to 3.1 branch.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=155
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
Daniel-Constantin Mierla has taken ownership of the following task:
FS#155 - msg_parser memory leak
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=155
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#155 - msg_parser memory leak
User who did this - Walter Doekes (wdoekes)
----------
There are other places that also use parse_to and pkg_free it on fail. I've added those I could find to this _v2 patch.
I didn't test any of that apart from that it compiles.
An alternative fix to this issue could be to free_to_params() in parse_to on ERROR. That would lead to less changes. Make sure param_lst is reset to 0 though, as some might want to call free_to() anyway, causing a double-free.
Regards,
Walter
----------
One or more files have been attached.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=155#comment276
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Walter Doekes (wdoekes)
Attached to Project - sip-router
Summary - msg_parser memory leak
Task Type - Bug Report
Category - Core
Status - Assigned
Assigned To - Andrei Pelinescu-Onciul
Operating System - All
Severity - High
Priority - Normal
Reported Version - 3.1
Due in Version - Undecided
Due Date - Undecided
Details - Hi,
parser/msg_parser get_hdr_field forgets to clean up to_b parameters when pkg_free'ing to_b (To-body) on error.
A properly crafted SIP packet can cause kamailio/siprouter to run out of memory.
Example:
{{{
$ diff -pu sipsak-0.9.6/request.c{.orig,}
--- sipsak-0.9.6/request.c.orig 2011-09-19 11:28:43.793987925 +0200
+++ sipsak-0.9.6/request.c 2011-09-19 11:28:59.473988046 +0200
@@ -262,7 +262,7 @@ void create_msg(int action, char *req_bu
"%s sip:%s%s%s"
"%s%s %s:9;branch=z9hG4bK.%08x\r\n"
"%ssip:sipsak@%s:9;tag=%x\r\n"
- "%ssip:%s%s\r\n"
+ "%ssip:%s%s;tag=crap;\r\n"
"%s%u@%s\r\n"
"%s%i %s\r\n"
"%ssip:sipsak@%s:9\r\n"
}}}
This patched sipsak will let the children calling parse_to quickly to run out of memory.
When parsing the To: body, parse_to_param adds tag=crap. Later it trips on the trailing semi-colon and returns an error. The caller only frees the container to_b and not the parsed parameters.
Fix: replace pkg_free with free_to.
Before the patch:
{{{
Sep 19 11:40:07 walter-desktop kamailio[15119]: ERROR: <core> [parser/parse_to.c:814]: ERROR: parse_to: invalid To - unexpected end of header in state 13
Sep 19 11:40:07 walter-desktop kamailio[15121]: ERROR: <core> [parser/parse_to.c:506]: ERROR: parse_to_param : unexpected end of header, status 20: <<;tag=crap;#015#012>> .
Sep 19 11:40:07 walter-desktop kamailio[15121]: ERROR: <core> [parser/parse_to.c:814]: ERROR: parse_to: invalid To - unexpected end of header in state 13
Sep 19 11:40:07 walter-desktop kamailio[15121]: ERROR: <core> [parser/msg_parser.c:179]: ERROR: get_hdr_field: bad to header
Sep 19 11:40:07 walter-desktop kamailio[15121]: INFO: <core> [parser/msg_parser.c:353]: ERROR: bad header field [To: sip:localhost;ta]
}}}
and after a while
{{{
Sep 19 11:40:39 walter-desktop kamailio[15120]: ERROR: <core> [parser/parse_to.c:286]: ERROR: parse_to_param - out of memory
Sep 19 11:40:39 walter-desktop kamailio[15120]: ERROR: <core> [parser/parse_to.c:814]: ERROR: parse_to: invalid To - unexpected end of header in state 27
Sep 19 11:40:39 walter-desktop kamailio[15120]: INFO: <core> [parser/msg_parser.c:353]: ERROR: bad header field [To: sip:localhost;ta]
}}}
After the patch: no more leaks and kamailio keeps on running smoothly.
Note that I added a free_cseq() in the patch as well. It only calls pkg_free, but if that were to change, get_hdr_field would be prepared.
Regards,
Walter Doekes
OSSO B.V.
One or more files have been attached.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=155
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A user has added themself to the list of users assigned to this task.
FS#155 - msg_parser memory leak
User who did this - Walter Doekes (wdoekes)
http://sip-router.org/tracker/index.php?do=details&task_id=155
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has been changed. The changes are listed below. For full information about what has changed, visit the URL and click the History tab.
FS#154 - tracked initial requests ended prematurely by stateless responses are not cleaned up
User who did this: Timo Reimann (tr)
Task details edited:
-------
If the initial request to a dialog tracked using dlg_manage() is not delivered further downstream but ended by a stateless response from the proxy the associated dialog will not be cleaned up properly.
Example flow:
Caller ---> INVITE ---> Proxy
Caller <--- 4xx(s-less) --- Proxy
The reason for this behavior is that the dialog module expects a transaction to conclude when a call is being tracked. By returning the failure response statelessly, no transaction will be created and thus, the dialog structure never removed.
Possible fixes to the problem:
(1) On return of a stateless response, let the sl module call a function in the dialog module to clean up such dialogs. This is an ugly approach because it touches two modules and increases inter-module dependency; on the other side, it is expected to work.
(2) Within the dialog module, register a to-be-implemented function on completed execution of the configuration script which is to detect and cleanup all "unconfirmed" dialogs that were ended prematurely by means of stateless responding. While this is a more elegant approach than (1), a method needs to be determined which is capable of detecting the problematic state. Introducing a new dialog state (e.g., DLG_STATE_UNCONFIRMED_SENT) could be one way to do this.
Workarounds:
(1) Refrain from tracking dialogs using dlg_manage() until you are sure no stateless response will be emitted.
(2) Return responses statefully, i.e., call t_newtran() followed by t_reply().
(3) Track dialogs using the dialog flag instead of dlg_manage(). Although I haven't verified this solution, it should work.
-------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=154
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Timo Reimann (tr)
Attached to Project - sip-router
Summary - tracked initial requests ended prematurely by stateless responses are not cleaned up
Task Type - Bug Report
Category - dialog
Status - Assigned
Assigned To - Timo Reimann
Operating System - All
Severity - Low
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - If the initial request to a dialog tracked using dlg_manage() is not delivered further downstream but ended by a stateless response from the proxy the associated dialog will not be cleaned up properly.
Example flow:
Caller ------------> Proxy
INVITE
Caller <------------ Proxy
4xx(s-less)
The reason for this behavior is that the dialog module expects a transaction to conclude when a call is being tracked. By returning the failure response statelessly, no transaction will be created and thus, the dialog structure never removed.
Possible fixes to the problem:
(1) On return of a stateless response, let the sl module call a function in the dialog module to clean up such dialogs. This is an ugly approach because it touches two modules and increases inter-module dependency; on the other side, it is expected to work.
(2) Within the dialog module, register a to-be-implemented function on completed execution of the configuration script which is to detect and cleanup all "unconfirmed" dialogs that were ended prematurely by means of stateless responding. While this is a more elegant approach than (1), a method needs to be determined which is capable of detecting the problematic state. Introducing a new dialog state (e.g., DLG_STATE_UNCONFIRMED_SENT) could be one way to do this.
Workarounds:
(1) Refrain from tracking dialogs using dlg_manage() until you are sure no stateless response will be emitted.
(2) Return responses statefully, i.e., call t_newtran() followed by t_reply().
(3) Track dialogs using the dialog flag instead of dlg_manage(). Although I haven't verified this solution, it should work.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=154
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A user has added themself to the list of users assigned to this task.
FS#154 - tracked initial requests ended prematurely by stateless responses are not cleaned up
User who did this - Timo Reimann (tr)
http://sip-router.org/tracker/index.php?do=details&task_id=154
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.