Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some mbtiles tool operations produce db or disk/machine out of space errors #1154

Open
nyurik opened this issue Jan 26, 2024 · 3 comments
Open

Comments

@nyurik
Copy link
Member

nyurik commented Jan 26, 2024

The "database or disk/machine out of space" error seems to be coming from SQLite, and has not yet been reliably reproduced. It is known that there is plenty of both RAM and harddisk space (maybe some small temporary partition is being used? needs investigation).

This has been seen when using

  • mbtiles validate on arm64
  • mbtiles copy on x64

Reported error:

(code: 13) database or disk is full
nyurik added a commit that referenced this issue Jan 28, 2024
Require SQLite v3.44+ ORDER BY clause inside aggregate function instead
of the windowing one - might solve out of memory issues reported by
users - see #1154
@nyurik
Copy link
Member Author

nyurik commented Jan 29, 2024

This might have been by #1156, but since we have no reliable way to reproduce, will keep this open for a bit

@nyurik
Copy link
Member Author

nyurik commented Jan 31, 2024

It seems this issue is caused by SQLite using /tmp directory which on some machines uses a different mounted partition, which may be significantly smaller. Per https://www.sqlite.org/tempfiles.html , the best way to fix this might actually be to set the SQLITE_TMPDIR env var to point elsewhere, which is obviously outside of mbtiles control. I will add this to documentation though.

@nyurik
Copy link
Member Author

nyurik commented Feb 1, 2024

Confirmed that I can reproduce it with the latest martin docker image. See also SQLite docs temp files - /var/tmp would be the first temp dir pick for SQLite here.

# Create a docker volume with a limited size, e.g. 1MB
docker volume create  --driver local  --opt type=tmpfs  --opt device=tmpfs  --opt o=size=1m  tmp

# Run martin container, mounting tmp volume as the SQLite's choice for a tmp dir (see link above)
# This command must run in a directory that contains some multi-megabyte mbtiles file
docker run --rm -it --mount source=tmp,target=/var/tmp -v $PWD:/data --entrypoint sh ghcr.io/maplibre/martin:latest

# Inside docker, run validation command using your data file:
mbtiles validate /data/my_data_file.mbtiles

Result:

[INFO ] Quick integrity check passed for /data/my_data_file.mbtiles
[INFO ] All values in the `tiles` table/view are valid for /data/my_data_file.mbtiles
[INFO ] All tile hashes are valid for /data/my_data_file.mbtiles
[ERROR] error returned from database: (code: 13) database or disk is full

Make sure to delete tmp volume once done with docker volume rm tmp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant