<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Javier,</p>
    <p>we don't explicitly write temporary files, but sqlite3 can decide
      to do so (typically for a "heavy" request like listing all CRS
      with an order clause in it).
      <a class="moz-txt-link-freetext" href="https://sqlite.org/c3ref/temp_directory.html">https://sqlite.org/c3ref/temp_directory.html</a> mentions "SQLite
      performs a search for an appropriate
      temporary file directory.".   Not very helpful. Source code at
<a class="moz-txt-link-freetext" href="https://github.com/sqlite/sqlite/blob/da67225f04ad0470b54433fee31baf266e6630ef/src/os_unix.c#L6262">https://github.com/sqlite/sqlite/blob/da67225f04ad0470b54433fee31baf266e6630ef/src/os_unix.c#L6262</a>
      shows it tries in that order (for Unix systems): SQLITE_TMPDIR env
      var, TMPDIR env var, /var/tmp, /usr/tmp, /tmp and "."</p>
    <p>For the embed proj.db, we have
      <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/PROJ/blob/master/src/memvfs.c#L300">https://github.com/OSGeo/PROJ/blob/master/src/memvfs.c#L300</a>  ,
      which basically redirects to the above logic</p>
    <p>Even </p>
    <div class="moz-cite-prefix">Le 24/02/2026 à 16:34, Javier Jimenez
      Shaw via PROJ a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CADRrdKsc-7L916OH8PCDqC5sC9hsFcwB4o1S35uzwHQyLFwf6A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi</div>
        <div><br>
        </div>
        <div>We are having problems with sqlite3 and disk while running
          on iOS. It happens only from time to time. Restarting the
          application is usually enough.</div>
        <div><br>
        </div>
        <div>The first case returns an sqlite3 error 13: "database or
          disk is full" <a href="https://sqlite.org/rescode.html#full"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://sqlite.org/rescode.html#full</a></div>
        <div>This is the message (trimmed)</div>
        <div>
          <pre role="code">Fatal Exception: <a class="moz-txt-link-freetext" href="osgeo::proj::io::FactoryException">osgeo::proj::io::FactoryException</a>
