[MDEV-5679] MariaDB holds stdin open after startup as mysqld Created: 2014-02-14 Updated: 2015-12-11 Resolved: 2015-01-19 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 5.5.35, 10.0.8 |
| Fix Version/s: | 10.0.16 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Brian Evans | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Gentoo Linux |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
In reference to Gentoo Bug 461226, MariaDB holds open stdin after being started like this example:
Posting the issue here as suggested by serg on IRC |
| Comments |
| Comment by Sergei Golubchik [ 2014-02-17 ] |
|
My suggestion was to implement a very old and popular request and let mysqld to daemonize itself. Additionally, if it'll do that only after it is ready to accept new connections it will also remove the need for hacks like Fedora's mysql-wait-ready script that runs mysqladmin ping in a loop to detect when a server is finally ready to serve (meaning, systemd can start services that depend on mysqld). |
| Comment by Sergei Golubchik [ 2014-04-10 ] |
|
There's one difficulty with daemonizing — if mysqld will simply fork and exit when it's ready to accept connections, it will change the pid of the mysqld daemon process. And by that time the pid is already written into the pidfile. Creating the pidfile later is not a good idea, currently it's created as soon as the signal handler is installed, that is, as soon as mysqld can process signals sent to this pid. Rewriting pidfile to put a new pid in it could work, but I don't know what it might possibly break. A safe solution might be to fork early but make the parent process wait until the child is ready to accept connections. |
| Comment by Sergei Golubchik [ 2014-10-05 ] |
|
postponed, looks like nobody needs this feature. |
| Comment by Daniel Black [ 2014-12-27 ] |
|
With systemd coming along and it generally works better without daemonizing as it relying on sigchild is heaps more repliable than fiddling with pid files, this bug can be fixed by doing the minimal approach and just close the stdin after the checking we aren't doing a bootstrap. |
| Comment by Sergey Vojtovich [ 2015-10-27 ] |
|
I just got a query from ALTLinux maintainers. They're interested in "daemonize" option, the reasons are:
|