Skip to content

Memory bug when using LCM and ROS #3

@patmarion

Description

@patmarion

This bug occurred when we were testing at JSC. I'm curious if you have seen it? There was a memory bug that causes LCM to incorrectly parse channel names, which can result in LCM failing to subscribe to a channel depending on the channel name. And you might also see this output when LCM initializes:

lcm_subscribe: Error while compiling regular expression ^LCM_SELF_TEST$ at char 0: unknown option bit(s) set
LCM self test failed!!

The bug is also visible if you run the program with valgrind (which can be difficult to do with a ROS plugin) The problem is that the wrong version of a regular expression function is called. If you run: ldd /path/to/plugin.so and you see these library: libpcre and libPocoFoundation then you might have the bug. This bug also occurred when we used LCM and Matlab libraries together. See more info at this comment:

https://github.com/openhumanoids/oh-distro-private/issues/644#issuecomment-97905467

And this was the valgrind output when running a simple test main.cpp program that creates an instance of the plugin:

==11504== Invalid read of size 1
==11504== at 0x7C81AB3: ??? (in /lib/x86_64-linux-gnu/libpcre.so.3.13.1)
==11504== by 0x7C82706: ??? (in /lib/x86_64-linux-gnu/libpcre.so.3.13.1)
==11504== by 0x7C8BA23: pcre_compile2 (in /lib/x86_64-linux-gnu/libpcre.so.3.13.1)
==11504== by 0x6958A7B: g_regex_new (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
==11504== by 0x5B6FF40: lcm_subscribe (lcm.c:321)
==11504== by 0x5B72A4D: udpm_self_test (lcm_udpm.c:822)
==11504== by 0x5B734E3: _setup_recv_parts (lcm_udpm.c:1057)
==11504== by 0x5B72104: lcm_udpm_subscribe (lcm_udpm.c:604)
==11504== by 0x5B6FE72: lcm_subscribe (lcm.c:303)
==11504== by 0x4E669DD: lcm::Subscription* lcm::LCM::subscribe<drc::robot_command_t, valkyrie_translator::LCM2ROSControl_LCMHandler>(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions