FTBFS: mariadb fails to start due to low MEMLOCK limit

Bug #1970634 reported by Andreas Hasenack
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
mariadb-10.6 (Ubuntu)
Fix Released
Undecided
Andreas Hasenack
Jammy
Fix Released
High
Andreas Hasenack
systemd (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Won't Fix
High
Unassigned

Bug Description

[Impact]

Jammy's MariaDB will fail to build, and also fail to start, if the underlying kernel is 5.4.x (focal's) and if it's running in an unprivileged container (lxd, docker). It will also fail to build in launchpad builders.

Common scenarios where this combination exists is a focal host, running an unprivileged jammy container (lxd or docker), or even a chroot (the launchpad builders).

Jammy's MariaDB was built with io_uring support, and it tries to enable it at runtime if it deems it's running on a supported kernel. There is a range of kernel versions it checks, but of interest for this SRU, the Focal (5.4.x) kernel is inside this range and io_uring will be enabled. The jammy kernel (5.15) is not, so io_uring will not be enabled there, and thus the bug is not manifested in that case.

If io_uring is enabled, a higher MEMLOCK limit is required than what is set by default in focal or jammy (64Mb is what we get, 256Mb or more is required).

The systemd unit file for mariadb tries to raise this limit, but in an unprivileged container this won't work.

MariaDB has checks in place to catch when MEMLOCK is too low, in which case it will not use io_uring, but these checks are failing because of the LTO build flags that were used in the jammy build of mariadb. It's unclear if it's a bug in gcc or something else. There is more information in comment #1, comment #5 and later.

The suggested fix here is to disable LTO for the jammy build. This has been done for kinetic already, and is also applied to the debian packaging (inside a distro-specific conditional).

[Test Plan]
The test plan is to launch mariadb in a jammy lxd container running on a focal host.

lxc launch ubuntu:focal f --vm
lxc shell f
lxd init # just hit enter for all questions
lxc launch ubuntu:jammy j
lxc shell j
ulimit -l # confirm it's less than 256
apt update && apt install mariadb-server -y

After the installation, mariadb will not be running, and this can be checked with:

systemctl status mariadb.service

or

journalctl -u mariadb.server

You will see something like this:
Jun 17 18:32:01 jammy-mariadb systemd[1]: Starting MariaDB 10.6.7 database server...
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 2022-06-17 18:32:01 0 [Note] /usr/sbin/mariadbd (server 10.6.7-MariaDB-2ubuntu1) starting as process 1864 ...
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 2022-06-17 18:32:01 0 [Note] InnoDB: The first data file './ibdata1' did not exist. A new tablespace will be created!
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 2022-06-17 18:32:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 2022-06-17 18:32:01 0 [Note] InnoDB: Using transactional memory
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 2022-06-17 18:32:01 0 [Note] InnoDB: Number of pools: 1
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 2022-06-17 18:32:01 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 2022-06-17 18:32:01 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOMEM: try larger memory locked limit, ulimit -l, or https://mariadb.com/kb/en/systemd/#configuring-limitmemlock under systemd (262144 bytes required)
Jun 17 18:32:01 jammy-mariadb mariadbd[1864]: 220617 18:32:01 [ERROR] mysqld got signal 6 ;

And a crash dump.

With the fixed version, the service will be running normally after installation.

[Where problems could occur]
The proposed fix is not a surgical strike. It's unfortunate that we didn't get to the bottom of why LTO is causing this behavior. Reverting it is still the quickest and less risky change at the moment, though. This gets us on par with upstream binary builds, and debian builds, and these also have wide test coverage and ample user base.

The other regression possibility is that this is a rebuild of mariadb in the current jammy environment, and the package that is currently in jammy was built on March 10th, 2022. Most likely the reverse dependencies were updated in jammy since then.

It's unclear how 10.6.7-2ubuntu1 migrated in jammy. I checked build logs and dep8 logs, and can't tell why the tests passed. At least the build log in jammy shows the host kernel was 5.4.x, so it should have been affected. My only explanation is that at that time, the MEMLOCK limit was higher in that environment for some reason, and didn't trigger this bug. Then at some point later, launchpad builders changed, and MEMLOCK was reduced to 64Mb. https://irclogs.ubuntu.com/2022/04/28/%23ubuntu-devel.html#t15:00 has some discussion about it.

[Other Info]
Not at this time.

[Original Description]

<rbasak> ahasenack: IIRC, originally Launchpad was FTBFSing on mariadb that included io_uring support because upstream were doing a build time test for io_uring (and I think still are), which is wrong because it should be done at runtime since the lack of io_uring availablity at build time doesn't tell us about its availablity at runtime.
<rbasak> But then the Launchpad builders got updated to a newer release and therefore a newer kernel that supported it.
<rbasak> AIUI, that's how we ended up with a successful build in the Jammy release pocket (of 10.6).
<ahasenack> I think the lp builders are using the focal hwe kernel
<ahasenack> 5.4.0-something
<ahasenack> let me check that build log
<rbasak> But then something changed that caused this current FTBFS, and I haven't tracked down what that is.
<ahasenack> hm, both are 10.6.7
<ahasenack> release and proposed
<rbasak> What puzzles me is that if the root cause is a memlock rlimit issue then why did it work before?
<rbasak> So since there's a contradiction somewhere, maybe one or more of my "facts" above is wrong.
<ahasenack> this is the current failure
<ahasenack> 2022-04-14 8:11:49 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOMEM: try larger memory locked limit, ulimit -l, or https://mariadb.com/kb/en/systemd/#configuring-limitmemlock under systemd (262144 bytes required)
<ahasenack> and ulimit -l confirms that the limit is lower
<ahasenack> Max locked memory 65536 65536 bytes
<ahasenack> just 64kbytes
<rbasak> Yeah but then how did the release pocket build work?
<ahasenack> either the limit was different back then
<ahasenack> or ... stuff

Related branches

tags: added: server-todo
Revision history for this message
Andreas Hasenack (ahasenack) wrote (last edit ):

Ok, after some experimenting and code inspection, this is the summary.

This is the logic that decides if mariadb 10.6.7 will try to use uring or not, AT RUNTIME:
bool innodb_use_native_aio_default()
{
#ifdef HAVE_URING
  utsname &u= uname_for_io_uring;
  if (!uname(&u) && u.release[0] == '5' && u.release[1] == '.' &&
      u.release[2] == '1' && u.release[3] >= '1' && u.release[3] <= '5' &&
      u.release[4] == '.')
  {
    if (u.release[3] == '5') {
      const char *s= strstr(u.version, "5.15.");
      if (s || (s= strstr(u.release, "5.15.")))
        if ((s[5] >= '3' || s[6] >= '0'))
          return true; /* 5.15.3 and later should be fine */
    }
    io_uring_may_be_unsafe= u.release;
    return false; /* working around io_uring hangs (MDEV-26674) */
  }
#endif
  return true;
}

As we can see, it depends on the RUNNING kernel, and details are in https://jira.mariadb.org/browse/MDEV-26674

The jammy kernel is 5.15.0, which makes the above return false, meaning io_uring is NOT used.

The focal kernel is 5.4.0, which makes the above return true, meaning io_uring IS USED.

That's why running the jammy build of mariadb on a focal kernel attempts to use io_uring. And this is what the current launchpad builders are: focal kernel, with chroots for the ubuntu release they are building for. And mariadbd is run in this env as part of the build-time tests.

Note the above is for RUNTIME decision: HAVE_URING is decided at build time, and is not related to this bug.

If uring is used, then the memlock limit comes into play: it indeed needs to be higher. stracing jammy's mariadb on the focal kernel shows that io_uring_setup() failed with ENOMEM.

Quick reproducer:
- create a focal VM
- confirm ulimit -l value in that VM. I've been getting the value "64", but anything lower than 256 will trigger the bug.
- inside that VM, create a jammy LXD
- iside that LXD, install mariadb-server. It will fail.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I added a task for systemd to consider raising the default RLIMIT_MEMLOCK limit.

This upstream commit raises the default limit to 8Mb:

https://github.com/systemd/systemd/commit/852b62507b2

The way things are now, the following scenario does NOT work out of the box:

- jammy lxd on focal host
- apt install mariadb-server

mariadb will crash and core dump because of the low MEMLOCK limit. Its systemd service file even has this line to raise the limit:

LimitMEMLOCK=524288

But that does not have any effect from inside the unprivileged lxd container.

Jammy lxd on jammy host will work just because the jammy kernel (5.15.0) is deemed unsafe[1] for uring by mariadb, and then uring is disabled during startup.

1. https://github.com/MariaDB/server/blob/10.6/storage/innobase/handler/ha_innodb.cc#L19480

summary: - FTBFS: test failure due to low memlock limit
+ FTBFS: mariadb fails to start due to low MEMLOCK limit
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Since mariadb on the current jammy kernel disables io_uring at startup, I'm considering disabling io_uring entirely in the jammy mariadb build. The only scenario where io_uring would be used by the jammy mariadb is if the user ran a different kernel than the one shipped with jammy.

Revision history for this message
Daniel Black (daniel-black) wrote :

From 5.12 kernel memory locked pages aren't needed - https://github.com/axboe/liburing/issues/246#issuecomment-816965961.

In #1969160 I tested the upcoming 10.6 release (probably next week sometime) for crashes in uring initialization failures and it didn't. Apart from some error log differences from ENOMEM, ENOSYS etc are handles the same way in the fallback.

I haven't quite concluded how the 10.6.7 release is crashing at the moment.

With https://bugs.launchpad.net/ubuntu/+source/linux-hwe-5.13/+bug/1952222 I assume the jammy kernel 5.15.0 has the right patches to make 5.15.0 safe despite the MariaDB code not distinguishing it as so (suggestions of improving kernel version detection welcome).

Revision history for this message
Daniel Black (daniel-black) wrote :
Download full text (5.7 KiB)

Assertion cause:

$ podman run --rm --cap-add=CAP_SYS_PTRACE -e MARIADB_ROOT_PASSWORD=bob -ti --user mysql m106_jammy_debug bash
mysql@0740c1895ab4:/$ gdb --args mariadbd --bootstrap
GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mariadbd...
Reading symbols from /usr/lib/debug/.build-id/44/991764aba74dce2376ff38060a66adb6cfe4c0.debug...
(gdb) r
Starting program: /usr/sbin/mariadbd --bootstrap
warning: Error disabling address space randomization: Function not implemented
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
2022-04-28 22:59:13 0 [Note] /usr/sbin/mariadbd (server 10.6.7-MariaDB-2ubuntu1) starting as process 14 ...
[New Thread 0x7f1b390b2640 (LWP 17)]
[New Thread 0x7f1b245c0640 (LWP 18)]
2022-04-28 22:59:13 0 [Note] InnoDB: The first data file './ibdata1' did not exist. A new tablespace will be created!
2022-04-28 22:59:13 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-04-28 22:59:13 0 [Note] InnoDB: Number of pools: 1
2022-04-28 22:59:13 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-04-28 22:59:13 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-04-28 22:59:13 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOSYS: try uprading the kernel

Thread 1 "mariadbd" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=139754903728000) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=139754903728000) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=139754903728000) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=139754903728000, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007f1b38a42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007f1b38a287f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x00005640ceb351dc in _Unwind_SetGR.cold ()
#6 0x00005640cf4218af in __gcc_personality_v0 ()
#7 0x00007f1b39743c64 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#8 0x00007f1b39744321 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#9 0x00007f1b38eae54b in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00005640ceb232ed in (anonymous namespace)::aio_uring::aio_uring (this=<optimized out>, tpool=<optimized out>, max_aio=<optimized out>, this=<optimized out>...

