[Kamailio-Devel] Resp.: [Kamailio-Users] Help to create in core

Marcio mrgalhan at gmail.com
Mon Sep 15 22:27:19 CEST 2008


Henning,

Version used = openser 1.3.0-no-tls;

thx by advices, but i'm newbie too in 'c'.....so i did debug setting
debug level 4 and find it:
...
Sep  5 17:30:07 notehome openser[29088]: DBG:core:find_mod_export:
found <db_insert_update> in module mysql
[/usr/local/lib/openser/modules/]
Sep  5 17:30:07 notehome openser[29088]: DBG:mysql:db_mysql_init:
connection 'mysql://openserro:openserro@localhost/openser' not found
in pool
Sep  5 17:30:07 notehome openser[29088]:
DBG:mysql:db_mysql_new_connection: opening MySQL connection:
mysql://openserro:openserro@localhost/openser
Sep  5 17:30:07 notehome openser[29088]:
DBG:mysql:db_mysql_new_connection: connection type is Localhost via
UNIX socket
Sep  5 17:30:07 notehome openser[29088]:
DBG:mysql:db_mysql_new_connection: protocol version is 10
Sep  5 17:30:07 notehome openser[29088]:
DBG:mysql:db_mysql_new_connection: server version is
5.0.38-Ubuntu_0ubuntu1.4-log
Sep  5 17:30:08 notehome openser[29084]: INFO:core:handle_sigs: child
process 29088 exited by a signal 11
Sep  5 17:30:08 notehome openser[29084]: INFO:core:handle_sigs: core
was generated
Sep  5 17:30:08 notehome openser[29084]: INFO:core:handle_sigs:
terminating due to SIGCHLD
Sep  5 17:30:08 notehome openser[29089]: INFO:core:sig_usr: signal 15 received

The proxy openser, when receive a request "register"...the main.c in
"switch(sig_flag) / case SIGCHLD / line "else if
(WIFSIGNALED(chld_status))....LM_INFO(child process chld exited by
signal...") how seen above....after to pass
"modules/mysql/dbase.c...and not found in pool the "con = (struct
my_con*)pool_get(id)" ...
if (!con)  {
  ....
  con = db_mysql_new_connection(id) /* in this point...here he perform
a function below view */
....

in modules/mysql/my_con.c:
      struct my_con* db_mysql_new_connection(struct db_id* id) {
...................
             if (id->port){
...................
             } else {
                      LM_DBG("openning MySQL connection:mysql://%s:%s@%s/%s\n",
                                ZSW(id->username),
                                ZSW(id->password),
                                ZSW(id->host),
                                ZSW(id->database)
                                );
              }
....................
....................
              LM_DBG(connection type is %s\n", mysql_get_host_info(ptr->con));
              LM_DBG(protocol version is .............;
              LM_DBG(server version is................;

              ptr->timestamp = time(0);
              ptr->id = id;
              return ptr;

at this point the control returns to "main.c" and kill the pid ....
              "switch(sig_flag) / case SIGCHLD / line "else if
    (WIFSIGNALED(chld_status))....LM_INFO(child process chld exited by
signal...")
.....

The MySQL is listenning in socket: 172.31.12.144:3306 and not
"localhost:3306"....
and the openser.cfg has ........alias="172.31.12.144:5060" and
alias="localhost:5060"....
and in the loadmodule "domain.so" /* where i'm using my function...*/
               modparam("domain", "domain_table", "domain")
                  /* modules/domain/domain_mod.c where is definition
the "exports" */
                  /* I CAN USE A EXISTING MODULE AND DECLARE OTHERS
TABLES ?? */
               modparam("domain", "trusdomain_table", "trusdomain")
                  /* within just a #define TRUSDOMAIN_TABLE .....*/
                                                   TRUSDOMAIN_COL.........*/
                                       Module parameter values:
                                                str trusdomain_table =
{TRUSDOMAIN_TABLE..
                                                str trusdomain_col =
{TRUSDOMAIN_COL...
                                       Exported Functions: static
cmd_export_t cmds[] = {
                                                        {"is_from_trusted", ....
                                                        {0,0,0,0,0,0}
                                        Exported parameters: static
param_export_t params[] = {
                                                        .....

{"trusdomain_table....STR_PARAM...
                                                        {0,0,0}

                                        only that....without further
declarations/statements in "domain_mod.c"......

Actually I think I lost .....when i run into shell(linux) #
openser.....he is executing no probs, but when receive um request
"register" i routed to route[2] and test with "if (is_from_trusted() )
{.........} then he dead...with log above....

If you can help...thx you very........

Marcio

2008/9/15, Henning Westerholt <henning.westerholt at 1und1.de>:
> On Sunday 14 September 2008, Marcio wrote:
>> I appreciate very much to help solve some problems in the clearance of a
>> function to perform a query Mysql .... created the function based on
>> documentation of asipto / kamailio devel which is great ... but I did not
>> want to create a new module used the module in domain ... whose goal is a
>> proxy to receive  SIP msg should validate the realm with what is in a
>> table
>> (Trustee) was created through a query ... it should be used for the config
>> file to declare of the table created in the Mysql: modparam ( "domain",
>> "trusdomain_table," trusdomain)
>> the table version updated with the creation of this table (trusdomain) and
>> create the own function in the file: domain.c / h part to be exported in
>> domain_mod.c / h....but on the tests a call SIP to proxy kills a openser's
>> pid ...
>>
>> Sep  5 06:32:21 notehome openser[7962]: INFO:core:handle_sigs: child
>> process 7964 exited by a signal 11
>> Sep  5 06:32:21 notehome openser[7962]: INFO:core:handle_sigs: core was
>> generated
>
> Hi Marcio,
>
> you could use the debugger "gdb" to inspect the generated core file, to get
> a
> clue why the crash happened. You can also increase the debug level to 4, and
> then you'll get more detailed debug informations about stuff that happens in
> the DB API and the other core parts.
>
> I can't comment in detail to the code you've posted but you should move the
> database initialization and open calls to the mod_init/ child_init of the
> module, otherwise for each function call the dabase will be opened again.
> What version of openser/kamailio do you use? I noticed that you do this:
>
> keys[0]=trusdomain_col.s;
> cols[0]=trusdomain_col.s;
>
> this is not valid anymore in newer versions, the type of db_key_t is there
> str*, not char*.
>
> If the crash happens in your function, just add some log statements, to
> observe where the crash happens, if you don't like gdb that much.
>
> Hope that helps,
>
> Henning
>



More information about the Devel mailing list