Hi,

While playing with a little round-robin unit setup (two units that
conflict with each other but enable themselves by installing the same
alias), I stumbled across this assertion in pid 1.

Apr  4 22:10:06 jimmy systemd[1]: Assertion 'f =
hashmap_get(b->unit->manager->cgroup_bondings, b->path)' failed at
src/cgroup.c:72, function cgroup_bonding_free(). Aborting.

Ultimately it is caused by having two units in the unit paths that both
have the same ControlGroup= directive set.

e.g. I had two units: crash-a.service and crash-b.service which both had:
ControlGroup=/system/crash.service

Simply doing a daemon-reload was then enough to cause a crash.

I guess the hashmap for clearing the cgroup_bonding should only be
removed when the last unit that needs it is unloaded. That is presumably
the correct fix rather than just ignoring the assert (I presume there
would be some ramifications if it's cleared in unit_free when some other
unit might still need it?).


Backtrace (tho' likely not needed as I'm sure the general cause is clear
enough).

#0  0x0000003ceba0ee3b in raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
#1  0x000000000040af8c in crash (sig=6) at src/main.c:123
#2  <signal handler called>
#3  0x0000003ceb634245 in __GI_raise (sig=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#4  0x0000003ceb6357cb in __GI_abort () at abort.c:93
#5  0x0000000000452249 in log_assert (text=<optimized out>,
file=0x492d75 "src/cgroup.c", line=72, func=0x493090 "cgroup_bonding_free",
    format=<optimized out>) at src/log.c:637
#6  0x00000000004527c0 in log_assert_failed (text=<optimized out>,
file=<optimized out>, line=<optimized out>, func=<optimized out>)
    at src/log.c:642
#7  0x00000000004415a6 in cgroup_bonding_free (b=0x26b61a0, trim=false)
at src/cgroup.c:72
#8  0x00000000004415f6 in cgroup_bonding_free_list (first=<optimized
out>, remove_or_trim=false) at src/cgroup.c:94
#9  0x0000000000465296 in unit_free (u=0x2a9f830) at src/unit.c:378
#10 0x000000000040b858 in manager_clear_jobs_and_units (m=0x26989e0) at
src/manager.c:441
#11 0x0000000000410fbf in manager_reload (m=0x26989e0) at src/manager.c:2900
#12 0x0000000000409306 in main (argc=<optimized out>, argv=<optimized
out>) at src/main.c:1505

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
#0  0x0000003ceba0ee3b in raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
42                               sig);
(gdb) thread apply all bt full

Thread 1 (Thread 0x7f81ed542740 (LWP 9462)):
#0  0x0000003ceba0ee3b in raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
        resultvar = 0
        pid = <optimized out>
#1  0x000000000040af8c in crash (sig=6) at src/main.c:123
        rl = {rlim_cur = 18446744073709551615, rlim_max = 18446744073709551615}
        sa = {__sigaction_handler = {sa_handler = 0, sa_sigaction = 0}, sa_mask 
= {__val = {0 <repeats 16 times>}}, sa_flags = 0, 
          sa_restorer = 0}
        pid = 0
        __func__ = "crash"
        __PRETTY_FUNCTION__ = "crash"
#2  <signal handler called>
No symbol table info available.
#3  0x0000003ceb634245 in __GI_raise (sig=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
        resultvar = 0
        pid = <optimized out>
        selftid = 1
#4  0x0000003ceb6357cb in __GI_abort () at abort.c:93
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x14, sa_sigaction = 0x14}, 
sa_mask = {__val = {261647462297, 44, 4796560, 72, 4795765, 0, 
              41120432, 21, 261647949528, 4812338, 206158430256, 
140735702839848, 140735702839632, 0, 1, 140735702839752}}, 
          sa_flags = -1785515576, sa_restorer = 0x2823080}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#5  0x0000000000452249 in log_assert (text=<optimized out>, file=0x492d75 
"src/cgroup.c", line=72, func=0x493090 "cgroup_bonding_free", 
    format=<optimized out>) at src/log.c:637
        buffer = "Assertion 'f = hashmap_get(b->unit->manager->cgroup_bondings, 
