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

Markus Neteler neteler at osgeo.org
Wed May 27 16:27:10 EDT 2009


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


More information about the grass-dev mailing list