andrei 2010/03/12 14:50:06 CET
SER CVS Repository
Modified files:
mem f_malloc.c
Log:
mem: fix f_malloc big fragments bug
In some situation, when dealing with several big free fragments
(>16k) f_malloc would wrongly choose a fragment with a smaller
size then requested. This would create the impression that someone
arbitrarily overwrites the memory.
First symptoms were some tls crashes reported by
Klaus Darilion klaus.darilion(a)nic.at.
Reproduced using the malloc_test module.
(backported from sip-router,
commit c7099d0a1204120277cf662cc05ab35180d89538)
Revision Changes Path
1.29 +3 -3 sip_router/mem/f_malloc.c
http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/mem/f_malloc.c.dif…
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Ronald Voermans (voermans)
Attached to Project - sip-router
Summary - Database and cache inconsistency with registrar module / usrloc
Task Type - Bug Report
Category - Core
Status - Assigned
Assigned To - Andrei Pelinescu-Onciul
Operating System - All
Severity - Low
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - Hi,
I'm using Kamailio 3.0.0. I'm using the 'location' table to store registered contacts (save("location")), and i'm using db_mode = 1 (from usrloc).
However, currently I have only 13 records in my location table, and 121 registered clients (checked via kamctl ul show --brief). When a client re-registers, I do a save("location") and an UPDATE is sent to MySQL. But there isn't any record to update, so nothing gets updated.
I think that if an update has no matches (ie nothing gets updated), an INSERT must be perfomed in the database, so there is an consistency between the two.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=41
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#41 - Database and cache inconsistency with registrar module / usrloc
User who did this - Ronald Voermans (voermans)
http://sip-router.org/tracker/index.php?do=details&task_id=41
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.
Module: sip-router
Branch: master
Commit: 75c1e9a735c693a6985a7a1786116b5fe4044fd9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=75c1e9a…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Mar 12 12:16:16 2010 +0100
mem: fix real_used stats for realloc
A realloc that shrank an allocation accounted twice for the
fragment overhead. Basically each shrinking realloc would
introduce an error in the real_used mem stats, between 8 bytes
(f_malloc, no debugging, 32 bits) and up to 96 bytes (q_malloc
with debugging, 64 bits).
This bug concerns only the accounting part. It does not cause any
memory leak or any real runtime problem. It was introduced
in commit fb9d6e50 (2005).
---
mem/f_malloc.c | 4 +++-
mem/q_malloc.c | 7 +++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index 2c05fe6..49c4b7a 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -491,7 +491,9 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
fm_split_frag(qm, f, size);
#endif
#if defined(DBG_F_MALLOC) || defined(MALLOC_STATS)
- qm->real_used-=(orig_size-f->size-FRAG_OVERHEAD);
+ /* fm_split frag already adds FRAG_OVERHEAD for the newly created
+ free frag, so here we only need orig_size-f->size for real used */
+ qm->real_used-=(orig_size-f->size);
qm->used-=(orig_size-f->size);
#endif
}else if (f->size<size){
diff --git a/mem/q_malloc.c b/mem/q_malloc.c
index 09cb5c7..04c6dc9 100644
--- a/mem/q_malloc.c
+++ b/mem/q_malloc.c
@@ -562,8 +562,11 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
#else
if(split_frag(qm, f, size)!=0){
#endif
- /* update used sizes: freed the spitted frag */
- qm->real_used-=(orig_size-f->size-FRAG_OVERHEAD);
+ /* update used sizes: freed the splited frag */
+ /* split frag already adds FRAG_OVERHEAD for the newly created
+ free frag, so here we only need orig_size-f->size for real used
+ */
+ qm->real_used-=(orig_size-f->size);
qm->used-=(orig_size-f->size);
}
Hi, imagine this case:
- bob is registered from multiple locations:
a) a responding UDP/TCP location
b) a non responding TCP location (it crashed)
- alice calls bob
- Kamailio gets both branches from location table and runs t_relay().
- t_relay() replies "true" as location a) is responding.
However in this case it would be useful to realize that the second location
(unreachable TCP location) doesn't work, and being TCP it's safe to remove it
from location table.
AFAIK (correct me if I'm wrong) there is some script function to remove user
locations, but there is no way to use it in the example above (am I wrong?).
As a suggestion, there could be a usrloc option to remove TCP contacts from
location table when t_relay() fails, perhaps in conjunction with some new flag
for t_relay() function.
Is there any better aproach for this purpose?
--
Iñaki Baz Castillo <ibc(a)aliax.net>
Module: sip-router
Branch: master
Commit: a0b247b8cd596b3032270316a2184a04c9cff917
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a0b247b…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Fri Mar 12 11:54:25 2010 +0200
test/unit Added support for running the tests if kamailio was built instead of ser
Support was added by checking what executable exists in the $SR_DIR path
---
test/unit/include/common | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/test/unit/include/common b/test/unit/include/common
index 14077d5..d918496 100644
--- a/test/unit/include/common
+++ b/test/unit/include/common
@@ -7,6 +7,15 @@ CTLRC="$CTL_DIR/kamctlrc"
CTL="$CTL_DIR/kamctl"
DBCTL="$CTL_DIR/kamdbctl"
BIN="$SR_DIR/ser"
+if [ -f $SR_DIR/ser ] ; then
+ BIN="$SR_DIR/ser"
+else
+ if [ -f $SR_DIR/kamailio ] ; then
+ BIN="$SR_DIR/kamailio"
+ else
+ echo "WARNING Binary not found!"
+ fi
+fi
KILL="killall -15 $BIN"
# test directory relative to root
TEST_DIR="test/unit"
Bugs item #2968918, was opened at 2010-03-11 21:05
Message generated for change (Tracker Item Submitted) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=2968918&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: load_tm update for dispatcher
Initial Comment:
The dispatcher module is still using
find_export/load_tm instead of load_tm_api
Without that the "probing" of gateways doesnt; work since the tm module can;t be pulled in.
I manaully patched the code and now i can see the OPTIONS/INFO requests on the wire.
my patch is too messy to submit. It's a simple patch though...
-bill
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=2968918&group_…
Module: sip-router
Branch: kamailio_3.0
Commit: 0822a9caf751d2fb28ac398fd60cc2583308aa94
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0822a9c…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Mar 11 21:08:20 2010 +0100
mem: fix f_malloc big fragments bug
In some situation, when dealing with several big free fragments
(>16k) f_malloc would wrongly choose a fragment with a smaller
size then requested. This would create the impression that someone
arbitrarily overwrites the memory.
First symptoms were some tls crashes reported by
Klaus Darilion klaus.darilion(a)nic.at.
Reproduced using the malloc_test module.
(cherry picked from commit c7099d0a1204120277cf662cc05ab35180d89538)
---
mem/f_malloc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index c49a252..2c05fe6 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -337,7 +337,7 @@ void* fm_malloc(struct fm_block* qm, unsigned long size)
hash=fm_bmp_first_set(qm, GET_HASH(size));
if (likely(hash>=0)){
f=&(qm->free_hash[hash].first);
- if (likely(hash<=F_MALLOC_OPTIMIZE)) /* return first match */
+ if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) /* return first match */
goto found;
for(;(*f); f=&((*f)->u.nxt_free))
if ((*f)->size>=size) goto found;
@@ -346,7 +346,7 @@ void* fm_malloc(struct fm_block* qm, unsigned long size)
for(hash=GET_HASH(size);hash<F_HASH_SIZE;hash++){
f=&(qm->free_hash[hash].first);
#if 0
- if (likely(hash<=F_MALLOC_OPTIMIZE)) /* return first match */
+ if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) /* return first match */
goto found;
#endif
for(;(*f); f=&((*f)->u.nxt_free))