Read more...

Revision history for this message
Daniel Black (daniel-black) wrote :

Actually create_linux_aio (tpool/aio_liburing.cc:194) should already catch this exception. So compiler error?

Revision history for this message
Daniel Black (daniel-black) wrote :

Note the runtime detection in innodb_use_native_aio_default affects the default value only. Users can explicity set this and really on distros to provide patched kernels.

Revision history for this message
Daniel Black (daniel-black) wrote :
Download full text (6.7 KiB)

On the assembly generated by create_linux_aio (in the mariadbd packages in Ubuntu-22.04, 10.6.7-2:

(gdb) disassemble tpool::create_linux_aio,+200
Dump of assembler code from 0x5640cf2e1fb0 to 0x5640cf2e2078:
   0x00005640cf2e1fb0 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+0>: endbr64
   0x00005640cf2e1fb4 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+4>: push %rbp
   0x00005640cf2e1fb5 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+5>: mov %rsp,%rbp
   0x00005640cf2e1fb8 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+8>: push %r14
   0x00005640cf2e1fba <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+10>: mov %esi,%r14d
   0x00005640cf2e1fbd <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+13>: push %r13
   0x00005640cf2e1fbf <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+15>: mov %rdi,%r13
   0x00005640cf2e1fc2 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+18>: mov $0x158,%edi
   0x00005640cf2e1fc7 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+23>: push %r12
   0x00005640cf2e1fc9 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+25>: sub $0x8,%rsp
   0x00005640cf2e1fcd <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+29>: call 0x5640ceacb570 <_Znwm@plt>
   0x00005640cf2e1fd2 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+34>: mov %r14d,%edx
   0x00005640cf2e1fd5 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+37>: mov %r13,%rsi
   0x00005640cf2e1fd8 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+40>: mov %rax,%rdi
   0x00005640cf2e1fdb <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+43>: mov %rax,%r12
   0x00005640cf2e1fde <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+46>: call 0x5640cf2e1dd0 <(anonymous namespace)::aio_uring::aio_uring(tpool::thread_pool*, int)>
   0x00005640cf2e1fe3 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+51>: add $0x8,%rsp
   0x00005640cf2e1fe7 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+55>: mov %r12,%rax
   0x00005640cf2e1fea <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+58>: pop %r12
   0x00005640cf2e1fec <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+60>: pop %r13
   0x00005640cf2e1fee <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+62>: pop %r14
   0x00005640cf2e1ff0 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+64>: pop %rbp
   0x00005640cf2e1ff1 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+65>: ret
   0x00005640cf2e1ff2 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+66>: endbr64
   0x00005640cf2e1ff6 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+70>: mov %rax,%rdi
   0x00005640cf2e1ff9 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+73>: mov %rdx,%rax
   0x00005640cf2e1ffc <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+76>: jmp 0x5640ceb23308 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi-8121512>
   0x00005640cf2e2001 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+81>: endbr64
   0x00005640cf2e2005 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+85>: mov %rax,%r13
   0x00005640cf2e2008 <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+88>: mov %rdx,%r14
   0x00005640cf2e200b <_ZN5tpool16create_linux_aioEPNS_11thread_poolEi+91>: jmp 0x5640ceb232fa <_ZN5tpool16create_...

Read more...

Revision history for this message
Daniel Black (daniel-black) wrote :

Could it be -flto/-ffat-lto-objects related (like https://jira.mariadb.org/browse/MDEV-25633)? The top part of the stack trace looks the same.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> Could it be -flto/-ffat-lto-objects related (like https://jira.mariadb.org/browse/MDEV-25633)?
> The top part of the stack trace looks the same.

Nice catch. Indeed, disabling lto fixes the build and startup in low memlock conditions.

I'm still concerned with lto creeping in via krb5-config[1], but that's another issue.

1. https://lists.ubuntu.com/archives/ubuntu-devel/2022-April/042013.html

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mariadb-10.6 - 1:10.6.7-3ubuntu1

---------------
mariadb-10.6 (1:10.6.7-3ubuntu1) kinetic; urgency=medium

  * d/rules: disable LTO (LP: #1970634)

 -- Andreas Hasenack <email address hidden> Fri, 29 Apr 2022 09:30:44 -0300

Changed in mariadb-10.6 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Michal Nasiadka (mnasiadka) wrote :

Hello, any idea when the fix will land in jammy?

Changed in mariadb-10.6 (Ubuntu Jammy):
assignee: nobody → Andreas Hasenack (ahasenack)
status: New → Triaged
importance: Undecided → High
Changed in systemd (Ubuntu Jammy):
assignee: nobody → Andreas Hasenack (ahasenack)
status: New → In Progress
importance: Undecided → High
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hi Michal, I'm going over the test procedure for this bug and turns out the scenario where we encountered it is a bit convoluted, specially for users: you need to be running a 5.4 kernel on a jammy userspace (jammy itself has 5.15 kernel).

Could you please elaborate on how this bug affects you? Are you included in the above scenario, or is it something else?

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I can't reproduce this bug anymore with the package currently in jammy (1:10.6.7-2ubuntu1):

lxc launch ubuntu:focal f --vm
lxc shell f
lxd init # just hit enter for all questions
lxc launch ubuntu:jammy j
lxc shell j
ulimit -l # confirm it's less than 256
apt update && apt install mariadb-server -y

I wonder if it was just an interim issue in jammy's 1:10.6.7-3 package. I'm doing a test rebuild of 1:10.6.7-2ubuntu1 in jammy.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Ok, a plain jammy rebuild in a launchpad ppa failed:

2022-06-17 14:18:27 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOMEM: try larger memory locked limit, ulimit -l, or https://mariadb.com/kb/en/systemd/#configuring-limitmemlock under systemd (262144 bytes required)

The binary package that is currently in jammy was probably rebuilt before the lto changes I'm guessing, because it's not affected by this. So I wonder how current jammy users could be affected by this (besides the rebuild). Let's see if Michal has something to say about my comment #15.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I got a report on IRC that the existing jammy package of mariadb does exhibit this problem:

(link will expire soon)
https://storage.bhs.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_bd5/839585/23/check/kolla-ansible-ubuntu-source/bd5a051/primary/logs/kolla/mariadb/mariadb.txt:

"""
2022-06-15 12:38:03 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOMEM: try larger memory locked limit, ulimit -l, or https://mariadb.com/kb/en/systemd/#configuring-limitmemlock under systemd (262144 bytes required)
220615 12:38:03 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Server version: 10.6.7-MariaDB-2ubuntu1-log
key_buffer_size=67108864
read_buffer_size=131072
max_used_connections=0
max_threads=10002
thread_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 22090304 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
(...)
"""

The scenario is very similar to the lxd testing I've been using to confirm the bug. Above it's a docker container running mariadb from jammy, on a focal host.

The docker image was built with just pulling in mariadb from jammy, without rebuilding it, so it's the same binary as published.

I probably made a mistake in my testing with the jammy package just now. I'll repeat it and inspect it more carefully.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Ok, phew, my test was incorrect, the bug is present in jammy. That makes this SRU simpler. I'll proceed with it, without a block-proposed tag.

description: updated
description: updated
description: updated
description: updated
description: updated
description: updated
Changed in systemd (Ubuntu Jammy):
status: In Progress → New
assignee: Andreas Hasenack (ahasenack) → nobody
Changed in mariadb-10.6 (Ubuntu Jammy):
status: Triaged → In Progress
description: updated
Revision history for this message
Steve Langasek (vorlon) wrote :

+ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)

Really rather over-complicated for an SRU; especially as 'export DEB_BUILD_MAINT_OPTIONS += optimize=-lto' should still dtrt in Debian...

Changed in mariadb-10.6 (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Andreas, or anyone else affected,

Accepted mariadb-10.6 into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/mariadb-10.6/1:10.6.7-2ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

description: updated
Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Download full text (4.1 KiB)

Jammy verification

Confirming the bug with the jammy packages:

root@j:~# apt-cache policy mariadb-server
mariadb-server:
  Installed: 1:10.6.7-2ubuntu1
  Candidate: 1:10.6.7-2ubuntu1
  Version table:
 *** 1:10.6.7-2ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status

root@j:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.6.7 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: core-dump) since Wed 2022-07-06 13:07:10 UTC; 595ms ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 2014 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 2015 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 2017 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_ST>
    Process: 2048 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=dumped, signal=ABRT)
   Main PID: 2048 (code=dumped, signal=ABRT)

Jul 06 13:07:10 j systemd[1]: mariadb.service: Failed with result 'core-dump'.
Jul 06 13:07:10 j systemd[1]: Failed to start MariaDB 10.6.7 database server.

With the packages from proposed:
root@j:~# apt-cache policy mariadb-server
mariadb-server:
  Installed: 1:10.6.7-2ubuntu1.1
  Candidate: 1:10.6.7-2ubuntu1.1
  Version table:
 *** 1:10.6.7-2ubuntu1.1 500
        500 http://archive.ubuntu.com/ubuntu jammy-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     1:10.6.7-2ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

It starts just fine:
root@j:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.6.7 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-07-06 13:09:09 UTC; 20s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 3626 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 3627 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3629 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_ST>
    Process: 3668 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3670 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 3658 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 11 (limit: 1154)
     Memory: 59.5M
     CGroup: /system.slice/mariadb.service
             └─3658 /usr/sbin/mariadbd

Jul 06 13:09:09 j mariadbd[3658]: Version: '10.6.7-MariaDB-2ubun...

Read more...

tags: added: verification-done-jammy
removed: verification-needed-jammy
Revision history for this message
Daniel Black (daniel-black) wrote :

Will also fix #1979695

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu Jammy):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mariadb-10.6 - 1:10.6.7-2ubuntu1.1

