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

MySQL server has gone away in Windows #403

Closed
neoacevedo opened this issue Dec 11, 2021 · 7 comments
Closed

MySQL server has gone away in Windows #403

neoacevedo opened this issue Dec 11, 2021 · 7 comments
Assignees
Labels
need feedback Need feedback from user.

Comments

@neoacevedo
Copy link

I have webdevops/php-apache-dev:8.0 and latest mariadb images docker, running in Windows.

My issue: when I run a Laravel or Yii2 migration via console (docker exec -ti php-container php artisan migrate for Laravel, docker exec -ti php-container php yii migrate for Yii2), I always get in error MySQL server has gone away, but it happens only when my docker images are in Windows, but if I run the same docker-compose file in Linux, it runs the commands without any issue.

@grooverdan
Copy link
Member

Can you show the logs for the mariadb container? If its a crash or similar can you try the container quay.io/mariadb-foundation/mariadb-debug using the same major version tag as your maridab container. Its logs should be a little more verbose.

@grooverdan grooverdan self-assigned this Dec 13, 2021
@grooverdan grooverdan added the need feedback Need feedback from user. label Dec 13, 2021
@neoacevedo
Copy link
Author

These are the container logs.

Some what I have noticed is a common error for some tables: [ERROR] InnoDB: preallocating 163840 bytes for file ./smart/<table>.ibd failed with error (...) , and when the migration tries to create any index sometimes the process is locked and after a while it continues, another times I get the error MySQL server has gone away, where it creates the table but not else any index apart of the primary key.

log.txt
log (2).txt

@neoacevedo
Copy link
Author

neoacevedo commented Dec 13, 2021

Installed quay.io/mariadb-foundation/mariadb-debug:10.6 (I'm sorry, only screenshots this time):

Screenshot 1

imagen

Screenshot 2

imagen

Screenshot 3

imagen

Screenshot 4

imagen

Screenshot 5

imagen

EXTRA
By the way, in Windows 11 I have pointed /var/lib/mysql to my local directory C:\Users\USUARIO\Documents\mariadb. In Linux, the same directory is in /home/user/mariadb.

@grooverdan
Copy link
Member

grooverdan commented Dec 13, 2021

Starting with the error code:

$ podman run --rm mariadb:10.6 perror 2
OS error code   2:  No such file or directory

$ errno 2
ENOENT 2 No such file or directory

The preallocation that linux uses is posix_fallocate which even looking at the manual page:

  • takes an open file descriptor as an argument
  • not documented to return ENOENT

If we look at the first, we see that with an open file descriptor it should already refer to a file, and therefore denying its existance in an error message is quite odd.

Because this is Windows I'm assuming its a WSL version? I'm suspecting something similar to #331 / MDEV-24189, a very clear difference between the linux functions and the WSL implementations.

Like what Vlad did in MDEV-24189 can you instigate a procmon recording of the migration at the same time as recording the strace of the mysqld/mariadbd process.
Process for strace should be something like:

  • start mariadb:10.6 container with --cap-add=SYS_PTRACE
  • docker exec {container} sh -c 'apt-get update && apt-get install -y strace
  • docker exec --user mysql {container} strace -f -s 99 -p 1 -o /var/lib/mysql/mariadb.strace (as it crashes the container using a persistent location).
  • start procmon
  • do migration
  • save procmon output, stop procmon
  • docker container cp {container}:/var/lib/mysql/mariadb.strace $HOME/mariadb.strace
  • create a WSL bug (based on the assumption you are using WSL).

@grooverdan
Copy link
Member

FYI happy to accept a Windows based image like monogo if anyone has the inclination to port the entrypoint to PowerShell.

@grooverdan
Copy link
Member

Reported: microsoft/WSL#8443

@yosifkit
Copy link
Contributor

FYI happy to accept a Windows based image like monogo if anyone has the inclination to port the entrypoint to PowerShell.

Note that the windows-based mongo images do not have any entrypoint or initialization logic. Related information in docker-library/postgres#506 and the official images faq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need feedback Need feedback from user.
Development

No branches or pull requests

3 participants