<?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: Exception with large data member crashes ? Or something else (code fore review attached) in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029821#M97809</link>
    <description>If you are throwing a large object, you must have room for it on your stack.  If you have several throws, there are separate temps generated and that may exceed your 64Kb default thread stack.  You have 5 AgentException in ff1.  So you have 5 * 12 * 4024.  Way too big for the default thread stack size.  You need to use pthread_attr_setstacksize(3) or pthread_default_stacksize_np(3) to make it larger.&lt;BR /&gt;&lt;BR /&gt;Or create the objects on the heap and manually destroy them.</description>
    <pubDate>Wed, 21 Feb 2007 21:53:27 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-02-21T21:53:27Z</dc:date>
    <item>
      <title>Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029819#M97807</link>
      <description>I want to understand who is the exact culprit.&lt;BR /&gt;&lt;BR /&gt;1) typedef ExceptionIdF&lt;LONG&gt; AgentException;&lt;BR /&gt;&lt;BR /&gt;2) char Mylog::str[5*4048];&lt;BR /&gt;&lt;BR /&gt;3) rethrow&lt;BR /&gt;&lt;BR /&gt;4) anything else?&lt;BR /&gt;&lt;BR /&gt;The attached program core dumps.&lt;BR /&gt;&lt;BR /&gt;This is the narrower version of the actual big code that is coring.&lt;BR /&gt;&lt;BR /&gt;---------------&lt;BR /&gt;Bus error (core dumped)&lt;BR /&gt;-rw-------   1 vikrantl   Developm   6334372 Feb 21 20:45 core&lt;BR /&gt;HP gdb 5.1.1 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00&lt;BR /&gt;and target hppa1.1-hp-hpux11.00.&lt;BR /&gt;Copyright 1986 - 2001 Free Software Foundation, Inc.&lt;BR /&gt;Hewlett-Packard Wildebeest 5.1.1 (based on GDB) is covered by the&lt;BR /&gt;GNU General Public License. Type "show copying" to see the conditions to&lt;BR /&gt;change it and/or distribute copies. Type "show warranty" for warranty/support.&lt;BR /&gt;..&lt;BR /&gt;Core was generated by `mutliex'.&lt;BR /&gt;Program terminated with signal 10, Bus error.&lt;BR /&gt;BUS_UNKNOWN - Unknown Error&lt;BR /&gt;#0  0xce20 in ff1 () at mutliex.cpp:216&lt;BR /&gt;216     {&lt;BR /&gt;(gdb) #0  0xce20 in ff1 () at mutliex.cpp:216&lt;BR /&gt;#1  0xd9f8 in ff2 () at mutliex.cpp:261&lt;BR /&gt;#2  0xda40 in ff3 () at mutliex.cpp:267&lt;BR /&gt;#3  0xda9c in ff4 () at mutliex.cpp:275&lt;BR /&gt;#4  0xde4c in dispatch2 (arg=0x40020368) at mutliex.cpp:340&lt;BR /&gt;#5  0xc2e98220 in ACE_OS_Thread_Adapter::invoke (this=0x40010920)&lt;BR /&gt;    at OS_Thread_Adapter.cpp:94&lt;BR /&gt;#6  0xc2e97ef8 in ace_thread_adapter (args=0x40010920)&lt;BR /&gt;    at Base_Thread_Adapter.cpp:122&lt;BR /&gt;#7  0xc005acc0 in __pthread_body+0x44 () from /usr/lib/libpthread.1&lt;BR /&gt;#8  0xc0063d04 in __pthread_start+0x14 () from /usr/lib/libpthread.1&lt;BR /&gt;(gdb) bash-3.00$ pwd&lt;BR /&gt;/export/homes/vikrantl/good50/VxAM/Current/source/sicl&lt;BR /&gt;bash-3.00$ tar cvf my.prg.tar mutliex.&lt;BR /&gt;mutliex.cpp  mutliex.o&lt;BR /&gt;bash-3.00$ tar cvf my.prg.tar mutliex.pp mym.sh&lt;BR /&gt;tar: cannot stat mutliex.pp.  Not dumped.&lt;BR /&gt;a mym.sh 5 blocks&lt;BR /&gt;bash-3.00$ tar cvf my.prg.tar mutliex.cpp mym.sh&lt;BR /&gt;a mutliex.cpp 21 blocks&lt;BR /&gt;a mym.sh 5 blocks&lt;BR /&gt;bash-3.00$&lt;/LONG&gt;</description>
      <pubDate>Wed, 21 Feb 2007 20:47:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029819#M97807</guid>
      <dc:creator>v2_1</dc:creator>
      <dc:date>2007-02-21T20:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029820#M97808</link>
      <description>patch info. attached</description>
      <pubDate>Wed, 21 Feb 2007 20:52:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029820#M97808</guid>
      <dc:creator>v2_1</dc:creator>
      <dc:date>2007-02-21T20:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029821#M97809</link>
      <description>If you are throwing a large object, you must have room for it on your stack.  If you have several throws, there are separate temps generated and that may exceed your 64Kb default thread stack.  You have 5 AgentException in ff1.  So you have 5 * 12 * 4024.  Way too big for the default thread stack size.  You need to use pthread_attr_setstacksize(3) or pthread_default_stacksize_np(3) to make it larger.&lt;BR /&gt;&lt;BR /&gt;Or create the objects on the heap and manually destroy them.</description>
      <pubDate>Wed, 21 Feb 2007 21:53:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029821#M97809</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-02-21T21:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029822#M97810</link>
      <description>void ff1()&lt;BR /&gt;throw (AgentException)&lt;BR /&gt;{&lt;BR /&gt;    Mylog m("ff1");&lt;BR /&gt;    return;&lt;BR /&gt;#if 1&lt;BR /&gt;&lt;BR /&gt;Hi Dennis Handly, thanks for the direction.&lt;BR /&gt;&lt;BR /&gt;Even if I return before the actual line where the Exception would be thrown, would that space be consumed?&lt;BR /&gt;&lt;BR /&gt;Secondly, for the original program, I see this problem occuring only on HP-UX, any of 11.x, any comments?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;-V2</description>
      <pubDate>Wed, 21 Feb 2007 21:58:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029822#M97810</guid>
      <dc:creator>v2_1</dc:creator>
      <dc:date>2007-02-21T21:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029823#M97811</link>
      <description>And one more thing, this happens only if the ff functions are called from more than one threads.&lt;BR /&gt;&lt;BR /&gt;Does the stack size for all the threads add up for the max. stack size? Or each gets to use the max. stack size?</description>
      <pubDate>Wed, 21 Feb 2007 22:00:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029823#M97811</guid>
      <dc:creator>v2_1</dc:creator>
      <dc:date>2007-02-21T22:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029824#M97812</link>
      <description>&amp;gt;Even if I return before the actual line where the Exception would be thrown, would that space be consumed?&lt;BR /&gt;&lt;BR /&gt;Yes on PA.  But not for IPF, exceptions are allocated in the heap.  (Use all you want, we'll make more.  :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I see this problem occuring only on HP-UX, any of 11.x, any comments?&lt;BR /&gt;&lt;BR /&gt;Other OSes may have larger default thread stacks.  Or they may not allocate exceptions on the stack.  Or they may not be as sloppy as aCC3.  :-(&lt;BR /&gt;&lt;BR /&gt;&amp;gt;This happens only if the ff functions are called from more than one threads.&lt;BR /&gt;&lt;BR /&gt;Yes, it happens only when you are on a thread stack, not the main thread, which has a giant stack.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Does the stack size for all the threads add up for the max stack size? Or each gets to use the max stack size?&lt;BR /&gt;&lt;BR /&gt;Each thread gets pthread_attr_setstacksize.  The main thread gets maxssiz.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Feb 2007 23:04:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029824#M97812</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-02-21T23:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029825#M97813</link>
      <description>Is there any way i can use an API to find out the current utilization on the stack?&lt;BR /&gt;Somthing like pthread_attr_getstacksize?</description>
      <pubDate>Thu, 22 Feb 2007 10:27:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029825#M97813</guid>
      <dc:creator>v2_1</dc:creator>
      <dc:date>2007-02-22T10:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029826#M97814</link>
      <description>&amp;gt;Is there any way i can use an API to find out the current utilization on the stack?&lt;BR /&gt;Something like pthread_attr_getstacksize?&lt;BR /&gt;&lt;BR /&gt;pthread_attr_getstacksize will only give you the current value of your attributes when you create the thread.  Otherwise you'll have to get the initial thread stack addreses and the current SP value.  I was going to mention how to do this in gdb but it was obvious why you were aborting.&lt;BR /&gt;&lt;BR /&gt;So for your stack trace:&lt;BR /&gt;(gdb) frame 9&lt;BR /&gt;(gdb) p /x $save_sp = $sp&lt;BR /&gt;(gdb) frame 0&lt;BR /&gt;(gdb) p $sp - $save_sp&lt;BR /&gt;&lt;BR /&gt;(For IPF the stack grows in the other direction.)&lt;BR /&gt;&lt;BR /&gt;If you wanted to approximate an API, you could take the address of your parm in ace_thread_adapter and take the address of some local in your current function and the difference would be a rough estimate of your usage.</description>
      <pubDate>Thu, 22 Feb 2007 18:11:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029826#M97814</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-02-22T18:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029827#M97815</link>
      <description>You have currently have not assigned any points.  If you have gotten your answers you should look at:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;</description>
      <pubDate>Fri, 23 Feb 2007 20:27:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029827#M97815</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-02-23T20:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Exception with large data member crashes ? Or something else (code fore review attached)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029828#M97816</link>
      <description>Thanks Dennis for excellent direction from you, I have resolved the issue by setting a larger stack size for the pthreads.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;-V2</description>
      <pubDate>Mon, 26 Feb 2007 14:23:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/exception-with-large-data-member-crashes-or-something-else-code/m-p/5029828#M97816</guid>
      <dc:creator>v2_1</dc:creator>
      <dc:date>2007-02-26T14:23:27Z</dc:date>
    </item>
  </channel>
</rss>