SQLite error [ code = 13, msg = database or disk is full ] on SELECT * FROM (SELECT 
c.auth_name, c.code, <a href="http://c.name" moz-do-not-send="true">c.name</a>, c.type, c.deprecated, a.west_lon, a.south_lat, a.east_lon, 
a.north_lat, a.description, NULL, <a href="http://cb.name"
          moz-do-not-send="true">cb.name</a> FROM geodetic_crs c LEFT JOIN usage u ON 
u.object_table_name = 'geodetic_crs'...

</pre>
          And this is the stack trace
          <pre role="code">8  libc++abi.dylib 0x11bdc <a class="moz-txt-link-freetext" href="std::__terminate(void">std::__terminate(void</a> (*)()) + 16
9  libc++abi.dylib 0x15314 __cxa_get_exception_ptr + 86
10 libc++abi.dylib 0x152bc __<a class="moz-txt-link-freetext" href="cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)">cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)</a> + 90
11 proj 0x168434 <a class="moz-txt-link-freetext" href="osgeo::proj::io::SQLiteHandle::run(sqlite3_stmt*">osgeo::proj::io::SQLiteHandle::run(sqlite3_stmt*</a>, <a class="moz-txt-link-freetext" href="std::__1::basic_string">std::__1::basic_string</a><char, <a class="moz-txt-link-freetext" href="std::__1::char_traits">std::__1::char_traits</a><char>, <a class="moz-txt-link-freetext" href="std::__1::allocator">std::__1::allocator</a><char>> const&, <a class="moz-txt-link-freetext" href="std::__1::list">std::__1::list</a><<a class="moz-txt-link-freetext" href="osgeo::proj::io::SQLValues">osgeo::proj::io::SQLValues</a>, <a class="moz-txt-link-freetext" href="std::__1::allocator">std::__1::allocator</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::SQLValues"><osgeo::proj::io::SQLValues></a>> const&, bool) + 1468
12 proj 0x16a6e8 <a class="moz-txt-link-freetext" href="osgeo::proj::io::DatabaseContext::Private::run(std::__1::basic_string">osgeo::proj::io::DatabaseContext::Private::run(std::__1::basic_string</a><char, <a class="moz-txt-link-freetext" href="std::__1::char_traits">std::__1::char_traits</a><char>, <a class="moz-txt-link-freetext" href="std::__1::allocator">std::__1::allocator</a><char>> const&, <a class="moz-txt-link-freetext" href="std::__1::list">std::__1::list</a><<a class="moz-txt-link-freetext" href="osgeo::proj::io::SQLValues">osgeo::proj::io::SQLValues</a>, <a class="moz-txt-link-freetext" href="std::__1::allocator">std::__1::allocator</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::SQLValues"><osgeo::proj::io::SQLValues></a>> const&, bool) + 1220
13 proj 0x1ad76c <a class="moz-txt-link-freetext" href="osgeo::proj::io::AuthorityFactory::getCRSInfoList()">osgeo::proj::io::AuthorityFactory::getCRSInfoList()</a> const + 2332
...</pre>
          <br>
        </div>
        <div>There is another similar (but different) issue with error
          10: "disk I/O error" <a
            href="https://sqlite.org/rescode.html#ioerr"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://sqlite.org/rescode.html#ioerr</a></div>
        <div>
          <pre role="code">Fatal Exception: <a class="moz-txt-link-freetext" href="osgeo::proj::io::FactoryException">osgeo::proj::io::FactoryException</a>
SQLite error [ code = 10, msg = disk I/O error ] on SELECT name FROM "geodetic_datum" WHERE auth_name = ? AND code = ?
</pre>
          <br>
        </div>
        <div>Stack trace</div>
        <div><br>
        </div>
        <div>
          <pre class="gmail-ndfHFb-c4YZDc-fmcmS-DARUcf"
style="font-feature-settings:"liga" 0;font-variant-ligatures:no-contextual;font-family:"Courier New",Courier,monospace,arial,sans-serif;background:rgb(255,255,255);border:0px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;display:block;line-height:normal;white-space:pre-wrap;color:rgb(0,0,0);font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span
          style="font-family:monospace"><font size="2">9  libc++abi.dylib 0x11b80 <a class="moz-txt-link-freetext" href="std::terminate()">std::terminate()</a> + 108</font></span></pre>
        </div>
        <div>
          <pre class="gmail-ndfHFb-c4YZDc-fmcmS-DARUcf"
style="font-feature-settings:"liga" 0;font-variant-ligatures:no-contextual;font-family:"Courier New",Courier,monospace,arial,sans-serif;background:rgb(255,255,255);border:0px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;display:block;line-height:normal;white-space:pre-wrap;color:rgb(0,0,0);font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span
          style="font-family:monospace"><font size="2">10 proj 0x8270 __clang_call_terminate + 14</font></span>
<span style="font-family:monospace"><font size="2">11 proj 0xad1e8 <a class="moz-txt-link-freetext" href="osgeo::proj::common::IdentifiedObject::_isEquivalentTo(osgeo::proj::common::IdentifiedObject">osgeo::proj::common::IdentifiedObject::_isEquivalentTo(osgeo::proj::common::IdentifiedObject</a> const*, <a class="moz-txt-link-freetext" href="osgeo::proj::util::IComparable::Criterion">osgeo::proj::util::IComparable::Criterion</a>, <a class="moz-txt-link-freetext" href="std::__1::shared_ptr">std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::DatabaseContext"><osgeo::proj::io::DatabaseContext></a> const&) const + 234
12 proj 0xe82f4 <a class="moz-txt-link-freetext" href="osgeo::proj::datum::Datum::_isEquivalentTo(osgeo::proj::util::IComparable">osgeo::proj::datum::Datum::_isEquivalentTo(osgeo::proj::util::IComparable</a> const*, <a class="moz-txt-link-freetext" href="osgeo::proj::util::IComparable::Criterion">osgeo::proj::util::IComparable::Criterion</a>, <a class="moz-txt-link-freetext" href="std::__1::shared_ptr">std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::DatabaseContext"><osgeo::proj::io::DatabaseContext></a> const&) const + 100
13 proj 0xed7ac <a class="moz-txt-link-freetext" href="osgeo::proj::datum::GeodeticReferenceFrame::isEquivalentToNoExactTypeCheck(osgeo::proj::util::IComparable">osgeo::proj::datum::GeodeticReferenceFrame::isEquivalentToNoExactTypeCheck(osgeo::proj::util::IComparable</a> const*, <a class="moz-txt-link-freetext" href="osgeo::proj::util::IComparable::Criterion">osgeo::proj::util::IComparable::Criterion</a>, <a class="moz-txt-link-freetext" href="std::__1::shared_ptr">std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::DatabaseContext"><osgeo::proj::io::DatabaseContext></a> const&) const + 96
14 proj 0xc0774 <a class="moz-txt-link-freetext" href="osgeo::proj::crs::SingleCRS::baseIsEquivalentTo(osgeo::proj::util::IComparable">osgeo::proj::crs::SingleCRS::baseIsEquivalentTo(osgeo::proj::util::IComparable</a> const*, <a class="moz-txt-link-freetext" href="osgeo::proj::util::IComparable::Criterion">osgeo::proj::util::IComparable::Criterion</a>, <a class="moz-txt-link-freetext" href="std::__1::shared_ptr">std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::DatabaseContext"><osgeo::proj::io::DatabaseContext></a> const&) const + 456
15 proj 0xc8eb0 <a class="moz-txt-link-freetext" href="osgeo::proj::crs::GeographicCRS::_isEquivalentTo(osgeo::proj::util::IComparable">osgeo::proj::crs::GeographicCRS::_isEquivalentTo(osgeo::proj::util::IComparable</a> const*, <a class="moz-txt-link-freetext" href="osgeo::proj::util::IComparable::Criterion">osgeo::proj::util::IComparable::Criterion</a>, <a class="moz-txt-link-freetext" href="std::__1::shared_ptr">std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::DatabaseContext"><osgeo::proj::io::DatabaseContext></a> const&) const + 172
16 proj 0xc627c <a class="moz-txt-link-freetext" href="osgeo::proj::crs::GeodeticCRS::identify(std::__1::shared_ptr">osgeo::proj::crs::GeodeticCRS::identify(std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::AuthorityFactory"><osgeo::proj::io::AuthorityFactory></a> const&) const + 724
17 proj 0xd072c <a class="moz-txt-link-freetext" href="osgeo::proj::crs::ProjectedCRS::identify(std::__1::shared_ptr">osgeo::proj::crs::ProjectedCRS::identify(std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::AuthorityFactory"><osgeo::proj::io::AuthorityFactory></a> const&) const + 1184
18 proj 0xd4028 <a class="moz-txt-link-freetext" href="osgeo::proj::crs::ProjectedCRS::_identify(std::__1::shared_ptr">osgeo::proj::crs::ProjectedCRS::_identify(std::__1::shared_ptr</a><a class="moz-txt-link-rfc2396E" href="osgeo::proj::io::AuthorityFactory"><osgeo::proj::io::AuthorityFactory></a> const&) const + 44
...</font></span></pre>
          <br>
        </div>
        <div>Are we writing anything to disk at runtime related to
          sqlite3? Even a temporary file? Where?</div>
        <div>If yes, would this problem be fixed if we embed proj.db in
          the library? Currently we are using it as an external file.</div>
        <div><br>
        </div>
        <div>My only guess would be that sqlite3 is creating a temporary
          file in a folder with very little space (like /tmp), because
          the phone should have a lot of free space for normal storage.</div>
        <div><br>
        </div>
        <div>Thank you</div>
        <div>Javier.</div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre wrap="" class="moz-quote-pre">_______________________________________________
PROJ mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PROJ@lists.osgeo.org">PROJ@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/proj">https://lists.osgeo.org/mailman/listinfo/proj</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>