Skip to contentSkip to conversation

squid pb with glibc-2.3.1 and pthread (pb reproduced now)

parisc-linux Joel Soete 3 participants 7 messages Mar 18, 2003 – Mar 19, 2003

lore
Share & tools
lore

Joel Soete

author
#0 lore raw

Hi all,

Sorry in advance if am annoying but remember this test case:

(the very begining of squid main())

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

/* getpid(), geteuid() */
#include <sys/types.h>
#include <unistd.h>

/* setgroups() */
#include <grp.h>

/* mkdir() */
#include <sys/stat.h>
#define MAXPATHLEN 256

/* waitpid() */
#include <sys/wait.h>

/* mallopt() */
#include <malloc.h>

#define SQUID_MAXFD 4096

/* autoconf.h */
/* Define if you have the mallopt function. */
#define HAVE_MALLOPT 1

/* dlmalloc.c */

#define M_GRAIN   3    /* UNUSED in this malloc */
#define M_MXFAST  1    /* UNUSED in this malloc */

int Squid_MaxFD; /* SQUID_MAXFD */

FILE *debug_log = NULL;

int
main(int argc, char **argv)

{
    int errcount = 0;
    mode_t oldmask;

    debug_log = stderr;
    if (FD_SETSIZE < Squid_MaxFD)
	Squid_MaxFD = FD_SETSIZE;

    fprintf(stderr, "nb_err: %d\n", errcount);
    /* call mallopt() before anything else */
#ifdef HAVE_MALLOPT
    fprintf(stderr, "  HAVE_MALLOPT \n");
#ifdef M_GRAIN
    /* Round up all sizes to a multiple of this */
    fprintf(stderr, " M_GRAIN seti: %d\n", M_GRAIN);
    mallopt(M_GRAIN, 16);
#endif
#ifdef M_MXFAST
    /* biggest size that is considered a small block */
    fprintf(stderr, " M_MXFAST seti: %d\n", M_MXFAST);
    mallopt(M_MXFAST, 256);
#endif
#ifdef M_NBLKS
    /* allocate this many small blocks at once */
    fprintf(stderr, " M_NBLKS set: %d\n", M_NBLKS);
    mallopt(M_NLBLKS, 32);

#endif
#endif /* HAVE_MALLOPT */

/*

    oldmask = umask(S_IRWXO);

*/

    return 0;
}

At this time I compiled it simply:
gcc -o foo foo.c

run it ./foo and no problem :_(( [very very bad it didn't reproduced the pb]

Now recompile it with pthread lib (useless for this test case never the less here usefull):

gcc -o foo -l pthread foo.c

run it ./foo and now it loop :)

(hmm squid can work without maollopt but not pthread afaik)

Joel

---------------------------------
Vous surfez avec une ligne classique ? Economisez jusqu'à 25% avec Tiscali Complete ! Offre spéciale : première année d'abonnement offerte. ... Plus d'info sur http://complete.tiscali.be

#1 lore raw
Quoted 6 lines

Now recompile it with pthread lib (useless for this test case never the less here usefull):

gcc -o foo -l pthread foo.c

run it ./foo and now it loop :)

The pthread library has been broken for some time due to an error in the locking code. This might be fixed now. The fix was part of Carlos's latest pthread patch.

Dave

Signature · 2 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
author
#2 lore raw
Quoted 13 lines

-- Original Message --
Subject: Re: [parisc-linux] squid pb with glibc-2.3.1 and pthread (pb reproduced now)
To: [email protected] (Joel Soete)
Date: Tue, 18 Mar 2003 11:45:46 -0500 (EST)
From: "John David Anglin" <[email protected]>
Cc: [email protected]

Quoted 1 line

Now recompile it with pthread lib (useless for this test case never the

less

Quoted 2 lines

here usefull):

Quoted 8 lines
Quoted 3 lines

gcc -o foo -l pthread foo.c

run it ./foo and now it loop :)

The pthread library has been broken for some time due to an error in the locking code. This might be fixed now. The fix was part of Carlos's latest pthread patch.

Hi Dave,

I presume that this patch is not yet into libc6_2.3.1-15 dpkg (I also run the test case with the same pb on an unstable debian running on b2k); so my question is: does it exist somewhere a patch against this dpkg src which I can test?

Thanks again for all,
Joel