b->path)' failed at src/cgroup.c:72, function cgroup_bonding_free(). 
Aborting.", '\000' <repeats 1907 times>
#6  0x00000000004527c0 in log_assert_failed (text=<optimized out>, 
file=<optimized out>, line=<optimized out>, func=<optimized out>)
    at src/log.c:642
No locals.
#7  0x00000000004415a6 in cgroup_bonding_free (b=0x26b61a0, trim=false) at 
src/cgroup.c:72
        f = <optimized out>
        __PRETTY_FUNCTION__ = "cgroup_bonding_free"
#8  0x00000000004415f6 in cgroup_bonding_free_list (first=<optimized out>, 
remove_or_trim=false) at src/cgroup.c:94
        b = <optimized out>
        n = 0x0
#9  0x0000000000465296 in unit_free (u=0x2a9f830) at src/unit.c:378
        d = _UNIT_DEPENDENCY_MAX
---Type <return> to continue, or q <return> to quit---
        i = 0xffffffffffffffff
        t = <optimized out>
        __PRETTY_FUNCTION__ = "unit_free"
#10 0x000000000040b858 in manager_clear_jobs_and_units (m=0x26989e0) at 
src/manager.c:441
        j = <optimized out>
        u = <optimized out>
        __PRETTY_FUNCTION__ = "manager_clear_jobs_and_units"
#11 0x0000000000410fbf in manager_reload (m=0x26989e0) at src/manager.c:2900
        r = 0
        q = <optimized out>
        f = 0x280d990
        fds = 0x288df20
        __PRETTY_FUNCTION__ = "manager_reload"
#12 0x0000000000409306 in main (argc=<optimized out>, argv=<optimized out>) at 
src/main.c:1505
        m = 0x26989e0
        r = <optimized out>
        retval = 1
        before_startup = 3909430
        after_startup = <optimized out>
        timespan = "126ms 
156us\000<\000\000\000Pe\240\353<\000\000\000I0\264,\000\000\000\000\006\000\000\000\000\000\000\000\277\000\000\000\000\000\000\000~7\223\225\377\177\000\000ЦF\000\000\000\000"
        fds = 0x0
        reexecute = false
        shutdown_verb = 0x0
        initrd_timestamp = {realtime = <optimized out>, monotonic = 462743}
        systemd = "systemd"
        is_reexec = <optimized out>
        j = <optimized out>
        loaded_policy = false
        __func__ = "main"
        __PRETTY_FUNCTION__ = "main"
(gdb) thread apply all bt

Thread 1 (Thread 0x7f81ed542740 (LWP 9462)):
#0  0x0000003ceba0ee3b in raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
#1  0x000000000040af8c in crash (sig=6) at src/main.c:123
#2  <signal handler called>
#3  0x0000003ceb634245 in __GI_raise (sig=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#4  0x0000003ceb6357cb in __GI_abort () at abort.c:93
#5  0x0000000000452249 in log_assert (text=<optimized out>, file=0x492d75 
"src/cgroup.c", line=72, func=0x493090 "cgroup_bonding_free", 
    format=<optimized out>) at src/log.c:637
#6  0x00000000004527c0 in log_assert_failed (text=<optimized out>, 
file=<optimized out>, line=<optimized out>, func=<optimized out>)
    at src/log.c:642
#7  0x00000000004415a6 in cgroup_bonding_free (b=0x26b61a0, trim=false) at 
src/cgroup.c:72
#8  0x00000000004415f6 in cgroup_bonding_free_list (first=<optimized out>, 
remove_or_trim=false) at src/cgroup.c:94
#9  0x0000000000465296 in unit_free (u=0x2a9f830) at src/unit.c:378
#10 0x000000000040b858 in manager_clear_jobs_and_units (m=0x26989e0) at 
src/manager.c:441
#11 0x0000000000410fbf in manager_reload (m=0x26989e0) at src/manager.c:2900
#12 0x0000000000409306 in main (argc=<optimized out>, argv=<optimized out>) at 
src/main.c:1505
(gdb) 
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to