Application coredumps on PA-RISC 11.23 on exit in emutls_destroy() (217 Views)
Reply
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 1 of 11 (217 Views)
Accepted Solution

Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

[ Edited ]

I have an multithreaded application running on HP-UX 11.23 PA-RISC, HP-UX 11.23 ia64, HP-UX 11.31 ia64. I use gcc 4.4.0 in order to build it.

It runs and correctly exits on HP-UX 11.23 ia64 and HP-UX 11.31 ia64. The problem is on HP-UX 11.23 PA-RISC. On this platform the application coredumps on exit. It seems that cause of the coredump is not in my code. I would appreciate some advice. Here is a backtrace.

HP gdb 5.9 for PA-RISC 2.0 (wide), HP-UX 11.00 and target hppa2.0w-hp-hpux11.00.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.9 (based on GDB) is covered by the GNU General Public License. Type "show copying" to see the conditions to change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) core-file ./core
Core was generated by `rating_server'.
Program terminated with signal 6, Aborted.

#0 0xc00000000020144c in kill+0x2c () from /lib/pa20_64/libc.2
(gdb) bt
#0 0xc00000000020144c in kill+0x2c () from /lib/pa20_64/libc.2
#1 0xc0000000001ad044 in raise+0x2c () from /lib/pa20_64/libc.2
#2 0xc0000000001e7768 in abort_C+0x180 () from /lib/pa20_64/libc.2
#3 0xc0000000001e77cc in abort+0x1c () from /lib/pa20_64/libc.2
#4 0x40000000002a094c in os_sp::app_env_log::sigsegv_handler (num=11, r=) at ../../../src/common/rating_shared/app_env_log.cpp:274
#5
#6 0xc0000000001a1434 in free+0x29c () from /lib/pa20_64/libc.2
#7 0xc000000000b05e40 in emutls_destroy (ptr=0x8000000100f275a8) at ../../../libgcc/../gcc/emutls.c:74
#8 0xc000000000b4df0c in __specific_data_thread_exit+0x32c () from /lib/pa20_64/libpthread.1
#9 0xc000000000b590f4 in pthread_exit+0x62c () from /lib/pa20_64/libpthread.1 #10 0x400000000027de44 in threads::thread::thread_proc (th=0x8000000100f66aa0) at ../../../src/common/rating_lib/threads.cpp:273
#11 0x400000000027dfdc in start_routine_thread (p_arg=) at ../../../src/common/rating_lib/threads.cpp:18
#12 0xc000000000b55cac in __pthread_bound_body+0xcc () from /lib/pa20_64/libpthread.1
#13 0xc000000000b8a4ec in __pthread_bound_start+0x14 () from /lib/pa20_64/libpthread.1
(gdb)

By the way, pthread library cumulative patch PHCO_39699 has been installed on the server.

 

 

P.S. This thread has been moved from HP-UX > General to HP-UX > languages - HP Forums Moderator

Please use plain text.
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 2 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

Want to clarify on point.

On HP-UX 11.23 ia64, HP-UX 11.31 ia64 gcc 4.3.1 is used.

On HP-UX 11.23 PA-RISC I have used gcc 4.3.1, gcc 4.3.3, gcc 4.4.0. Whatever version I used the application always coredumps in the emutls_destroy().
Please use plain text.
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 3 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

This link might be useful:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40024

Is anybody from HP has seen this thread?
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,784
Registered: ‎03-06-2006
Message 4 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

Your thread is aborting with a signal 11 in the heap routines. You either have corrupted the heap previously, or passing in a bad pointer to free.

>Is anybody from HP has seen this thread?

This looks like it may be the issue. I'll ask Monday.
Please use plain text.
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 5 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

> Your thread is aborting with a signal 11 in the heap routines. You either have corrupted the heap previously, or passing in a bad pointer to free.

Dennis,

By the way, It doesn't prove anything of course but we have another team in our company, they develop their program on the same platforms. Some time ago they changed their compiler from 3.4.4 to 4.3.1 and immediately experienced the same problem. Then they changed file emutls.c (line 74), recompiled gcc and everything worked OK. We have used their patched gcc 4.3.1 and our program also exited correctly.

What they changed is the emutls_destroy() function. On this link that I had posted earlier (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40024) it clearly stated that there was bug in gcc and they changed it in this way:
- for (i = 0; i < size; ++i)
+ for (i = 0; i < size - 1; ++i)

Your function has this code:
static void
emutls_destroy (void *ptr)
{
struct __emutls_array *arr = ptr;
pointer size = arr->size;
pointer i;

for (i = 0; i < size; ++i)
{
if (arr->data[i])
free (arr->data[i][-1]);
}

free (ptr);
}

Please use plain text.
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 6 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

Sorry, not "Your function has this code:"

Rather, HP function has this code:
Please use plain text.
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 7 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

Dennis,

I am wondering if there is any news related to my question? You said earlier that perhaps it was an issue.
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,784
Registered: ‎03-06-2006
Message 8 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

>I am wondering if there is any news related to my question?

I guess we didn't reply since you already had a solution.
Our expert says:
it looks like it was fixed in 4.3.4, 4.4.1, and 4.5.0. It looks like the user has 4.3.1 and 4.4.0 which would not have this fix in GCC.
Please use plain text.
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 9 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

Am I right that these versions are not yet available for downloading? I don't see them here http://www.hp.com/go/gcc.
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,784
Registered: ‎03-06-2006
Message 10 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

>Am I right that these versions are not yet available for downloading?

That's right. Perhaps early next year when 4.5.0 is finished.
Please use plain text.
Regular Advisor
blackwater
Posts: 129
Registered: ‎05-14-2009
Message 11 of 11 (217 Views)

Re: Application coredumps on PA-RISC 11.23 on exit in emutls_destroy()

I have been told that this problem will be fixed in gcc 4.3.4
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation