Segfault with Orocos component that uses the ROS logger. Xenomai target

2010/9/29 Adolfo Rodríguez Tsouroukdissian <adolfo [dot] rodriguez [..] ...>:
> Hello devs,
>
> I just stumbled into something unexpected while using Orocos-rtt and the
> (non-realtime) log4cxx-based logger in ROS. I'll briefly describe the
> problem in the hopes that it rings a bell somewhere.

You're probably looking at the wrong place. Could it be that you got a
kernel OOPS
at the same time ? I.e. look at 'dmesg'.

Peter

>
> I have a trivial component whose only purpose is to log messages using
> rosconsole when its configureHook(), startHook(), stopHook() and
> updateHook() methods are called. The component is periodic, uses
> ORO_SCHED_OTHER, and is deployed using the ORO_main macro. The attached file
> 'test.cpp' contains the code.
>
> When compiled against the gnulinux target everything works well, but when
> compiled against the xenomai target, the logging statement in updateHook()
> triggers a segfault in the rosconsole code (see attached file 'backtrace').
> Log messages in all other hooks work OK.
>
> So, any clues as to why linking against the xenomai target may be causing
> this crash?.
>
> Setup details:
> gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
> orocos-rtt 1.8.5
> xenomai 2.4.10 on a 2.6.34 kernel
> ros cturtle from ubuntu packages 1.2.1-36~lucid
>
> Will post a similar inquiry on the ROS list.
>
> TIA,
>
> Adolfo
>
>
> --
> Adolfo Rodríguez Tsouroukdissian, Ph. D.
>
> Robotics engineer
> PAL ROBOTICS S.L
> http://www.pal-robotics.com
> Tel. +34.93.414.53.47
> Fax.+34.93.209.11.09
> AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden
> contener información privilegiada y/o confidencial que está dirigida
> exclusivamente a su destinatario. Si usted recibe este mensaje y no es el
> destinatario indicado, o el empleado encargado de su entrega a dicha
> persona, por favor, notifíquelo inmediatamente y remita el mensaje original
> a la dirección de correo electrónico indicada. Cualquier copia, uso o
> distribución no autorizados de esta comunicación queda estrictamente
> prohibida.
>
> CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may
> contain confidential information which is privileged and intended only for
> the individual or entity to whom they are addressed.  If you are not the
> intended recipient, you are hereby notified that any disclosure, copying,
> distribution or use of this e-mail and/or accompanying document(s) is
> strictly prohibited.  If you have received this e-mail in error, please
> immediately notify the sender at the above e-mail address.
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

Segfault with Orocos component that uses the ROS logger. Xenomai

2010/9/29 Peter Soetens <peter [..] ...>

> 2010/9/29 Adolfo Rodríguez Tsouroukdissian <
> adolfo [dot] rodriguez [..] ...>:
> > Hello devs,
> >
> > I just stumbled into something unexpected while using Orocos-rtt and the
> > (non-realtime) log4cxx-based logger in ROS. I'll briefly describe the
> > problem in the hopes that it rings a bell somewhere.
>
> You're probably looking at the wrong place. Could it be that you got a
> kernel OOPS
> at the same time ? I.e. look at 'dmesg'.
>

Looks like it's not an OOPS, this is all that is printed on an execution of
the program:

[12984.062821] TimerThreadInst[3745]: segfault at b73f1680 ip b5519e4e sp
b73f1684 error 6 in libc-2.11.1.so[b54d8000+153000]
[12984.085190] Xenomai: native: cleaning up mutex "f8029600" (ret=0).
[12984.085194] Xenomai: native: cleaning up mutex "f802a000" (ret=0).
[12984.085198] Xenomai: native: cleaning up sem "f8029700" (ret=0).
[12984.085201] Xenomai: native: cleaning up sem "f8029780" (ret=0).

Maybe it could be related to our version of Xenomai and how it was
integrated. Will get back to the list when more info is available.
Speculating, the error happens when calling a function with variable number
of arguments (...). Maybe something gets badly mixed along the way.

Thanks again,

Adolfo.

> Peter
>
> >
> > I have a trivial component whose only purpose is to log messages using
> > rosconsole when its configureHook(), startHook(), stopHook() and
> > updateHook() methods are called. The component is periodic, uses
> > ORO_SCHED_OTHER, and is deployed using the ORO_main macro. The attached
> file
> > 'test.cpp' contains the code.
> >
> > When compiled against the gnulinux target everything works well, but when
> > compiled against the xenomai target, the logging statement in
> updateHook()
> > triggers a segfault in the rosconsole code (see attached file
> 'backtrace').
> > Log messages in all other hooks work OK.
> >
> > So, any clues as to why linking against the xenomai target may be causing
> > this crash?.
> >
> > Setup details:
> > gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
> > orocos-rtt 1.8.5
> > xenomai 2.4.10 on a 2.6.34 kernel
> > ros cturtle from ubuntu packages 1.2.1-36~lucid
> >
> > Will post a similar inquiry on the ROS list.
> >
> > TIA,
> >
> > Adolfo
> >
> >
> > --
> > Adolfo Rodríguez Tsouroukdissian, Ph. D.
> >
> > Robotics engineer
> > PAL ROBOTICS S.L
> > http://www.pal-robotics.com
> > Tel. +34.93.414.53.47
> > Fax.+34.93.209.11.09
> > AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden
> > contener información privilegiada y/o confidencial que está dirigida
> > exclusivamente a su destinatario. Si usted recibe este mensaje y no es el
> > destinatario indicado, o el empleado encargado de su entrega a dicha
> > persona, por favor, notifíquelo inmediatamente y remita el mensaje
> original
> > a la dirección de correo electrónico indicada. Cualquier copia, uso o
> > distribución no autorizados de esta comunicación queda estrictamente
> > prohibida.
> >
> > CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may
> > contain confidential information which is privileged and intended only
> for
> > the individual or entity to whom they are addressed. If you are not the
> > intended recipient, you are hereby notified that any disclosure, copying,
> > distribution or use of this e-mail and/or accompanying document(s) is
> > strictly prohibited. If you have received this e-mail in error, please
> > immediately notify the sender at the above e-mail address.
> >
> > --
> > Orocos-Dev mailing list
> > Orocos-Dev [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
> >
> >
>

Segfault with Orocos component that uses the ROS logger. Xenomai

turns out that the problem was coming from Xenomai (or our build of it).
Switching from 2.4.10 to 2.5.4 makes the problem go away. One of our
colleagues is further looking into this.

Brief description for completeness: We made a small and simple xenomai test
that spawns a thread and calls fprintf.
- If fprintf writes to the stderr descriptor it segfaults, if it writes to
stdout no problem occurs.
- Oddly, invoking the lower level write(...) on both stderr and stdout
works.

I have attached the test code in the 'test.cpp' file.

Cheers,

Adolfo