[MDEV-16015] Unhandled EOPNOTSUPP of posix_fallocate() causes bogus "Probably out of disk space error" Created: 2018-04-25 Updated: 2022-02-20 Resolved: 2021-01-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.1.32, 10.2.14 |
| Fix Version/s: | 10.1.48, 10.2.35, 10.3.26, 10.4.16, 10.5.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Chingis | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 10 |
| Labels: | docker | ||
| Environment: |
Docker for Mac, Docker for Win |
||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
I'm not sure whether you're aware of this issue experienced by docker users: https://github.com/docker-library/mariadb/issues/95 When you start latest stable MariaDB with Docker for Mac/Win and /var/lib/mysql mounted from the host machine it fails with error:
As noted by tianon in the github issue:
Also, it worth saying that older MariaDB versions work fine, for example 10.1.22 Docker images where the problem happens:
|
| Comments |
| Comment by Chingis [ 2018-05-28 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Could you please give any feedback on this issue. Thank you. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-05-28 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Ever since | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2018-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Does it mean it's not a docker-related issue and InnoDB doesn't work on Windows/Mac? Can you advise a workaround? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-06-06 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The fix of | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2018-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Yes, 10.1.22, 10.1.28, 10.2.9 work fine. I've tested with two images: debian-based and alpine-based. I've noticed that (it seems) all versions of debian-based 10.2 work fine but not alpine-based. In the output of the debian-based image I've noticed `binary distribution`, may that's the reason. This is how I run latest 10.2.15:
The latter gives:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2018-06-19 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Just released MariaDB 10.1.34 works fine with bind mounts | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2018-07-04 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Any news about this issue? 10.2.16 and 10.3.8 seem do not have this fix for InnoDB. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2018-08-17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Could you share your point on this issue? Do you have any plans to fix this or this is a by design behaviour that won't be changed? 10.2.17 and 10.3.9 still have no fix for that. Or maybe you can recommend a workaround. This issue prevents many people from upgrading to 10.2/10.3. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2018-08-20 ] | ||||||||||||||||||||||||||||||||||||||||||
|
At the moment there are no plans to reject it as a "design behaviour that won't be changed". So you can presume that it will be fixed. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Henrik Uggla [ 2018-08-21 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I have the same problem on Linux when I mount an NFS share (v3) on the host and use that as data dir for the Mariadb container. My docker image is based on Alpine and runs Mariadb 10.3.9. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-09-05 ] | ||||||||||||||||||||||||||||||||||||||||||
|
cvicentiu is experienced with Docker and has access to an environment where this could be repeated. I hope that some strace output can be extracted. It should be a rather simple fix, once we know which operation is failing and how. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by David Thompson (Inactive) [ 2018-10-06 ] | ||||||||||||||||||||||||||||||||||||||||||
|
A workaround from the original community image github issue is to add this argument: --innodb-flush-method=fsync. So it's clearly tied up in the use of linux os commands that assume linux filesystems but in this case docker is federating access to a windows filesystem, because of it being a host volume. This also reproduces using the docker for windows kubernetes front end running a mariadb container. Named volumes are ok because they are actually hosted and managed in the mobylinux vm. I believe this should also happen on mac as well. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Henrik Uggla [ 2018-10-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The workaround doesn't work for me, I still get "[ERROR] InnoDB: preallocating 12582912 bytes for file ./ibdata1 failed with error 95" when I run my Docker image with datadir on NFS-share. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2018-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The issue still persists with 10.2.19 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alex Athanasopoulos [ 2018-12-09 ] | ||||||||||||||||||||||||||||||||||||||||||
|
mariadb 10.2.15 on LXD: | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alex Simonenko [ 2018-12-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Some strace output:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alex Athanasopoulos [ 2018-12-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
fallocate() is not supported on all filesystems. It does not seem to be supported on ZFS, but it is supported on BTRFS. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Charlie Garrison [ 2018-12-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Just adding another data point... I see the same problem/symptoms when running MariaDB on Alpine Linux 3.8 on an AWS EC2 instance. The problem does NOT manifest running on Alpine Linux 3.8 in a VirtualBox VM. Is there any testing I can do to help isolate the issue? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Younes Ichiche [ 2018-12-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I got the same issue when I did want to upgrade to 10.2 version on alpine. Not affected: Affected versions: command:
Stderr:
stdout:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Kam [ 2019-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This issue hast started after upgrading from mariadb 10.2 to 10.3. Mariadb now is using native Linux fallocate for creating the ibdata file (punch a hole of xxMB) 2018-06-29 19:11:12 140013615233928 [ERROR] InnoDB: preallocating 12582912 bytes for file ./ibdata1 failed with error 95 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by JLamon [ 2019-07-16 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I see this issue when using maria-db 10.2.x branch with the, alpine 3.8 docker image and attempting to use a nfs4 mounted aws elastic file system to host the mysql data files. Using either the local bind mount or a volume plugin. The work around, as for others, is to use the maria-db 10.1.x branch with alpine 3.7 docker image. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Kam [ 2019-09-03 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I guess, this bug is not going to be fixed anytime soon, as it is open for years now. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-09-03 ] | ||||||||||||||||||||||||||||||||||||||||||
|
InnoDB should be using the posix_fallocate() wrapper function, which should fall back to write() if fallocate() does not work. Now that there is a confirmation that this problem can be repeated outside Docker for Mac or Windows, it should be easier for an InnoDB developer to fix this. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2020-04-30 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Any updates on this issue? Can you maybe advise some workaround? There's a couple of solutions suggested in https://github.com/docker-library/mariadb/issues/95 (changing flush method) but none of them work for the alpine-based image (wodby/mariadb). | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Kam [ 2020-08-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Similar isuues: | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Blake Willis [ 2020-09-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This is not an issue on FreeBSD w/ZFS as MariaDB does not assume it can use Linux's native fallocate(). Up until MariaDB 10.2.5, we could turn off innodb_use_fallocate to mitigate this "Linuxism", but that knob has been deprecated, making this a blocking issue. It seems that the easy fix here would be to provide a knob to force posix_fallocate on Linux (if fallback to posix_fallocate can't be implemented automatically). BTW the issue is generally applicable to copy-on-write filesystems, not just ZFS: https://github.com/openzfs/zfs/issues/326#issuecomment-540162402 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Kam [ 2020-09-09 ] | ||||||||||||||||||||||||||||||||||||||||||
|
@Blake Willis | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Kam [ 2020-09-09 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I realize "Probably out of disk space" is gaining in search engines popularity and becomes a powerful clickbait.
How about putting back that depreciated 'knob' in place as fallback whenever fallocate fails/missing? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Blake Willis [ 2020-09-22 ] | ||||||||||||||||||||||||||||||||||||||||||
|
BTW I was able to work around (as opposed to mitigate) this issue by switching the application's database engine to Aria (with TRANSACTIONAL writes) & disabling InnoDB (& turning off NO_ENGINE_SUBSTITUTION). This is not a great solution & certainly won't work for every application (especially those needing full ACID that InnoDB provides), but for simple applications with non-critical data it works. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-01-04 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Was this bug fixed in MariaDB 10.1.48, 10.2.35, 10.3.26, 10.4.16, 10.5.7 by MariaDB Pull Request #1658 a.k.a. adding fall-back logic for the code EOPNOTSUPP? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2021-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Hi Marko , I confirm the issue is fixed I was able to reproduce the issue with pure alpine images alpine:latest docker run --name=test-alpine..db.container.0002 --label=com.opensvc.id=a7beae62-2db6-4e6b-b468-d52f079e220e.container#0002 --net=container:test-alpine..db.container.0001 --volume=/etc/localtime:/etc/localtime:ro --volume=/srv/test-alpine-db/pod01:/data --cgroup-parent /opensvc.slice/test-alpine.slice/db.slice/container.slice/container.0002.slice busybox / # apk-update /bin/ash: apk-update: not found / # apk update fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz v3.12.3-54-gc2a303485f http://dl-cdn.alpinelinux.org/alpine/v3.12/main v3.12.3-54-gc2a303485f http://dl-cdn.alpinelinux.org/alpine/v3.12/community OK: 12746 distinct packages available / # apk add mariadb (1/11) Installing mariadb-common (10.4.15-r0) (2/11) Installing libaio (0.3.112-r1) (3/11) Installing xz-libs (5.2.5-r0) (4/11) Installing ncurses-terminfo-base (6.2_p20200523-r0) (5/11) Installing ncurses-libs (6.2_p20200523-r0) (6/11) Installing linux-pam (1.3.1-r4) (7/11) Installing pcre (8.44-r0) (8/11) Installing libgcc (9.3.0-r2) (9/11) Installing libstdc++ (9.3.0-r2) (10/11) Installing libxml2 (2.9.10-r5) (11/11) Installing mariadb (10.4.15-r0) Executing mariadb-10.4.15-r0.pre-install Executing busybox-1.31.1-r19.trigger OK: 137 MiB in 25 packages / # mysql_install_db --datadir=/mnt Installing MariaDB/MySQL system tables in '/mnt' ... 2021-01-13 10:58:06 0 [ERROR] InnoDB: preallocating 12582912 bytes for file ./ibdata1 failed with error 95 2021-01-13 10:58:06 0 [ERROR] InnoDB: Could not set the file size of './ibdata1'. Probably out of disk space 2021-01-13 10:58:06 0 [ERROR] InnoDB: Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again. 2021-01-13 10:58:07 0 [ERROR] Plugin 'InnoDB' init function returned error. 2021-01-13 10:58:07 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2021-01-13 10:58:07 0 [ERROR] Unknown/unsupported storage engine: InnoDB 2021-01-13 10:58:07 0 [ERROR] Aborting and than the issue was fixed within alpine:edge: docker run -i -t -e MYSQL_ROOT_PASSWORD=mariadb -e MYSQL_INITDB_SKIP_TZINFO=yes --detach --name=test-alpine..db.container.2001 --label=com.opensvc.id=a7beae62-2db6-4e6b-b468-d52f079e220e.container#2001 --net=container:test-alpine..db.container.0001 --volume=/etc/localtime:/etc/localtime:ro --volume=/srv/test-alpine-db/pod01:/mnt --cgroup-parent /opensvc.slice/test-alpine.slice/db.slice/container.slice/container.2001.slice alpine:edge ash s18-fr-1.db.container#2001 command successful but stderr: s18-fr-1.db.container#2001 Unable to find image 'alpine:edge' locally s18-fr-1.db.container#2001 edge: Pulling from library/alpine s18-fr-1.db.container#2001 69d5f65ddb5e: Pulling fs layer s18-fr-1.db.container#2001 69d5f65ddb5e: Verifying Checksum s18-fr-1.db.container#2001 69d5f65ddb5e: Download complete s18-fr-1.db.container#2001 69d5f65ddb5e: Pull complete s18-fr-1.db.container#2001 Digest: sha256:56e8a54633573bc40a003884a01e60fb31d070d05e220d244e88ca1c4b5815fa s18-fr-1.db.container#2001 Status: Downloaded newer image for alpine:edge s18-fr-1.db.container#2001 output: s18-fr-1.db.container#2001 f952c267787884ed99fd6585e7c5462d23e368d42b76b43f8fd0af189c3661e5 s18-fr-1.db.container#2001 wait for up status s18-fr-1.db.container#2001 wait for container operational root@s18-fr-1:~# om test-alpine/svc/db docker exec -it {2001} /bin/ash To start mysqld at boot time you have to copy Two all-privilege accounts were created. See the MariaDB Knowledgebase at https://mariadb.com/kb or the You can start the MariaDB daemon with: You can test the MariaDB daemon with mysql-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. / # ls /mnt/ | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
stephane@skysql.com, thank you for confirming that this was fixed. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2021-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I still can reproduce this issue with alpine-based compiled mariadb image (10.5.8) (wodby/mariadb) on docker for mac (3.0.3, docker 20.10.0) with a bind mount:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
chingis, can you also reproduce this on Docker for Windows? I am reassigning this to cvicentiu, who should be able to diagnose this. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2021-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
For docker images not using standard glibc , Windows and OSX have special emmulation that may be posix_fallocate is not supported at all do not even return EOPNOTSUPP, from the code it's worth testing if innodb_use_trim=ON could be a workaround because it use ftruncate before fallocate | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
According to | ||||||||||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2021-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
can it be reproduce with innodb_compression_default=1 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Bychko (Inactive) [ 2021-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
tried to reproduce it on Mac, but without any success. images used: command used: MacOS 11.1 Big Sur | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
stephane@skysql.com, thank you for trying to help, but I do not think that we allow the system tablespace to be a sparse file (page_compressed tables can only be created in .ibd files). abychko, thank you for confirming that this works for your Docker for Mac. We did not verify the fix on Docker for Windows. I believe that the missing handling for the EOPNOTSUPP error code (which is 95 in GNU/Linux) in posix_fallocate() caused the original reported failure. chingis, for any remaining problem, please file a separate ticket with the exact symptoms. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Chingis [ 2021-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
It seems the issue is really fixed. The reason it didn't start for me is because I used a bind mount from `/tmp` on macOS, which is a symlink to `/private/tmp`. It works, if you pre-create a directory under `/tmp/` but if it doesn't exists it fails. And it works fine regardless of whether it's pre-created or not for all other non-symlink directories. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Thank you, chingis! |