[Bug 615] New: event_test fails sometimes

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=615>
Summary: event_test fails sometimes
Product: RTT
Version: rtt-trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Tests
AssignedTo: orocos-dev [..] ...
ReportedBy: ruben [dot] smits [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Like 2 out of 3 times event_test fails, sometimes due to an exception,
sometimes a segfault. I have no idea why: some of my observations:

if i execute the event-test seperatly, it almost never succeeds:
Below two different fails.

./event-test
............2.388 [ FATAL ][./event-test::main()] Single Thread
NonPeriodicActivity caught a C++ exception, stopping thread !
Segmentation fault

rsmits@rsmits-macbook:~/workspace/rtt/Debug/tests$ ./event-test
pure virtual method called
terminate called without an active exception
........Aborted

If i execute the complete test-suite, it usually succeeds:

Test command: /home/rsmits/workspace/rtt/Debug/tests/event-test
Test timeout computed to be: 9.99988e+06
.....................

OK (21)
-- Process completed
Passed

In the attachment the gdb output and backtrace of the two kind of failures i
could detect

[Bug 615] event_test fails sometimes

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=615>

Peter Soetens <peter [dot] soetens [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED

--- Comment #5 from Peter Soetens <peter [dot] soetens [..] ...> 2009-02-01 00:01:25 ---
Fix applied on trunk. Can't be backported to RTT 1.6.x. Apply the
patch from this bug in case you need it anyway.

Sending rtt/src/impl/signal_base.hpp
Sending rtt/src/signal_base.cpp
Transmitting file data ..
Committed revision 29888.

[Bug 615] event_test fails sometimes

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=615>

--- Comment #4 from Peter Soetens <peter [dot] soetens [..] ...> 2009-01-31 12:17:25 ---
Ok. I could confirm this and fix it. The bug is in the reference counting of
'connection'
objects. When an event is emitted, the connection reference count is raised by
one
to avoid the destruction during the emit. At the end of the emit the refcount
is decreased again.

This mechanism was not implemented thread-safe, but with plain ints. I changed
the int to OS::AtomicInt and used dec_and_test().

[Bug 615] event_test fails sometimes

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=615>

--- Comment #3 from Peter Soetens <peter [dot] soetens [..] ...> 2009-01-31 12:16:38 ---
Created an attachment (id=378)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=378)
Changes the refcount to AtomicInt

[Bug 615] event_test fails sometimes

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=615>

Peter Soetens <peter [dot] soetens [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
CC| |peter [dot] soetens [..] ...

--- Comment #2 from Peter Soetens <peter [dot] soetens [..] ...> 2009-01-30 17:09:34 ---
(In reply to comment #0)
> Like 2 out of 3 times event_test fails, sometimes due to an exception,
> sometimes a segfault. I have no idea why: some of my observations:
> if i execute the event-test seperatly, it almost never succeeds:

Please rebuild your RTT library using the cmake system. It's possible that your
custom build system did not set the correct options for your architecture.

Also make sure you got the version where a breakLoop() is implemented in the
unit test's runner EmitAndCount class.

The event tests all succeed(ed) in thousands of runs on a dual core AMD64
platform. I'll retest, but since then no changs were made.

Ruben Smits's picture

[Bug 615] event_test fails sometimes

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=615>

--- Comment #1 from Ruben Smits <ruben [dot] smits [..] ...> 2009-01-30 16:59:36 ---
Created an attachment (id=377)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=377)
gdb output