[tao-users] Problems regarding signal handling

[tao-users] Problems regarding signal handling

Post by Martin Bot » Wed, 02 Jul 2003 22:51:22


his is a multi-part message in MIME format.


Hi,

currently I have a problem regarding signal handling.

I using Windows XP, SP 1, and SuSe Linux 8.2, kernel 2.4.20, TAO
1.3.1, 1.3.2., 1.3.3

In earlier projects I used the following code for handling SIGINT,
SIGTERM of CORBA based
processes and it worked fine. Today I did some testing and figured out
that my example just
works anymore using TAO 1.3.1 and earlier. It failes with TAO 1.3.2 and
1.3.3
Can anybody of you give me a hint why?

Thanks a lot,
Martin


#include <tao/corba.h>

#include <tao/ORB_Core.h>

#include <tao/PortableServer/PortableServer.h>


#define IOR_FILE_NAME "ior.txt"


class SignalHandler : public ACE_Event_Handler {

private:

CORBA::ORB_var orb_var_;

public:

SignalHandler (CORBA::ORB_ptr orb_ptr)
: orb_var_(CORBA::ORB::_duplicate(orb_ptr)) {}

~SignalHandler(void) {}

virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * =
0) {
switch (signum)
{
case SIGTERM:
cerr << "SIGTERM occured, server is goind down!" <<endl;
orb_var_->shutdown(1);
break;
case SIGINT:
cerr << "SIGINT occured, server is going down!" << endl;
orb_var_->shutdown(1);
break;
default:
cerr << "unknown signal occured" << endl;
}
return 0;
}
};



int main(int argc, char* argv[]) {

CORBA::ORB_var ORBvar = CORBA::ORB_init(argc,argv);

CORBA::Object_var OBJvar =
ORBvar->resolve_initial_references("RootPOA");

SignalHandler* sigi = new SignalHandler(ORBvar.in());

if (ORBvar->orb_core()->reactor()->register_handler(SIGINT, sigi) ==
-1)
cerr << "could not register SIGINT" << endl;

if (ORBvar->orb_core()->reactor()->register_handler(SIGTERM, sigi) ==
-1)
cerr << "could not register SIGTERM" << endl;

if (ORBvar->orb_core ()->reactor ()->register_handler(SIGHUP, sigi) ==
-1)
cerr << "could not register SIGHUP" << endl;

ORBvar->run();

return 0;

}


<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid: XXXX@XXXXX.COM ">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:HyphenationZone>21</w:HyphenationZone>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w
 
 
 

[tao-users] Problems regarding signal handling

Post by to_ralp » Wed, 30 Jul 2003 22:33:47

Hello Martin Botzler,

I am using W2k (sp4) and RedHat Linux 8, running TAO 1.3.3

I also have this problem with my server. use something like:
TAO_ORB_Core_instance()->reactor()->register_handler(SIGINT, MyHandler)
and it worked fine with previous versions of TAO.

Have you found a solution yet ? Maybe you if there is a patch in TAO cvs ?

I'm thinking about trying to replace the code with ACE_Sig_Adapter or so.

Thanks for reading,
Cya
Ralph

 
 
 

[tao-users] Problems regarding signal handling

Post by Ralph Bast » Wed, 30 Jul 2003 23:44:43

alph Bastiaansen wrote:

I replaced TAO_ORB_Core_instance()->reactor() with ACE_Reactor::instance()
and now the code is working again.


 
 
 

[tao-users] Problems regarding signal handling

Post by Dennis Spo » Thu, 31 Jul 2003 10:57:09

owdy Ralph,

Ran into the same problem like yourself, works with normal ACE_Reactor,
not the ORB Reactor.

if you dont already have one, create a svc.conf file add

static Resource_Factory "-ORBReactorMaskSignals 1"

your program should pick up the svc.conf file automatically. if not
add -ORBsvcconf svc.conf to your commandline.

although i haven't tried it out. It looks promising.
good luck

cheers
Denn.


Ralph Bastiaansen wrote:


 
 
 

[tao-users] Problems regarding signal handling

Post by Ralph Bast » Fri, 01 Aug 2003 18:09:03

i Dennis,

thanks for your idea !
I've tried it and added a svc.conf file with static Resource_Factory
"-ORBReactorMaskSignals 1"
regretfully it did not work.

The only thing that works a the moment is to replace
TAO_ORB_Core_instance()->reactor() with ACE_Reactor::instance()
when calling ->register_handler(SIGINT, sigi)

But I prefer to get the reactor instance directly from the ORB. (I hope
that ACE_Reactor::instance() doesn't start a new reactor behind my back)
And it bugs me that I don't understand why one way it works and the
other way it doesn't.

thanks anyhow
Ralph

Dennis Sporcic wrote:

 
 
 

[tao-users] Problems regarding signal handling

Post by Dennis Spo » Tue, 05 Aug 2003 08:58:04

alph Bastiaansen wrote:

Thats unfortunate :( My source of information was here
http://www.cs.wustl.edu/~schmidt/ACE_wrappers/TAO/docs/Options.html#svcfonf



Yes agreed, on my side as well.


Agreed again.
I wonder if it uses the same instance as that of the ORB,
when ACE_Reactor::instance() is called or there are 2 reactors in memory ???



 
 
 

[tao-users] Problems regarding signal handling

Post by to_ralp » Tue, 02 Sep 2003 22:45:46

MISSING REPLY: ===========================================================

this is NOT a new question to the ACE/TAO mailinglist, just some missing
replies that I wanted add to archive, ... erhm sorry
==========================================================================

Hi Folks,

The following is from Martin Botzler
< XXXX@XXXXX.COM >.

thanks,

Doug

------- Forwarded Message

Hi,

the semantic changed with TAO 1.3.2, before signal handling was
supported now it switched off.

Martin

- -----Ursprgliche Nachricht-----
Von: XXXX@XXXXX.COM
[mailto: XXXX@XXXXX.COM ] Im Auftrag von Douglas C.
Schmidt
Gesendet: Dienstag, 29. Juli 2003 15:50
An: XXXX@XXXXX.COM ; XXXX@XXXXX.COM ; XXXX@XXXXX.COM
Betreff: [ace-users] Re: [tao-users] Problems regarding signal handling

Hi Ralph,

My guess is that what's happened here is that we're now using
the ACE_TP_Reactor as the default reactor for TAO. I don't think it
supports signal handling (Bala, can you please confirm/deny this)?
One possible solution would be to configure TAO to use the mt_select
reactor rather than the tp reactor.

Thanks,

Doug

MISSING REPLY: ===========================================================

Hi Ralph,

hope
back)

It doesn't...


As Bala and I indicated in our earlier posts, the default reactor for
TAO is now the ACE_TP_Reactor, which doesn't work correctly with
signals. However, the default reactor with ACE_Reactor::instance() is
the ACE_Select_Reactor, which works fine with signals.

OCI, it would be nice for someone to add this to the TAO FAQ!

Thanks,

Doug
--
Dr. Douglas C. Schmidt, Professor TEL: (615) 343-8197
Electrical Engineering and Computer Science FAX: (615) 343-7440
Vanderbilt University WEB:
www.cs.wustl.edu/~schmidt/
Nashville, TN 37203 NET:
XXXX@XXXXX.COM