<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Crash in a socket application in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052198#M542243</link>
    <description>&amp;gt;But why does it work on PA-RISC with same stack size?&lt;BR /&gt;&lt;BR /&gt;You are only imagining it is the same.  :-)&lt;BR /&gt;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.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Of the two solutions available, which one is better?&lt;BR /&gt;&lt;BR /&gt;Obviously increasing the stack size.  You may have other thread stack overflows without BOR.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;What are the impacts/drawbacks of them?&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Since you only have one thread, the size issue is moot.</description>
    <pubDate>Wed, 13 Jun 2007 21:17:30 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-06-13T21:17:30Z</dc:date>
    <item>
      <title>Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052190#M542235</link>
      <description>We have a client socket application sending and receiving some data. It crashes on HPUX Itanium systems. The tusc utility shows following output,&lt;BR /&gt;&lt;BR /&gt;munmap(0x7ed60000, 1052672) ........................................................................................... = 0&lt;BR /&gt;shutdown(5, SHUT_RDWR) ................................................................................................ = 0&lt;BR /&gt;recv(5, 0x4025b4a0, 8191, 0) .......................................................................................... ERR#9 EBADF&lt;BR /&gt;close(5) .............................................................................................................. = 0&lt;BR /&gt;  Received signal 11, SIGSEGV, in user mode, [SIG_DFL], partial siginfo&lt;BR /&gt;    Siginfo: si_code: SEGV_MAPERR, faulting address: 0x200000007ed58bb8, si_errno: 0&lt;BR /&gt;     PC: 00000001000000a0.0             break.m 0x16000&lt;BR /&gt;exit(11) [implicit] ................................................................................................... WIFSIGNALED(SIGSEGV)|WCOREDUMP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When run from gdb, it does not crash. Also, if you put a small delay between shutdown() and close() system calls, it works file.&lt;BR /&gt;&lt;BR /&gt;It does not crash on Solaris and HP PA-RISC systems.&lt;BR /&gt;&lt;BR /&gt;Does anyone have any idea about this problem?</description>
      <pubDate>Mon, 11 Jun 2007 07:18:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052190#M542235</guid>
      <dc:creator>Steve_The_King</dc:creator>
      <dc:date>2007-06-11T07:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052191#M542236</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Also, if you put a small delay between shutdown() and close() system calls, it works file.&lt;BR /&gt;&lt;BR /&gt;Is this not already fixex then? Or is the solution unacceptable.&lt;BR /&gt;&lt;BR /&gt;First thing I'd check would be library and compiler patches.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 11 Jun 2007 08:39:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052191#M542236</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-06-11T08:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052192#M542237</link>
      <description>Putting in the delay would cause performance issues.&lt;BR /&gt;Also, why the same code works on other platforms and not on Itanium?&lt;BR /&gt;Need to find the root cause of the problem. :)&lt;BR /&gt;&lt;BR /&gt;Tried playing with gdb and core file today, and got following output.&lt;BR /&gt;&lt;BR /&gt;Program terminated with signal 11, Segmentation fault.&lt;BR /&gt;#0  0x60000000c42df7d0:0 in dld_bor_text_entry + 0x30 ()&lt;BR /&gt;   from /usr/lib/hpux32/dld.so&lt;BR /&gt;&lt;BR /&gt;Not much help on the net about dld_bor_text_entry in dld.so.&lt;BR /&gt;&lt;BR /&gt;Can you please point me to library and compiler patches related to this?&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jun 2007 07:09:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052192#M542237</guid>
      <dc:creator>Steve_The_King</dc:creator>
      <dc:date>2007-06-12T07:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052193#M542238</link>
      <description>Well, we would need a stack trace, bt.&lt;BR /&gt;&lt;BR /&gt;#0 0x60000000c42df7d0:0 in dld_bor_text_entry + 0x30 /usr/lib/hpux32/dld.so&lt;BR /&gt;&lt;BR /&gt;Did you use bt?  Or was this all bt gave you?&lt;BR /&gt;&lt;BR /&gt;BOR is Bind On Reference.  If you use "chatr -B immediate a.out" you can skip this code.&lt;BR /&gt;&lt;BR /&gt;Can you disassemble this?&lt;BR /&gt;(gdb) disas $pc-16*4 $pc+16*4&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Can you please point me to library and compiler patches related to this?&lt;BR /&gt;&lt;BR /&gt;Not that I think it will help but you can try the latest linker/dld patch, PHSS_36336.&lt;BR /&gt;&lt;BR /&gt;Do you have threads?  It may be a thread stack overflow??</description>
      <pubDate>Tue, 12 Jun 2007 07:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052193#M542238</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-12T07:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052194#M542239</link>
      <description>&amp;gt;Did you use bt? Or was this all bt gave &amp;gt;you?&lt;BR /&gt;&lt;BR /&gt;Yes, that was all bt gave me.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;BOR is Bind On Reference. If you &amp;gt;use "chatr -B immediate a.out" you can &amp;gt;skip this code.&lt;BR /&gt;&lt;BR /&gt;Yes, it did work. So linking the application with -Wl,-B,immediate option solves the problem.&lt;BR /&gt;But why it fails with BOR?? How can we find that out? &lt;BR /&gt;Also, how does putting a small delay helps BOR?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Can you disassemble this?&lt;BR /&gt;Here is the output of disassemble,&lt;BR /&gt;&lt;BR /&gt;(gdb) disas $pc-16*4 $pc+16*4&lt;BR /&gt;Dump of assembler code from 0x60000000c42df790:0 to 0x60000000c42df810:0:&lt;BR /&gt;0x60000000c42df790:0 &amp;lt;__do_error+0x30&amp;gt;:       br.ret.sptk.few  b0&lt;BR /&gt;0x60000000c42df790:1 &amp;lt;__do_error+0x31&amp;gt;:       nop.b            0x0&lt;BR /&gt;0x60000000c42df790:2 &amp;lt;__do_error+0x32&amp;gt;:       nop.b            0x0;;&lt;BR /&gt;0x60000000c42df7a0:0 &lt;DLD_BOR_TEXT_ENTRY&gt;:&lt;BR /&gt;          alloc            r40=ar.pfs,0,11,2,0;;&lt;BR /&gt;0x60000000c42df7a0:1 &lt;DLD_BOR_TEXT_ENTRY&gt;:        mov              r41=r43&lt;BR /&gt;0x60000000c42df7a0:2 &lt;DLD_BOR_TEXT_ENTRY&gt;:&lt;BR /&gt;          mov              r42=r44;;&lt;BR /&gt;0x60000000c42df7b0:0 &lt;DLD_BOR_TEXT_ENTRY&gt;:&lt;BR /&gt;          adds             r2=-8,r12;;&lt;BR /&gt;0x60000000c42df7b0:1 &lt;DLD_BOR_TEXT_ENTRY&gt;:&lt;BR /&gt;          adds             r12=-176,r12&lt;BR /&gt;0x60000000c42df7b0:2 &lt;DLD_BOR_TEXT_ENTRY&gt;:       nop.i            0x0;;&lt;BR /&gt;0x60000000c42df7c0:0 &lt;DLD_BOR_TEXT_ENTRY&gt;:       nop.m            0x0&lt;BR /&gt;0x60000000c42df7c0:1 &lt;DLD_BOR_TEXT_ENTRY&gt;:       mov              r3=b0&lt;BR /&gt;0x60000000c42df7c0:2 &lt;DLD_BOR_TEXT_ENTRY&gt;:       nop.b            0x0;;&lt;BR /&gt;0x60000000c42df7d0:0 &lt;UNWIND_RP&gt;:             st8              [r2]=r3,-8;;&lt;BR /&gt;0x60000000c42df7d0:1 &lt;UNWIND_RP&gt;:         mov              r43=r16&lt;BR /&gt;0x60000000c42df7d0:2 &lt;UNWIND_RP&gt;:         nop.i            0x0;;&lt;BR /&gt;0x60000000c42df7e0:0 &lt;UNWIND_RP&gt;:        mov              r44=r15;;&lt;BR /&gt;0x60000000c42df7e0:1 &lt;UNWIND_RP&gt;:        mov.m            r3=ar.unat&lt;BR /&gt;0x60000000c42df7e0:2 &lt;UNWIND_RP&gt;:        nop.i            0x0;;&lt;BR /&gt;---Type &lt;RETURN&gt; to continue, or q &lt;RETURN&gt; to quit---&lt;BR /&gt;0x60000000c42df7f0:0 &lt;UNWIND_RP&gt;:        st8              [r2]=r3,-8;;&lt;BR /&gt;0x60000000c42df7f0:1 &lt;UNWIND_RP&gt;:        st8.spill        [r2]=r8,-24&lt;BR /&gt;0x60000000c42df7f0:2 &lt;UNWIND_RP&gt;:        nop.i            0x0;;&lt;BR /&gt;0x60000000c42df800:0 &lt;UNWIND_RP&gt;:        stf.spill        [r2]=f8,-16;;&lt;BR /&gt;0x60000000c42df800:1 &lt;UNWIND_RP&gt;:        stf.spill        [r2]=f9,-16&lt;BR /&gt;0x60000000c42df800:2 &lt;UNWIND_RP&gt;:        nop.i            0x0;;&lt;BR /&gt;0x60000000c42df810:0 &lt;UNWIND_RP&gt;:        stf.spill        [r2]=f10,-16;;&lt;BR /&gt;End of assembler dump.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Do you have threads? It may be a thread &amp;gt;stack overflow??&lt;BR /&gt;It has only two threads.&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/RETURN&gt;&lt;/RETURN&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/UNWIND_RP&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;&lt;/DLD_BOR_TEXT_ENTRY&gt;</description>
      <pubDate>Tue, 12 Jun 2007 08:38:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052194#M542239</guid>
      <dc:creator>Steve_The_King</dc:creator>
      <dc:date>2007-06-12T08:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052195#M542240</link>
      <description>&amp;gt;But why it fails with BOR?? How can we find that out?&lt;BR /&gt;&lt;BR /&gt;By finding out the thread and the thread stack size.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;how does putting a small delay helps BOR?&lt;BR /&gt;&lt;BR /&gt;It may be related to timing?  It may be related to which thread gets a signal??&lt;BR /&gt;&lt;BR /&gt;&amp;gt;It has only two threads.&lt;BR /&gt;&lt;BR /&gt;Two total, or a main and two threads?&lt;BR /&gt;What is your thread stack size??&lt;BR /&gt;&lt;BR /&gt;You have a thread stack overflow.&lt;BR /&gt;0x60000000c42df7d0:0: st8 [r2]=r3,-8;;&lt;BR /&gt;&lt;BR /&gt;BOR needs a 176 byte frame, you are writing to the very top of it and hitting the guard page.&lt;BR /&gt;&lt;BR /&gt;The call site is $br0-16.  To get name do:&lt;BR /&gt;(gdb) x /i $br0-16&lt;BR /&gt;To get SP which may identify which thread:&lt;BR /&gt;(gdb) p /x $r12&lt;BR /&gt;(gdb) info thread&lt;BR /&gt;&lt;BR /&gt;By looking at the tusc's mmap &amp;amp; mprotect calls, you might be able to figure out which thread contains the above $r12 value.</description>
      <pubDate>Tue, 12 Jun 2007 11:28:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052195#M542240</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-12T11:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052196#M542241</link>
      <description>After you've gotten the SIGSEGV thing worked-out, you may want to address the lingering bug of calling recv against a socket  on which the code has called shutdown(SHUT_RDWR).&lt;BR /&gt;&lt;BR /&gt;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.</description>
      <pubDate>Tue, 12 Jun 2007 12:07:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052196#M542241</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2007-06-12T12:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052197#M542242</link>
      <description>&lt;BR /&gt;There is one main thread which creates one thread for recv on a socket.&lt;BR /&gt;You are right, increasing the stack size for second thread did solve the problem.&lt;BR /&gt;But why does it work on PA-RISC with same stack size?&lt;BR /&gt;&lt;BR /&gt;Of the two solutions available, which one is better? Increasing the stack size OR linking the application with -Wl,B,immediate?&lt;BR /&gt;What are the impacts/drawbacks of them?&lt;BR /&gt;&lt;BR /&gt;Rick,&lt;BR /&gt;Yes, we will look into that issue. Thanks. :)&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Jun 2007 08:17:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052197#M542242</guid>
      <dc:creator>Steve_The_King</dc:creator>
      <dc:date>2007-06-13T08:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052198#M542243</link>
      <description>&amp;gt;But why does it work on PA-RISC with same stack size?&lt;BR /&gt;&lt;BR /&gt;You are only imagining it is the same.  :-)&lt;BR /&gt;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.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Of the two solutions available, which one is better?&lt;BR /&gt;&lt;BR /&gt;Obviously increasing the stack size.  You may have other thread stack overflows without BOR.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;What are the impacts/drawbacks of them?&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Since you only have one thread, the size issue is moot.</description>
      <pubDate>Wed, 13 Jun 2007 21:17:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052198#M542243</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-13T21:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Crash in a socket application</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052199#M542244</link>
      <description>Closing the Thread.</description>
      <pubDate>Mon, 17 Sep 2007 07:24:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crash-in-a-socket-application/m-p/5052199#M542244</guid>
      <dc:creator>Steve_The_King</dc:creator>
      <dc:date>2007-09-17T07:24:40Z</dc:date>
    </item>
  </channel>
</rss>

