[Bug 759] New: ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

Summary: ControlTaskServer::CleanupServer causing segfault
Product: RTT
Version: rtt-trunk
Platform: All
OS/Version: All
Status: NEW
Severity: blocker
Priority: P3
Component: Corba
AssignedTo: orocos-dev [..] ...
ReportedBy: kiwi [dot] net [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Demonstrated in Snow Leopard and Koala from
b9a6e5d771e404c40857953fb9d667e89d63cdb2 (RTT) and
cc34f4aed86c08664cdfbd53fa93210e54c10ed5 (OCL) (OCL does needs some extra
patches to compile on Snow Leopard).

Just run the deployer-corba-TARGET with "--require" and no name server present.
Seg faults for me. I also get the same kind of fault if the name server is
present, but a component fails to configure/start. When quitting the deployer,
the seg fault occurs. I've started tracking it down, but it's really murky in
there ... :-(
Stephen

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

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

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

--- Comment #12 from Peter Soetens <peter [..] ...> 2010-12-21 11:00:44 ---
Was fixed in 1.12.0

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #11 from Peter Soetens <peter [..] ...> 2010-04-29 15:40:49 ---
Created an attachment (id=594)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=594)
Seems to fix this bug with given case.

This patch goes into the direction of notifying the ControlTaskServer when a
TaskContext is deleted. Does not break RTT unit tests, and does not crash
deployment file of this bug. Worth considering.

[Bug 759] ControlTaskServer::CleanupServer causing segfault

On Apr 29, 2010, at 09:40 , Peter Soetens wrote:

> https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759
>
>
>
>
>
> --- Comment #11 from Peter Soetens <peter [..] ...> 2010-04-29 15:40:49 ---
> Created an attachment (id=594)
> --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=594)
> Seems to fix this bug with given case.
>
> This patch goes into the direction of notifying the ControlTaskServer when a
> TaskContext is deleted. Does not break RTT unit tests, and does not crash
> deployment file of this bug. Worth considering.

Patch appears to fix bug in Snow Leopard and Koala.
Stephen

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #10 from S Roderick <kiwi [dot] net [..] ...> 2010-04-08 14:17:04 ---
Created an attachment (id=593)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=593)
Valgrind log from Koala

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #9 from S Roderick <kiwi [dot] net [..] ...> 2010-04-08 14:16:23 ---
Created an attachment (id=592)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=592)
Deployment file causing crash

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

S Roderick <kiwi [dot] net [..] ...> changed:

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

--- Comment #8 from S Roderick <kiwi [dot] net [..] ...> 2010-04-08 14:05:09 ---
Bug remains on exit from deployer. Deployment file and valgrind log attached.

>From Koala w/ trunk (RTT at 8f901195d4d1d28879bae61ed0d1b88f6e64473f and OCL at
cc34f4aed86c08664cdfbd53fa93210e54c10ed5). I had to make the component a Corba
server to trigger the fault. I simply started the deployer and immediately
quit.

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

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

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

--- Comment #7 from Peter Soetens <peter [..] ...> 2010-03-16 11:22:53 ---
(In reply to comment #2)
> This fixes the problem, but I don't know that it is the correct solution.
>
>

> diff --git a/src/corba/ControlTaskServer.cpp b/src/corba/ControlTaskServer.cpp
> index 4c56811..1ebc5c1 100644
> --- a/src/corba/ControlTaskServer.cpp
> +++ b/src/corba/ControlTaskServer.cpp
> @@ -153,6 +153,7 @@ namespace RTT
>                      std::string  err("ControlTask '" + taskc->getName() + "'
> could not find CORBA Naming Service.");
>                      if (require_name_service) {
>                          log(Error) << err << endlog();
> +                        servers.erase(taskc);
>                          throw IllegalServer(err);
>                      }
>                      else
> 

This fix is correct. I committed it to 1.0 trunk.

Peter

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #6 from Peter Soetens <peter [..] ...> 2010-03-16 10:50:20 ---
(In reply to comment #5)
> (In reply to comment #4)
> > Created an attachment (id=591)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=591) [details] [details]
> > Snow leopard backtrace when a component fails to configure
>
> I'll try to reproduce it. Don't see the bug on first sight, but I did recently
> rumble with the cleanup code. I'll check it with the --require flag.

Yep, reproduced here.

Peter

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

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

What |Removed |Added
----------------------------------------------------------------------------
CC| |peter [..] ...
Status|NEW |ASSIGNED

--- Comment #5 from Peter Soetens <peter [..] ...> 2010-03-11 00:25:17 ---
(In reply to comment #4)
> Created an attachment (id=591)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=591) [details]
> Snow leopard backtrace when a component fails to configure

I'll try to reproduce it. Don't see the bug on first sight, but I did recently
rumble with the cleanup code. I'll check it with the --require flag.

Peter

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #4 from S Roderick <kiwi [dot] net [..] ...> 2010-03-10 13:54:50 ---
Created an attachment (id=591)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=591)
Snow leopard backtrace when a component fails to configure

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #3 from S Roderick <kiwi [dot] net [..] ...> 2010-03-10 13:53:32 ---
Still have a problem if a component fails to configure/start.

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #2 from S Roderick <kiwi [dot] net [..] ...> 2010-03-09 23:19:01 ---
This fixes the problem, but I don't know that it is the correct solution.

diff --git a/src/corba/ControlTaskServer.cpp b/src/corba/ControlTaskServer.cpp
index 4c56811..1ebc5c1 100644
--- a/src/corba/ControlTaskServer.cpp
+++ b/src/corba/ControlTaskServer.cpp
@@ -153,6 +153,7 @@ namespace RTT
                     std::string  err("ControlTask '" + taskc->getName() + "'
could not find CORBA Naming Service.");
                     if (require_name_service) {
                         log(Error) << err << endlog();
+                        servers.erase(taskc);
                         throw IllegalServer(err);
                     }
                     else

[Bug 759] ControlTaskServer::CleanupServer causing segfault

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=759

--- Comment #1 from S Roderick <kiwi [dot] net [..] ...> 2010-03-09 22:56:00 ---
Created an attachment (id=590)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=590)
Backtrace from Snow Leopard