<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>I commented out the C++11 mutex in
      <meta charset="utf-8">
      <a
href="https://github.com/OSGeo/gdal/pull/164/commits/d1449e2eb5a85a6ec2520ad77ee579015fe14197#diff-e3e90e0089f1b70ddf36ebe89a73a733"
        class="link-gray-dark" title="gdal/gcore/gdaldrivermanager.cpp"
        style="box-sizing: border-box; background-color: rgb(247, 247,
        247); color: rgb(51, 51, 51) !important; text-decoration: none;
        font-family: Consolas, "Liberation Mono", Menlo,
        Courier, monospace; font-size: 12px; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        font-weight: normal; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px;">gdaldrivermanager.cpp</a> -
      this helps. OSX CI test passed successfully.</p>
    <p><a class="moz-txt-link-freetext" href="https://travis-ci.org/OSGeo/gdal/jobs/177297023">https://travis-ci.org/OSGeo/gdal/jobs/177297023</a><br>
    </p>
    <pre class="moz-signature" cols="72">Best regards,
    Dmitry</pre>
    <div class="moz-cite-prefix">19.11.16 21:24, Even Rouault пишет:<br>
    </div>
    <blockquote cite="mid:1731467.ZNQqGo50XJ@even-i700" type="cite">
      <pre wrap="">On samedi 19 novembre 2016 10:06:26 CET Kurt Schwehr wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">I'm really not sure.
</pre>
      </blockquote>
      <pre wrap="">
Not sure that the crash mentionned by Dmitry is related to that ? It looks 
like a really good canditate to me. That's the only C++11 mutex in GDAL, with 
2  other ones in the GeoTIFF driver (and those are likely not triggered at 
process termination)

</pre>
      <blockquote type="cite">
        <pre wrap="">
You can certainly try removing that C++11 mutex.  It was added based on the
comment at that point in the code.  We'll just have to keep an eye out for
possible occasional flakes.  If that's the case, we'll need to carefully
work through the logic and try to figure out a solution that works for
everything.
</pre>
      </blockquote>
      <pre wrap="">
I doubt we will see flakes related to that. The mutex was added to prevent 
races in GDALDestroyDriverManager(), but I'm not aware of code in GDAL and its 
utilities that would call it from several threads. And the function has always 
been documented as thread-unsafe.

</pre>
      <blockquote type="cite">
        <pre wrap="">
+1 for getting the driver into the tree.  It will be easier to make
additional changes to either it or GDAL with it in the same tree.

On Sat, Nov 19, 2016 at 8:49 AM, Even Rouault <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a>

wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">On samedi 19 novembre 2016 19:34:02 CET Dmitry Baryshnikov wrote:
</pre>
          <blockquote type="cite">
            <pre wrap="">Hi Even,

The big_endian test now is ok. But osx crash at the exiting of python
after all test finished successfully.

This is error message:

libc++abi.dylib: terminating with uncaught exception of type
std::__1::system_error: mutex lock failed: Invalid argument
./gdal/ci/travis/osx/script.sh: line 13: 56363 Abort trap: 6
python run_all.py

I find out that this may be the result of resources free order:
<a class="moz-txt-link-freetext" href="https://github.com/dmlc/mxnet/issues/309">https://github.com/dmlc/mxnet/issues/309</a>
<a class="moz-txt-link-freetext" href="https://github.com/google/benchmark/issues/52">https://github.com/google/benchmark/issues/52</a>

No idea why this occurred then C++11 used. I'll try to use osx CI test
disabling the CAD driver to exclude this possible issue.
</pre>
          </blockquote>
          <pre wrap="">
Hum, I think this might be indeed an issue with resource free order
between
the GDALDestroy() destructor function (in gcore/gdaldllmain.cpp) and the
static C++11 mutex Kurt introduced in
<a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/commit/a9b947d6850d496f09e668f4cd1488">https://github.com/OSGeo/gdal/commit/a9b947d6850d496f09e668f4cd1488</a>
26d45d9fa9

If this mutex gets destroyed before GDALDestroy() is called, then things
might
indeed crash.

I think we should remove this static C++11 mutex. Kurt ?

(Another option would be to remove the library destructor function. I've
the
feeling they cause more harm than good.)

--
Spatialys - Geospatial professional services
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
</pre>
        </blockquote>
      </blockquote>
      <pre wrap="">

</pre>
    </blockquote>
    <br>
  </body>
</html>