Re: sqlbox mysql re-connection (question)
"Mi Reflejo" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Umh. It is "working" identically to bearerbox. dbpool_conn_consume is moving in connections (max-connections) until the list is empty. At this point, gwlist_consume waits forever. Sqlbox is doing the right things. We need to fix dbpool of kannel. M On 6/3/06, Rene Kluwen <[email protected]> wrote: > Thanks, Martin for your insight. > > First, looking at dbpool_conn_consume, I see a "bug". > In the while loop at line 216, the stop criterium is pc == NULL. > Next, on line 286, a return (pc->conn != NULL ? pc : NULL) is done. > This segfaults when the while loop hits the stop criterium in stead of being > exit with break. > > Note that this doesn't happen in real because the p->pool list has at least > one producer so if the list > is empty, gwlist_consume waits until somebody produces a connection again. > > Nonetheless, my real question is: Before inserting or selecting something > into or from the sql database, > a dbpool_conn_consume is done. > This should ensure, I always have a working connection, according to what > you just said. > > So why doesn't it work? > > Rene Kluwen > Chimit > > > -----Original Message----- > From: Mi Reflejo [mailto:[email protected]] > Sent: zondag 4 juni 2006 0:09 > To: Rene Kluwen > Cc: [email protected] > Subject: Re: sqlbox mysql re-connection (question) > > > Actually dbpool_check is not used :). > > Lets asume that we are using mySQL. > > Before each query, "dbpool_conn_consume" is called. > > "dbpool_conn_consume" call the function: p->db_ops->check(pc->conn) > (declaration: p->db_ops = &mysql_ops; and .check = mysql_check_conn,) > > Check function does a "mysql_ping" and returns 0 or -1. > If the connection is not active "dbpool_conn_consume" restarts the > connection and checks again, while the connection is down. > > Hope it helps. > > Martin > > On 6/3/06, Rene Kluwen <[email protected]> wrote: > > I have been looking into the sources a little bit. > > > > But I cannot seem to find the spot where bearerbox reconnects to the MySQL > > daemon. > > I figure dbpool_check() should be called somewhere. > > > > Of course, I can just put a call to that function somewhere in sqlbox. > > But I would like to follow a little bit the same way as it is done > elsewhere > > in Kannel. > > > > Rene Kluwen > > Chimit > > > > > > > > > >