Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32186
Modified Files:
merovingian.mx
Log Message:
Make it a bit more explicit that we fill in a struct field, in an
attempt to find a leak that valgrind knows it exists, but cannot make
explicit how.
The leak is really related to the second thread (if I switch it around,
it's the first) which is the thread that does the cleanup. Logging
shows the freeing and destroying is run, so what on earth happens
here... does the thread get lost somehow?
U merovingian.mx
Index: merovingian.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian.mx,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- merovingian.mx 22 Apr 2008 20:32:08 -0000 1.42
+++ merovingian.mx 23 Apr 2008 19:51:52 -0000 1.43
@@ -690,6 +690,7 @@
char *conn;
stream *sfdin, *sfout;
merovingian_proxy *pctos, *pstoc;
+ pthread_t ptid;
/* quick 'n' dirty parsing */
if (strncmp(url, "mapi:monetdb://", sizeof("mapi:monetdb://") - 1) ==
0) {
@@ -752,21 +753,15 @@
* stoc: in = D, out = C, co_in = A, co_out = B
*/
- pctos = GDKmalloc(sizeof(merovingian_proxy));
- pctos->in = cfdin;
- pctos->out = sfout;
- pctos->co_in = sfdin;
- pctos->co_out = cfout;
- pctos->name = GDKstrdup(client);
-
pstoc = GDKmalloc(sizeof(merovingian_proxy));
pstoc->in = sfdin;
pstoc->out = cfout;
pstoc->co_in = cfdin;
pstoc->co_out = sfout;
pstoc->name = NULL; /* we want only one log-message on disconnect */
+ pstoc->co_thr = 0;
- if (pthread_create(&pctos->co_thr, NULL,
+ if (pthread_create(&ptid, NULL,
(void *(*)(void *))proxyThread, (void *)pstoc)
< 0)
{
close_stream(sfout);
@@ -774,12 +769,19 @@
return(newErr("failed to create proxy thread"));
}
- if (pthread_create(&pstoc->co_thr, NULL,
+ pctos = GDKmalloc(sizeof(merovingian_proxy));
+ pctos->in = cfdin;
+ pctos->out = sfout;
+ pctos->co_in = sfdin;
+ pctos->co_out = cfout;
+ pctos->name = GDKstrdup(client);
+ pctos->co_thr = ptid;
+
+ if (pthread_create(&ptid, NULL,
(void *(*)(void *))proxyThread, (void *)pctos)
< 0)
{
- /* if we destroy here, the first thread will cause a crash */
- stream_close(sfout);
- stream_close(sfdin);
+ close_stream(sfout);
+ close_stream(sfdin);
return(newErr("failed to create proxy thread"));
}
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins