<div dir="ltr"><div>Thank you Even. It was very helpful.</div><div>We will try to monitor those locations and their free space.</div><div>FYI, this was the what I wanted to diagnose with the PR <a href="https://github.com/OSGeo/PROJ/pull/4553">https://github.com/OSGeo/PROJ/pull/4553</a> ... and it worked! (the diagnostic of the error message).</div><div><br></div><div>Cheers</div><div>Javier</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, 24 Feb 2026 at 16:49, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
    
  
  <div>
    <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 href="https://sqlite.org/c3ref/temp_directory.html" target="_blank">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 href="https://github.com/sqlite/sqlite/blob/da67225f04ad0470b54433fee31baf266e6630ef/src/os_unix.c#L6262" target="_blank">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 href="https://github.com/OSGeo/PROJ/blob/master/src/memvfs.c#L300" target="_blank">https://github.com/OSGeo/PROJ/blob/master/src/memvfs.c#L300</a>  ,
      which basically redirects to the above logic</p>
    <p>Even </p>
    <div>Le 24/02/2026 à 16:34, Javier Jimenez
      Shaw via PROJ a écrit :<br>
    </div>
    <blockquote type="cite">
      
      <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" target="_blank">https://sqlite.org/rescode.html#full</a></div>
        <div>This is the message (trimmed)</div>
        <div>
          <pre role="code">Fatal Exception: <a>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" target="_blank">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" target="_blank">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>std::__terminate(void</a> (*)()) + 16
9  libc++abi.dylib 0x15314 __cxa_get_exception_ptr + 86
10 libc++abi.dylib 0x152bc __<a>cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)</a> + 90
11 proj 0x168434 <a>osgeo::proj::io::SQLiteHandle::run(sqlite3_stmt*</a>, <a>std::__1::basic_string</a><char, <a>std::__1::char_traits</a><char>, <a>std::__1::allocator</a><char>> const&, <a>std::__1::list</a><<a>osgeo::proj::io::SQLValues</a>, <a>std::__1::allocator</a><a><osgeo::proj::io::SQLValues></a>> const&, bool) + 1468
12 proj 0x16a6e8 <a>osgeo::proj::io::DatabaseContext::Private::run(std::__1::basic_string</a><char, <a>std::__1::char_traits</a><char>, <a>std::__1::allocator</a><char>> const&, <a>std::__1::list</a><<a>osgeo::proj::io::SQLValues</a>, <a>std::__1::allocator</a><a><osgeo::proj::io::SQLValues></a>> const&, bool) + 1220
13 proj 0x1ad76c <a>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" target="_blank">https://sqlite.org/rescode.html#ioerr</a></div>
        <div>
          <pre role="code">Fatal Exception: <a>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 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>std::terminate()</a> + 108</font></span></pre>
        </div>
        <div>
          <pre 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>osgeo::proj::common::IdentifiedObject::_isEquivalentTo(osgeo::proj::common::IdentifiedObject</a> const*, <a>osgeo::proj::util::IComparable::Criterion</a>, <a>std::__1::shared_ptr</a><a><osgeo::proj::io::DatabaseContext></a> const&) const + 234
12 proj 0xe82f4 <a>osgeo::proj::datum::Datum::_isEquivalentTo(osgeo::proj::util::IComparable</a> const*, <a>osgeo::proj::util::IComparable::Criterion</a>, <a>std::__1::shared_ptr</a><a><osgeo::proj::io::DatabaseContext></a> const&) const + 100
13 proj 0xed7ac <a>osgeo::proj::datum::GeodeticReferenceFrame::isEquivalentToNoExactTypeCheck(osgeo::proj::util::IComparable</a> const*, <a>osgeo::proj::util::IComparable::Criterion</a>, <a>std::__1::shared_ptr</a><a><osgeo::proj::io::DatabaseContext></a> const&) const + 96
14 proj 0xc0774 <a>osgeo::proj::crs::SingleCRS::baseIsEquivalentTo(osgeo::proj::util::IComparable</a> const*, <a>osgeo::proj::util::IComparable::Criterion</a>, <a>std::__1::shared_ptr</a><a><osgeo::proj::io::DatabaseContext></a> const&) const + 456
15 proj 0xc8eb0 <a>osgeo::proj::crs::GeographicCRS::_isEquivalentTo(osgeo::proj::util::IComparable</a> const*, <a>osgeo::proj::util::IComparable::Criterion</a>, <a>std::__1::shared_ptr</a><a><osgeo::proj::io::DatabaseContext></a> const&) const + 172
16 proj 0xc627c <a>osgeo::proj::crs::GeodeticCRS::identify(std::__1::shared_ptr</a><a><osgeo::proj::io::AuthorityFactory></a> const&) const + 724
17 proj 0xd072c <a>osgeo::proj::crs::ProjectedCRS::identify(std::__1::shared_ptr</a><a><osgeo::proj::io::AuthorityFactory></a> const&) const + 1184
18 proj 0xd4028 <a>osgeo::proj::crs::ProjectedCRS::_identify(std::__1::shared_ptr</a><a><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></fieldset>
      <pre>_______________________________________________
PROJ mailing list
<a href="mailto:PROJ@lists.osgeo.org" target="_blank">PROJ@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/proj" target="_blank">https://lists.osgeo.org/mailman/listinfo/proj</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </div>

</blockquote></div>