[GRASS-dev] race condition on cluster: "Unable to make mapset element"

Hi,

using GRASS on a cluster, I have troubles with very fast mini-jobs run
in parallel:

ERROR: Unable to make mapset element .tmp/blade07
       (/home/neteler/grassdata/patUTM32/terra_lst1km20020730.LST_Day_1km.filt2.139412/.tmp/blade07):
       File exists

Each job is running in an own mapset and taking the process ID as part of the
mapset name. Still above problem appears.

Source:

lib/gis/mapset_msc.c
    43 /* now append element, one directory at a time, to path */
    44 while (1) {
    45 if (*element == '/' || *element == 0) {
    46 *p = 0;
    47 if (access(path, 0) != 0) { /* directory not yet created */
    48 if (G_mkdir(path) != 0)
    49 G_fatal_error(_("Unable to make mapset
element %s (%s): %s"),
    50 p_element, path,
strerror(errno));
    51 }
    52 if (access(path, 0) != 0) /* directory not
accessible */
    53 G_fatal_error(_("Unable to make mapset element
%s (%s): %s"),
    54 p_element, path,
strerror(errno));
    55 if (*element == 0)
    56 return 1;
    57 }
    58 *p++ = *element++;
    59 }
    60 }

I wonder if G_warning() wouldn't be sufficient here in the "File exists" case.
Currently G_fatal_error() simply breaks the job.

Markus

(back to old problem)

On Wed, May 27, 2009 at 10:27 PM, Markus Neteler<neteler@osgeo.org> wrote:

Hi,

using GRASS on a cluster, I have troubles with very fast mini-jobs run
in parallel:

ERROR: Unable to make mapset element .tmp/blade07
(/home/neteler/grassdata/patUTM32/terra_lst1km20020730.LST_Day_1km.filt2.139412/.tmp/blade07):
File exists

Some few jobs even fail to lauch GRASS (GRASS is launched
with a new temporary mapset here):

************ Starting job at Sat Aug 22 20:05:33 CEST 2009 *************
SGE_ROOT /opt/SGE61
The cell in which the job runs default. Got 1 slots on 1 hosts
Cleaning up temporary files ...
Starting GRASS ...
Missing WIND file fixed
ERROR: Reading data path information from g.gisenv.
GISDBASE=
LOCATION_NAME=
MAPSET=

Check the </home/neteler/.grassrc6> file.
...

While "Missing WIND file fixed" is ok since it is a new mapset, the
error I don't understand. It comes from
lib/init.sh
apparently g.gisenv refused to work.

This happens in 10-20 of 3000 jobs. Using NFS if that matters.
Any idea?

Markus