<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.8.4">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#ffffff">
hello Daniel<BR>
<BR>
sorry for the delay, we already made the pull request <A HREF="https://github.com/kamailio/kamailio/pull/1146">1146</A><BR>
and you actually gave the ok<BR>
<BR>
best regards<BR>
david<BR>
<BR>
<BR>
El jue, 01-06-2017 a las 10:04 +0200, Daniel-Constantin Mierla escribió:
<BLOCKQUOTE TYPE=CITE>
    Hello,<BR>
    <BR>
    can you make a pull request with your fixes on github project? It makes it easier to review and merge if all ok.<BR>
    <BR>
    Cheers,<BR>
    Daniel<BR>
    <BR>
    On 31.05.17 18:06, David Escartín Almudévar wrote:<BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BLOCKQUOTE TYPE=CITE>
        hello all<BR>
        <BR>
        today testing kamailio 5.0.1 version we have seen that some rpc commands of benchmark module are not working fine.<BR>
        <BR>
        when trying to change enable_global parameter, setting 1 for example it says that the parameter is invalid<BR>
        /usr/local/kamailio-5.0/sbin/kamcmd -s <A HREF="udp:127.0.0.1:2046">udp:127.0.0.1:2046</A> benchmark.enable_global 1<BR>
        error: 500 - Invalid Parameter Value<BR>
        <BR>
        besides, it also permits to set a granularity value of 0 without giving error.<BR>
        By doing that, if the kamailio has calls in progress, the kamailio get a crash<BR>
        <BR>
        Core was generated by `/usr/local/kamailio-5.0/sbin/kamailio -P /var/run/kamailio/kamailio_talos.pid -'.<BR>
        Program terminated with signal 8, Arithmetic exception.<BR>
        #0  0x00007f4d55989757 in _bm_log_timer (id=0) at benchmark.c:320<BR>
        320 if ((bm_mycfg->tindex[id]->calls % bm_mycfg->granularity) == 0)<BR>
        Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.x86_64 libxml2-2.7.6-14.el6.x86_64 pcre-7.8-6.el6.x86_64 zlib-1.2.3-29.el6.x86_64<BR>
        <BR>
        i understand that maybe is trying to divide by 0 to calcutate the benchmark stats.<BR>
        <BR>
        checking the functions, we made a change to fix this problem, by chaning the type of the vars defined as "int", instead of "long int".<BR>
        this way seems the commands work fine<BR>
        <BR>
        /usr/local/kamailio-5.0/sbin/kamcmd -s <A HREF="udp:127.0.0.1:2046">udp:127.0.0.1:2046</A> benchmark.enable_global 1<BR>
        /usr/local/kamailio-5.0/sbin/kamcmd -s <A HREF="udp:127.0.0.1:2046">udp:127.0.0.1:2046</A> benchmark.granularity 0<BR>
        error: 500 - Invalid Parameter Value<BR>
        <BR>
        this are the changes we made<BR>
        index d40469b..5a353d5 100644<BR>
        --- a/src/modules/benchmark/benchmark.c<BR>
        +++ b/src/modules/benchmark/benchmark.c<BR>
        @@ -479,7 +479,8 @@ static inline int fixup_bm_timer(void** param, int param_no)<BR>
          */<BR>
        void bm_rpc_enable_global(rpc_t* rpc, void* ctx)<BR>
        {<BR>
        -       long int v1;<BR>
        +       int v1;<BR>
        +       /*long int v1;*/<BR>
                if(rpc->scan(ctx, "d", (int*)(&v1))<1) {<BR>
                        LM_WARN("no parameters\n");<BR>
                        rpc->fault(ctx, 500, "Invalid Parameters");<BR>
        @@ -518,7 +519,8 @@ void bm_rpc_enable_timer(rpc_t* rpc, void* ctx)<BR>
        <BR>
        void bm_rpc_granularity(rpc_t* rpc, void* ctx)<BR>
        {<BR>
        -       long int v1;<BR>
        +       int v1;<BR>
        +        /*long int v1;*/<BR>
                if(rpc->scan(ctx, "d", (int*)(&v1))<1) {<BR>
                        LM_WARN("no parameters\n");<BR>
                        rpc->fault(ctx, 500, "Invalid Parameters");<BR>
        @@ -533,7 +535,8 @@ void bm_rpc_granularity(rpc_t* rpc, void* ctx)<BR>
        <BR>
        void bm_rpc_loglevel(rpc_t* rpc, void* ctx)<BR>
        {<BR>
        -       long int v1;<BR>
        +       int v1;<BR>
        +       /*long int v1;*/<BR>
                if(rpc->scan(ctx, "d", (int*)(&v1))<1) {<BR>
                        LM_WARN("no parameters\n");<BR>
                        rpc->fault(ctx, 500, "Invalid Parameters");<BR>
        <BR>
        could you please check if this fix is enough? and maybe there can be some other functions with this problem?<BR>
        <BR>
        thanks  alot and regards<BR>
        david <BR>
        <BR>
<PRE>
_______________________________________________
Kamailio (SER) - Development Mailing List
<A HREF="mailto:sr-dev@lists.kamailio.org">sr-dev@lists.kamailio.org</A>
<A HREF="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev</A>
</PRE>
    </BLOCKQUOTE>
    <BR>
    <BR>
    <BR>
<PRE>
-- 
Daniel-Constantin Mierla
<A HREF="http://www.twitter.com/miconda">www.twitter.com/miconda</A> -- <A HREF="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</A>
Kamailio Advanced Training - <A HREF="http://www.asipto.com">www.asipto.com</A>
Kamailio World Conference - <A HREF="http://www.kamailioworld.com">www.kamailioworld.com</A>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>