[MDEV-28580] Server crash when creating an index after adding a foreign key Created: 2022-05-16 Updated: 2023-06-21 Resolved: 2022-09-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.7.3 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Joris Guffens | Assignee: | Daniel Black |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | crash | ||
| Environment: |
docker desktop on windows |
||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
When using a newly created database, executing the following sql statements will cause a server crash.
The crash occurs when adding a foreign key, followed by the creation of an index. This happens on the same table but on different columns. The docker image was freshly pulled from Docker Hub and run on a Windows 10 computer. |
| Comments |
| Comment by Marko Mäkelä [ 2022-05-16 ] | |||||||||||||||||||||
|
mariadb-crash-1.log | |||||||||||||||||||||
| Comment by Joris Guffens [ 2022-05-16 ] | |||||||||||||||||||||
|
After some more experimenting I figured out that this only happens when a docker volume is bound to the host file system. I included the docker-compose.yml I don't think this is desired behavior. Correct me if I'm wrong. | |||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-05-16 ] | |||||||||||||||||||||
|
Side note: ADD FOREIGN KEY would avoid a table rebuild if you set foreign_key_checks=0. I think that any attempt to invoke a table rebuild on a large enough table should reproduce the same. Examples:
How large is the table? Is the file system anywhere near full? How was the data loaded in the first place? By using a data directory that was created by some other means? | |||||||||||||||||||||
| Comment by Joris Guffens [ 2022-05-16 ] | |||||||||||||||||||||
|
Windows 10 Pro 21H2, build 19044.1706 The docker-compose.yml was put in an empty directory therfore the database is completely empty.
The database is empty and the script provided in this issue creates new tables and then modifies them causing the crash. Because running the container with a dedicated volume solves the problem, this might be a Docker issue. | |||||||||||||||||||||
| Comment by Alice Sherepa [ 2022-05-16 ] | |||||||||||||||||||||
|
https://stackoverflow.com/questions/70784437/innodb-preallocating-147456-bytes-for-file-xxx-ibd-failed-with-error-2 | |||||||||||||||||||||
| Comment by Daniel Black [ 2022-05-18 ] | |||||||||||||||||||||
|
jorisguffens, are you able to make the trace recordings described in: docker library issue 403? | |||||||||||||||||||||
| Comment by Joris Guffens [ 2022-05-18 ] | |||||||||||||||||||||
|
mariadb.strace | |||||||||||||||||||||
| Comment by Daniel Black [ 2022-05-18 ] | |||||||||||||||||||||
|
Apologizes I missed a -f option in strace to trace all the threads. With there would be a fallocate call. In your procmon log can you see what the fallocate linux system calls get translated to in windows and their results? The surrounding system calls related to the same file handles would be useful too. | |||||||||||||||||||||
| Comment by Joris Guffens [ 2022-05-19 ] | |||||||||||||||||||||
|
mariadb.strace
Logfile3.PML | |||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-05-20 ] | |||||||||||||||||||||
|
InnoDB should handle EOPNOTSUPP from fallocate() for quite some time now, and fall back to extending the file by writes. I think that | |||||||||||||||||||||
| Comment by Daniel Black [ 2022-05-20 ] | |||||||||||||||||||||
|
WSL I think is providing a kernel interface. The glibc interface within the container is the raw ubuntu-20.04 glibc provided by the base container image of mariadb:10.7. On mariadb-1.strace pwrite based fallback after fallocate fails seem to be working. Line:
In the strace there is no closing of file descriptor 50. So its looking like fstat on an open file descriptor is loosing track of the file because it was renamed earlier. jorisguffens if you could provide the info from the template bug report related to wsl information and kernel information. I haven't looked though the PML file yet. My quick look so far can't see a WSL bug on this. I'm happy to write WSL bug using the provide information and I'll search again just to be sure first. | |||||||||||||||||||||
| Comment by Joris Guffens [ 2022-05-20 ] | |||||||||||||||||||||
|
The information you requested: While looking for your information I noticed my wsl kernel was quite a few versions behind (5.4.72). I updated and I was still able to reproduce this issue with the latest kernel. | |||||||||||||||||||||
| Comment by Daniel Black [ 2022-05-25 ] | |||||||||||||||||||||
|
WSL bug 8443 lodged. | |||||||||||||||||||||
| Comment by Daniel Black [ 2022-07-11 ] | |||||||||||||||||||||
|
FYI I've implemented an attempted workaround (10.3) based. This is available as quay.io/mariadb-foundation/mariadb-devel:10.3-mdev-29015-avoid-wsl8443. If you are able to test this to see if it crashes in a Windows WSL environment that would be appreciated. If it fails for some reason, can you perform a strace on the test case like the instructions above. | |||||||||||||||||||||
| Comment by Daniel Black [ 2022-07-25 ] | |||||||||||||||||||||
|
I retested on Windows 10 - 19044.1826 and was unable to reproduce this. I also tested on Windows 11 22000.795 and couldn't reproduce it there either. Can you please retest if your Windows updates resolve this. |