---------------
mariadb-10.6 (1:10.6.7-2ubuntu1.1) jammy; urgency=medium

  * d/rules: disable LTO on Ubuntu so a low MEMLOCK_LIMIT can be
    properly caught and dealt with (LP: #1970634)

 -- Andreas Hasenack <email address hidden> Fri, 17 Jun 2022 10:03:50 -0300

Changed in mariadb-10.6 (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for mariadb-10.6 has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Removing the systemd jammy task, it's unlikely such a change would be SRUed.

Changed in systemd (Ubuntu Jammy):
status: Confirmed → Won't Fix
tags: removed: server-todo
Revision history for this message
Nick Rosbrook (enr0n) wrote :

The commit mentioned in https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1970634/comments/3 has been present in systemd since v251 (which is in Kinetic), so I don't think there is anything left to do for systemd. Please correct me if I am wrong.

Changed in systemd (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Otto Kekäläinen (otto) wrote :

Filed follow-up https://bugs.launchpad.net/ubuntu/+source/mariadb/+bug/2038500 to track when the underlying issue is fixed and the workaround can be removed.

Revision history for this message
Otto Kekäläinen (otto) wrote :

As commented in LP#2038500: I tested again building on Ubuntu 24.04 Noble with latest dependencies at https://launchpadlibrarian.net/728345044/buildlog_ubuntu-noble-amd64.mariadb_1%3A10.11.7-5~bpo24.04.1~1715052025.97428f7b341+debian.latest_BUILDING.txt.gz and it is *still* failing on this bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.