Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4(EOL), 10.5, 10.6, 10.7(EOL)
-
None
Description
When using the authentication plugin PAM it fails in case the mariadb process uses more memory than is still free and memory overcommit is disabled.
The reason lies in fork() (https://github.com/MariaDB/server/blob/10.7/plugin/auth_pam/auth_pam.c#L62) which duplicates the process. As there is not enough free memory for a duplicate process fork() fails (silently) and the authentication does not succeed.
As the forked process is only used to exec() the pam tool, there is no need for a fork of the whole server process.
It can be reproduced by running a mariadb server with an innodb_buffer of more than half of the server's (best a VM with as few RAM as possible) RAM and filling it up by selecting a big table of test data.
This issue had already been reported in Percona server: https://jira.percona.com/browse/PS-3332
Cheers
Volker
Attachments
Issue Links
- relates to
-
MDEV-30734 [ERROR] mariadbd: pam: cannot exec /usr/lib64/mysql/plugin/auth_pam_tool_dir/auth_pam_tool (errno: 12 "Cannot allocate memory")
-
- Closed
-
https://jira.percona.com/browse/PS-3332 was closed with "Cannot Reproduce".
fork() does not duplicate the whole process memory, that would be too slow to be practically usable. It only copies changed pages, so if one of the processes rewrites the whole of innodb buffer pool — it'll be duplicated, yes. But the child process calls exec() immediately after the fork(). The parent cannot do much in that short time frame.