[ace-bugs] ACE: When closing first reactor all SignalHandlers of any other reactor are deregistered

thomas.kopp at securiton.ch thomas.kopp at securiton.ch
Mon Feb 15 04:01:43 CST 2016


    ACE VERSION: 6.3.3

    HOST MACHINE and OPERATING SYSTEM:
	amd64 Ubuntu 14.04 LTS

    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
	-
    COMPILER NAME AND VERSION (AND PATCHLEVEL):
	gcc (gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4)

    THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
    specific file, simply state which one]:
	#include "ace/config-linux.h"

    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
    use a link to a platform-specific file, simply state which one
    (unless this isn't used in this case, e.g., with Microsoft Visual
    C++)]:

    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
    (used by MPC when you generate your own makefiles):

    AREA/CLASS/EXAMPLE AFFECTED:
	ACE_Sig_Handler

    DOES THE PROBLEM AFFECT:
        COMPILATION? no
        LINKING? no
            On Unix systems, did you run make realclean first? yes
        EXECUTION? yes
        OTHER (please specify) no

    SYNOPSIS:
When closing first reactor all SignalHandlers of any other reactor are deregistered

    DESCRIPTION:
Let's assume a process with multiple threads each having its own reactor i.e. A and B. After
creating A, the caller is registering an EventHandler for one or multiple signals. On Reactor B
there are no EventHandlers registered processing signals. When closing Reactor B, the internal
ACE_Sig_Handler instance is destroyed. During it's destruction, handle_close() is called on the
EventHandler registered by Reactor A which thereby is deregistered. Reactor A will no longer 
receive signals.

>From my point of view, this is a missbehaviour: Only the EventHandlers registered by those reactor
which is shut down should be deregistered. The ones registered by other Reactors should remain untouched.

Background:
The problem was introduced while fixing bug 2368 (https://github.com/DOCGroup/ATCD/commit/1617ba1782a924563f37f1016c10ae00313c2388)
While destructing ACE_Sig_Handler we iterate over the static array which is shared through all ACE_Sig_Handler instances and hence all reactors.
This array contains pointers to all EventHandlers. When ACE_Sig_Handler::remove_handler_i(signum) is called
for every signal which has a registered handler, ALL EventHandlers processing signals will be deregistered - independent if they belong
to the reactor destroying the specific ACE_Sig_Handler instance or not.

    REPEAT BY:
The attach regression test shows the behaviour which one would assume to be correct.

    SAMPLE FIX/WORKAROUND:
See the attached patch.

It's correct to use a static array, as for every signum only one EventHandler can be registered. For my patch I introduced a local member to ACE_Sig_Handler, containing the EventHandlers registered via this specific instance. During destruction we can check, which EventHandlers are locally registered. Those are the only ones which will be deregistered.

Best regards,
Thomas
---------------------------------------------------------------------------------------------------------
This e-mail is confidential and may contain privileged information. It is intended only for the addressees. If you have received this e-mail in error, kindly notify us immediately by telephone or e-mail and delete the message from your system. 
---------------------------------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sighandler.patch
Type: application/octet-stream
Size: 5206 bytes
Desc: sighandler.patch
URL: <http://list.isis.vanderbilt.edu/pipermail/ace-bugs/attachments/20160215/325a0ec2/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Sig_Handler_Regression_Test.cpp
URL: <http://list.isis.vanderbilt.edu/pipermail/ace-bugs/attachments/20160215/325a0ec2/attachment.ksh>


More information about the ace-bugs mailing list