Print

Print


Jan Just Keijser wrote:

> hmmm
> readdir is crashing in a multithreaded application... shouldn't we be 
> using readdir_r and readdir64_r when using threads? I've looked at the 
> original gridmapdir patch and indeed, it lists
> 
> +void
> +gridmapdir_newlease(char *     encodedglobusidp,
> +                    char *     usernameprefix)
> +{
> +     int            ret;
> +     char           *userfilename, *encodedfilename, *gridmapdir;
> +     struct dirent  *gridmapdirentry;
> +     DIR            *gridmapdirstream;
> +     struct stat    statbuf;
> +     +     gridmapdir = getenv("GRIDMAPDIR");
> +     if (gridmapdir == NULL) return;
> +
> +     encodedfilename = malloc(strlen(gridmapdir) + (size_t) 2 + 
> +                              strlen(encodedglobusidp));
> +     sprintf(encodedfilename, "%s/%s", gridmapdir, encodedglobusidp);
> +
> +     gridmapdirstream = opendir(gridmapdir);
> +
> +     while ((gridmapdirentry = readdir(gridmapdirstream)) != NULL)
> 
> 
> which indeed, is not threadsafe...
> so this is a "sleeping" bug that can hit anybody as soon as
> - the system is under heavy load
> - the gridmapdir gets too large
> 
> how can we either
> - limit the number of threads of the network-server

In /opt/edg/etc/edg_wl.conf there are these:

MasterThreads = 8;
DispatcherThreads = 10;

You could try setting either or both of them to 1,
with subsequent performance penalties.

> - patch and recompile the vdt_globus_essentials package, with gridmapdir 
> patch

I intend to provide you with that today.