Re: [systemd-devel] How to generate core file in system service

2017-09-27 Thread Xin Long
On Mon, Sep 25, 2017 at 2:47 PM, Mantas Mikulėnas  wrote:
> On Mon, Sep 25, 2017 at 8:59 AM, Xin Long  wrote:
>>
>> Hi,
>>
>> linux network is using
>>   systemctl start teamd@team0.service
>> to start a teamd service, which will call teamd.
>>
>> I got a teamd issue to debug, I wanted generate core file by adding
>> abort()
>> in teamd and ulimit -c unlimited.
>>
>> But when I start the deamon by "teamd" directly, I could get core file.
>> When I start it by systemctl start teamd@team0.service, no core file was
>> generate when it crashed, but only get:
>>"systemd: teamd@team0.service: main process exited, code=killed,
>> status=6/ABRT"
>> in /var/log/messages.
>>
>> I'm just wondering if there is a way to generate the core file when the
>> the program crashes even if I start it as a systeamd service ?
>
>
> Yes, everything works the same way – `ulimit -c` corresponds to LimitCORE=,
> so make sure that's set to unlimited in your service.
Works for me, thanks for your fast reply.

>
> (Remember that services are spawned by init, not by systemctl, so ulimits
> don't carry over directly.)
>
> --
> Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to generate core file in system service

2017-09-27 Thread Lennart Poettering
On Mi, 27.09.17 01:36, Kai Krakow (hurikha...@gmail.com) wrote:

> Am Mon, 25 Sep 2017 10:26:48 +0200
> schrieb Miroslav Suchý :
> 
> > Dne 25.9.2017 v 08:47 Mantas Mikulėnas napsal(a):
> > > But when I start the deamon by "teamd" directly, I could get core
> > > file. When I start it by systemctl start teamd@team0.service, no
> > > core file was generate when it crashed, but only get:
> > >    "systemd: teamd@team0.service: main process exited, code=killed,
> > > status=6/ABRT"
> > > in /var/log/messages.  
> > 
> > I guess this crash has been caught by ABRT.
> > 
> > Try:
> >   abrt-cli list
> 
> Also try "coredumpctl list". Maybe systemd-coredump did catch the dump.

The exit status in the log message above indicates that no coredump
was collected, because in that case the exit code would have to be
"dumped" instead of "killed" as shown.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to generate core file in system service

2017-09-26 Thread Kai Krakow
Am Mon, 25 Sep 2017 10:26:48 +0200
schrieb Miroslav Suchý :

> Dne 25.9.2017 v 08:47 Mantas Mikulėnas napsal(a):
> > But when I start the deamon by "teamd" directly, I could get core
> > file. When I start it by systemctl start teamd@team0.service, no
> > core file was generate when it crashed, but only get:
> >    "systemd: teamd@team0.service: main process exited, code=killed,
> > status=6/ABRT"
> > in /var/log/messages.  
> 
> I guess this crash has been caught by ABRT.
> 
> Try:
>   abrt-cli list

Also try "coredumpctl list". Maybe systemd-coredump did catch the dump.

This is the case if sysctl kernel.core_pattern pipes to
/lib/systemd/systemd-coredump.


-- 
Regards,
Kai

Replies to list-only preferred.


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to generate core file in system service

2017-09-25 Thread Miroslav Suchý
Dne 25.9.2017 v 08:47 Mantas Mikulėnas napsal(a):
> But when I start the deamon by "teamd" directly, I could get core file.
> When I start it by systemctl start teamd@team0.service, no core file was
> generate when it crashed, but only get:
>    "systemd: teamd@team0.service: main process exited, code=killed,
> status=6/ABRT"
> in /var/log/messages.

I guess this crash has been caught by ABRT.

Try:
  abrt-cli list

And then start here:
  http://abrt.readthedocs.io/en/latest/faq.html

If you would enable micro report (here is how 
https://wiki.centos.org/TipsAndTricks/ABRT ) it would automatically appear
here:
  
https://retrace.fedoraproject.org/faf/reports/?component_names=libteam=__None

Mirek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to generate core file in system service

2017-09-25 Thread Mantas Mikulėnas
On Mon, Sep 25, 2017 at 11:26 AM, Miroslav Suchý  wrote:

> Dne 25.9.2017 v 08:47 Mantas Mikulėnas napsal(a):
> > But when I start the deamon by "teamd" directly, I could get core file.
> > When I start it by systemctl start teamd@team0.service, no core file was
> > generate when it crashed, but only get:
> >"systemd: teamd@team0.service: main process exited, code=killed,
> > status=6/ABRT"
> > in /var/log/messages.
>
> I guess this crash has been caught by ABRT.
>
> Try:
>   abrt-cli list
>

Even though abrt got its name from SIGABRT, doesn't mean it handles all
abort()-induced crashes...

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to generate core file in system service

2017-09-25 Thread Mantas Mikulėnas
On Mon, Sep 25, 2017 at 8:59 AM, Xin Long  wrote:

> Hi,
>
> linux network is using
>   systemctl start teamd@team0.service
> to start a teamd service, which will call teamd.
>
> I got a teamd issue to debug, I wanted generate core file by adding abort()
> in teamd and ulimit -c unlimited.
>
> But when I start the deamon by "teamd" directly, I could get core file.
> When I start it by systemctl start teamd@team0.service, no core file was
> generate when it crashed, but only get:
>"systemd: teamd@team0.service: main process exited, code=killed,
> status=6/ABRT"
> in /var/log/messages.
>
> I'm just wondering if there is a way to generate the core file when the
> the program crashes even if I start it as a systeamd service ?
>

Yes, everything works the same way – `ulimit -c` corresponds to LimitCORE=,
so make sure that's set to unlimited in your service.

(Remember that services are spawned by init, not by systemctl, so ulimits
don't carry over directly.)

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel