- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Crash in a socket application
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
Forums
Discussions
Discussions
Discussions
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
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
06-11-2007 12:18 AM
06-11-2007 12:18 AM
munmap(0x7ed60000, 1052672) ........................................................................................... = 0
shutdown(5, SHUT_RDWR) ................................................................................................ = 0
recv(5, 0x4025b4a0, 8191, 0) .......................................................................................... ERR#9 EBADF
close(5) .............................................................................................................. = 0
Received signal 11, SIGSEGV, in user mode, [SIG_DFL], partial siginfo
Siginfo: si_code: SEGV_MAPERR, faulting address: 0x200000007ed58bb8, si_errno: 0
PC: 00000001000000a0.0 break.m 0x16000
exit(11) [implicit] ................................................................................................... WIFSIGNALED(SIGSEGV)|WCOREDUMP
When run from gdb, it does not crash. Also, if you put a small delay between shutdown() and close() system calls, it works file.
It does not crash on Solaris and HP PA-RISC systems.
Does anyone have any idea about this problem?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2007 01:39 AM
06-11-2007 01:39 AM
SolutionAlso, if you put a small delay between shutdown() and close() system calls, it works file.
Is this not already fixex then? Or is the solution unacceptable.
First thing I'd check would be library and compiler patches.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 12:09 AM
06-12-2007 12:09 AM
Re: Crash in a socket application
Also, why the same code works on other platforms and not on Itanium?
Need to find the root cause of the problem. :)
Tried playing with gdb and core file today, and got following output.
Program terminated with signal 11, Segmentation fault.
#0 0x60000000c42df7d0:0 in dld_bor_text_entry + 0x30 ()
from /usr/lib/hpux32/dld.so
Not much help on the net about dld_bor_text_entry in dld.so.
Can you please point me to library and compiler patches related to this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 12:30 AM
06-12-2007 12:30 AM
Re: Crash in a socket application
#0 0x60000000c42df7d0:0 in dld_bor_text_entry + 0x30 /usr/lib/hpux32/dld.so
Did you use bt? Or was this all bt gave you?
BOR is Bind On Reference. If you use "chatr -B immediate a.out" you can skip this code.
Can you disassemble this?
(gdb) disas $pc-16*4 $pc+16*4
>Can you please point me to library and compiler patches related to this?
Not that I think it will help but you can try the latest linker/dld patch, PHSS_36336.
Do you have threads? It may be a thread stack overflow??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 01:38 AM
06-12-2007 01:38 AM
Re: Crash in a socket application
Yes, that was all bt gave me.
>BOR is Bind On Reference. If you >use "chatr -B immediate a.out" you can >skip this code.
Yes, it did work. So linking the application with -Wl,-B,immediate option solves the problem.
But why it fails with BOR?? How can we find that out?
Also, how does putting a small delay helps BOR?
>Can you disassemble this?
Here is the output of disassemble,
(gdb) disas $pc-16*4 $pc+16*4
Dump of assembler code from 0x60000000c42df790:0 to 0x60000000c42df810:0:
0x60000000c42df790:0 <__do_error+0x30>: br.ret.sptk.few b0
0x60000000c42df790:1 <__do_error+0x31>: nop.b 0x0
0x60000000c42df790:2 <__do_error+0x32>: nop.b 0x0;;
0x60000000c42df7a0:0
alloc r40=ar.pfs,0,11,2,0;;
0x60000000c42df7a0:1
0x60000000c42df7a0:2
mov r42=r44;;
0x60000000c42df7b0:0
adds r2=-8,r12;;
0x60000000c42df7b0:1
adds r12=-176,r12
0x60000000c42df7b0:2
0x60000000c42df7c0:0
0x60000000c42df7c0:1
0x60000000c42df7c0:2
0x60000000c42df7d0:0
0x60000000c42df7d0:1
0x60000000c42df7d0:2
0x60000000c42df7e0:0
0x60000000c42df7e0:1
0x60000000c42df7e0:2
---Type
0x60000000c42df7f0:0
0x60000000c42df7f0:1
0x60000000c42df7f0:2
0x60000000c42df800:0
0x60000000c42df800:1
0x60000000c42df800:2
0x60000000c42df810:0
End of assembler dump.
>Do you have threads? It may be a thread >stack overflow??
It has only two threads.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 04:28 AM
06-12-2007 04:28 AM
Re: Crash in a socket application
By finding out the thread and the thread stack size.
>how does putting a small delay helps BOR?
It may be related to timing? It may be related to which thread gets a signal??
>It has only two threads.
Two total, or a main and two threads?
What is your thread stack size??
You have a thread stack overflow.
0x60000000c42df7d0:0: st8 [r2]=r3,-8;;
BOR needs a 176 byte frame, you are writing to the very top of it and hitting the guard page.
The call site is $br0-16. To get name do:
(gdb) x /i $br0-16
To get SP which may identify which thread:
(gdb) p /x $r12
(gdb) info thread
By looking at the tusc's mmap & mprotect calls, you might be able to figure out which thread contains the above $r12 value.
- Tags:
- guard page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 05:07 AM
06-12-2007 05:07 AM
Re: Crash in a socket application
If that code segment was meaning to indicate to the client that it should close, and the recv was to await the read return of zero from the client's FIN, then the shutdown() call should be SHUT_WR, not SHUT_RDWR. Otherwise, you might just as well call close() in the first place.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2007 01:17 AM
06-13-2007 01:17 AM
Re: Crash in a socket application
There is one main thread which creates one thread for recv on a socket.
You are right, increasing the stack size for second thread did solve the problem.
But why does it work on PA-RISC with same stack size?
Of the two solutions available, which one is better? Increasing the stack size OR linking the application with -Wl,B,immediate?
What are the impacts/drawbacks of them?
Rick,
Yes, we will look into that issue. Thanks. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2007 02:17 PM
06-13-2007 02:17 PM
Re: Crash in a socket application
You are only imagining it is the same. :-)
On IPF, there are two stacks, the RSE stack and the normal stack. So you may have to double the size. (Since libpthread doesn't know the right ratio of the two.)
>Of the two solutions available, which one is better?
Obviously increasing the stack size. You may have other thread stack overflows without BOR.
>What are the impacts/drawbacks of them?
Using bind immediate will cause longer startups. If your application runs for days, this is moot. BOR spreads this cost over the execution, until everything is called once. Also spreading the cost also has extra overhead, more than if you did it at once at the start.
The biggest drawback is the fact that you may be depending on ignoring an uncalled unsat that would be caught with -B immediate. Of course you can use -B nonfatal with -B immediate.
Since you only have one thread, the size issue is moot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2007 12:24 AM
09-17-2007 12:24 AM