- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Hangup during regeneration of the signal
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-22-2002 10:44 AM
тАО10-22-2002 10:44 AM
Try the code, like:
void BadAccess() {
char *ptr = 0xABADC0DE;
if( *ptr ) { // SIGSEGV
}
}
void handler()
{
BadAccess();
}
int main( void )
{
sigset( SIGSEGV, handler );
BadAccess();
return 0; //never touched
}
I don't know what should be done (only killing with core seems to be logical), but definetly consuming 100% CPU forever is not the bes idea.
Is it bug in kernel, compiler (aCC), libraries? Could anyone chek it if it's happening always?
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2002 12:57 AM
тАО10-23-2002 12:57 AM
Re: Hangup during regeneration of the signal
I know that during execution of handler the signal is blocked (and I think this causes the problem). Someone could suggest that the signal is generated, but blocked, so it waits for execution of the handler to be finished and then calls it again. So the handler is called over and over again and I get 100% CPU usage.
No.
I've checked it several times. The first call of the handler never returns. It is stopped at bad memory access forever.
I cannot change the handler. Its not mine it is a part of DCE library which I have to use. I don't know what this handler should do. Actually I think that it is idiotic to try to do something more when process corrupts memory, but DCE is done that way and I cannot do anything about it.
Is it possible that nobody had that problem before me? Is it so specific? Guyz, please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2002 09:00 AM
тАО10-23-2002 09:00 AM
Re: Hangup during regeneration of the signal
The answer is don't block those signals. If you write a signal handler for those signals then it should be very cautious. It should either reset the signal handler or unblock the signal as soon as you enter the handler. If you switch to sigaction instead of sigset you can use the SA_RESETHAND or SA_NODEFER flags to make that change before even entering your signal handler.
If you leave the handler active and use SA_NODEFER you should have a very early check for recursion to avoid infinite recursion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-24-2002 01:35 AM
тАО10-24-2002 01:35 AM
Re: Hangup during regeneration of the signal
If I undestood right I would have to reinstall DCE handler with another flag, namly SA_NODEFER?
And if the situation is reproduced my process will blow up with stack overflow? (By the way - will it work correctly in multithread?)
Well this is a sort of solution, but I'm not sure how and when DCE installs its handlers. It is possible that it decides to make reinstallation after my play with it (as a result to some event for example). And I'm not willing to poll it periodically.
However the idea is worth to try.
I thought that, as it is probabilly easy for OS to discover that process stops inside handler with blocked signal, as it is not delayed for the next execution of the handler, but it is a real stop, there is somewhere available some sort of patch to always generate core in such situation.
That would solve simmilar problem completelly with every handler and every signal.
Luckilly for me one of my colegues found a patch on DCE library that allows process to generate core when SIGSEGV. Again, I don't know how they did it (I guess they removed that idiotic handler completelly), but this makes me happy.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-24-2002 10:47 AM
тАО10-24-2002 10:47 AM
SolutionPerhaps the best fix for DCE applications is to have all dangerous code, (aka ALL CODE),
inside some TRY/RECOVER block.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-24-2002 11:40 PM
тАО10-24-2002 11:40 PM
Re: Hangup during regeneration of the signal
That was extremly precise description, I'm impressed how people are willing to help on this forum. I appreciate the time you've spent for me in this docs, you definetly earned the points.
By the way, if someone had simmilar problem I've found another tepmorar sollution. I patched sigset() and sigaction() (with help of information I've found in manuals for dlsym() and how to patch malloc() and free() ).
If someone tries to install 'permanent' handler (SA_RESETHAND not set) I install my special handler with SA_RESETHAND set. This special handler calls the original handler and at the end reinstalls itself, again with SA_RESETHAND set.
Why all this stuff?
During execution of the original handler, the SIG_DFL is set, so if it is SIGSEGV and is regenerated from the handler core will be dumped.
Why I dont like this either?
Signal handlers are shared among threads. If, during execution of the handler by one thread SIGSEGV will be generateg by another thread it will find SIG_DFL handling. But that signal launch the original handler - mayby it is correct situation, predefined by the programmers and for this the handler was installed. If I didn't use threads this could be accepted, but how can you ommit threads in DCE?
And the last thing is:
I still think it is idiotic to use SIGSEGV handler for any usefull work. It should be left exclusivelly for program failures. Another thing is that the handlers are shared among all threads (however executed by every thread independly), so using it to check if it was called from any specific block of code (like TRY/RECOVER) is not the cleanest way. Especially because DCE was designed to be multithread.
Mayby I shouldn't write it as an answer to my queston. :)