freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] tdsdump SIGSEGV with mt apps
- Date: Wed, 13 Apr 2005 12:52:46 +0200
>
> Hi,
>
> Unfortunately, in a multi-threaded application, TDSDUMP breaks
> and causes a SIGSEGV (as g_dumpfile is closed/opened by other
> threads concurrently).
>
> Please see the below patch that works around this problem. I'm not
> sure why it calls tdsdump_close() to start with?
>
> The patch is against freetds-0.64.dev.20050411.
>
> Thanks.
>
> --- util.c 2005-03-12 22:47:37.000000000 +1100
> +++ util.c.new 2005-04-12 16:40:44.000000000 +1000
> @@ -242,6 +242,10 @@
> {
> int result; /* really should be a boolean, not an
> int */
>
> + if (g_dumpfile != NULL) {
> + return 1;
> + }
> +
> tdsdump_close();
> if (filename == NULL || filename[0] == '\0') {
> return 1;
>
I'm thinking about applying or not your patch. Your patch solve the
problem however is it the right way to fix it??
The problem raise from the fact that logging is global. Opening a log
redirect logging of all library (all thread, connections and so on) to a
single file. I tried some time ago to use a TDSSOCKET member but change
was too extensive for a simple log... Your fix avoid thread problem
however it do not let to change file to another location. A better way
to handle all this is to grab and release dumpfile every time you want
to log. Something like
int log(...)
{
...
dumpfile = g_dumpfile;
g_dumpfile = NULL;
... log to dumpfile ...
if (!g_dumpfile)
g_dumpfile = dumpfile;
else
fclose(dumpfile);
}
This would assure that FILE * is used only by a single thread (well is
not really fully thread safe, a mutex should be used)
If I remember you posted a patch to fix some problem with dblib and
multi-thread. I think is the right time to review it.
freddy77
-
[freetds] tdsdump SIGSEGV with mt apps,
liam, 04/12/2005
- <Possible follow-up(s)>
-
RE: [freetds] tdsdump SIGSEGV with mt apps,
ZIGLIO, Frediano, VF-IT, 04/13/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
liam, 04/13/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
James K. Lowden, 04/13/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
liam, 04/15/2005
- Re: [freetds] tdsdump SIGSEGV with mt apps, Frediano Ziglio, 04/15/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
liam, 04/15/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
James K. Lowden, 04/13/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
liam, 04/13/2005
-
RE: [freetds] tdsdump SIGSEGV with mt apps,
ZIGLIO, Frediano, VF-IT, 04/13/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
liam, 04/15/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
Frediano Ziglio, 04/15/2005
- Re: [freetds] tdsdump SIGSEGV with mt apps, liam, 04/18/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
Frediano Ziglio, 04/15/2005
-
Re: [freetds] tdsdump SIGSEGV with mt apps,
liam, 04/15/2005
- RE: [freetds] tdsdump SIGSEGV with mt apps, ZIGLIO, Frediano, VF-IT, 04/19/2005
Archive powered by MHonArc 2.6.24.