NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ENOMEM during import with mariadb-10.5


I encountered this problem with MariaDB 10.5 and I assumed someone could
be interested by the workaround: when importing a large dump, it fails
and /var/log/mariadb/error.log says:

2021-07-08 14:59:51 4 [ERROR] InnoDB: Unable to lock ./foo/bar.ibd error: 12
2021-07-08 14:59:51 4 [ERROR] InnoDB: Operating system error number 12 in a file operation.
2021-07-08 14:59:51 4 [ERROR] InnoDB: Error number 12 means 'Cannot allocate memory'
2021-07-08 14:59:51 4 [Note] InnoDB: Some operating system error numbers are described at

The error is misleading, and increasing memory limits will not help. 
ktrace shows that errno 12 (ENOMEM) is returned by a fcntl() call. Reading
kernel sources shows it comes from lf_advlock() after lf_alloc() failed
because (1) user is not root and (2) per-user lock limit has been reached.

The per-user lock limit value is in the maxlocksperuid kernel variable,
with a default value of 1024. It can be changed by patching the sources
and rebuilding, or by patching the binary with gdb and rebooting, or by 
patching the loaded kernel in memory:
echo "write maxlocksperuid 0x800"|crash -w

Obviously it would be nicer if a sysctl existed for that, but at
least you have a workaround to save your day if your import fail after 
an upgrade.

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index