[systemd-devel] Is it a bug of manager->n_on_console?

Lennart Poettering lennart at poettering.net
Wed Jan 24 11:09:55 UTC 2018


On Mo, 25.12.17 13:31, piliu (piliu at redhat.com) wrote:

> Hi,
> 
> When debugging with a shell, manager_status_printf() always prints "A
> start job...". After tracing the systemd's code, I found in that
> function, the cond "if (type == STATUS_TYPE_EPHEMERAL && m &&
> m->n_on_console > 0)" does not meet.
> 
> With a debugging patch, I got the following message, which indicates
> that there is a reference count bug with n_on_console.1
> The debugging message:
> Manager:0x55e55d91d110, unit: dracut pre-pivot and cleanup hook
> n_on_console++, >1
> service_set_state Manager:0x55e55d91d110, unit: dracut pre-pivot and
> cleanup hook n_on_console--, >0
> Manager:0x55e55d91d110, unit: Kdump Vmcore Save Service n_on_console++, >1
> Manager:0x55e55d91d110, unit: Kdump Vmcore Save Service n_on_console--, >0
> Manager:0x55e55d91d110, unit: dracut pre-pivot and cleanup hook
> n_on_console--, >-1
> Manager:0x55e55d91d110, unit: Kdump Emergency n_on_console++, >0
> Manager:0x55e55d91d110, unit: Kdump Emergency n_on_console--, >-1
> Manager:0x55e55d91d110, unit: Kdump Error Handler n_on_console++, >0
> 
> Where you can see "dracut pre-pivot and cleanup hook" dec the refcnt
> twice. (Note: n_on_console is declared as unsigned, so here the negative
> value reflects the underflow.)

Thanks for tracking this down btw.

For the sake of the archives, this is tracked here now:

https://github.com/systemd/systemd/pull/7824

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list