---------------------------------
Vous surfez avec une ligne classique ? Economisez jusqu'à 25% avec Tiscali Complete ! Offre spéciale : première année d'abonnement offerte. ... Plus d'info sur http://complete.tiscali.be

#3 lore raw
Quoted 4 lines

I presume that this patch is not yet into libc6_2.3.1-15 dpkg (I also run the test case with the same pb on an unstable debian running on b2k); so my question is: does it exist somewhere a patch against this dpkg src which I can test?

I just checked. The patch is in -15. It wasn't in -14. I haven't tried -15.

Dave

Signature · 2 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
author
#4 lore raw
Quoted 1 line
Quoted 1 line

I presume that this patch is not yet into libc6_2.3.1-15 dpkg (I also

run

Quoted 1 line
Quoted 1 line

the test case with the same pb on an unstable debian running on b2k);

so

Quoted 1 line
Quoted 1 line

my question is: does it exist somewhere a patch against this dpkg src

which

Quoted 5 lines
Quoted 1 line

I can test?

I just checked. The patch is in -15. It wasn't in -14. I haven't tried -15.

So it doesn't yet help here. Never the less I think that I reach to produce enough simple material which Carlos could analyse (in its time) :)

Thanks a lot,
Joel

---------------------------------
Vous surfez avec une ligne classique ? Economisez jusqu'à 25% avec Tiscali Complete ! Offre spéciale : première année d'abonnement offerte. ... Plus d'info sur http://complete.tiscali.be

#5 lore raw
Quoted 2 lines

So it doesn't yet help here. Never the less I think that I reach to produce enough simple material which Carlos could analyse (in its time) :)

If you send me a test case I can look at it. I don't even see why -l pthread would break the previous code :)

c.

author
#6 lore raw
Quoted 8 lines
Quoted 4 lines

So it doesn't yet help here. Never the less I think that I reach to produce enough simple material which Carlos could analyse (in its time) :)

If you send me a test case I can look at it. I don't even see why -l pthread would break the previous code :)

Don't even more but it is a rare case where I encounter mallopt usage?

Anyway here it is:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

/* getpid(), geteuid() */
#include <sys/types.h>
#include <unistd.h>

/* setgroups() */
#include <grp.h>

/* mkdir() */
#include <sys/stat.h>
#define MAXPATHLEN 256

/* waitpid() */
#include <sys/wait.h>

/* mallopt() */
#include <malloc.h>

#define SQUID_MAXFD 4096

/* autoconf.h */
/* Define if you have the mallopt function. */ #define HAVE_MALLOPT 1

/* dlmalloc.c */

#define M_GRAIN   3    /* UNUSED in this malloc */
#define M_MXFAST  1    /* UNUSED in this malloc */

int Squid_MaxFD; /* SQUID_MAXFD */

FILE *debug_log = NULL;

int
main(int argc, char **argv)

{
    int errcount = 0;
    mode_t oldmask;

    debug_log = stderr;
    if (FD_SETSIZE < Squid_MaxFD)
	Squid_MaxFD = FD_SETSIZE;

    fprintf(stderr, "nb_err: %d\n", errcount);
    /* call mallopt() before anything else */
#ifdef HAVE_MALLOPT
    fprintf(stderr, "  HAVE_MALLOPT \n");
#ifdef M_GRAIN
    /* Round up all sizes to a multiple of this */
    fprintf(stderr, " M_GRAIN seti: %d\n", M_GRAIN);
    mallopt(M_GRAIN, 16);
#endif
#ifdef M_MXFAST
    /* biggest size that is considered a small block */
    fprintf(stderr, " M_MXFAST seti: %d\n", M_MXFAST);
    mallopt(M_MXFAST, 256);
#endif
#ifdef M_NBLKS
    /* allocate this many small blocks at once */
    fprintf(stderr, " M_NBLKS set: %d\n", M_NBLKS);
    mallopt(M_NLBLKS, 32);

#endif
#endif /* HAVE_MALLOPT */

/*

    oldmask = umask(S_IRWXO);

*/

    return 0;
}

compile it with cmd:
gcc -o foo -l pthread foo.c

(the simple gcc -o foo foo.c do not present the pb;
neither gcc -static -o foo -l pthread foo.c [previously it makes a segv])

Thanks for your attention,
Joel

---------------------------------
Vous surfez avec une ligne classique ? Economisez jusqu'à 25% avec Tiscali Complete ! Offre spéciale : première année d'abonnement offerte. ... Plus d'info sur http://complete.tiscali.be