Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Program getting hung in std::ios_base::Init::~Init. Need help!!

 
Highlighted
Occasional Visitor

Program getting hung in std::ios_base::Init::~Init. Need help!!

Hi all,
My program is getting hung in the std::ios_base::Init::~Init function call, and need help on what I am doing wrong.

Really appreciate any kind of help.
Thanks,
Regards,
Ranga.

Here is the call stack:
#0 0xc000000000662360 in pthread_mutex_unlock+0 ()
from /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libpthread.1
#1 0xc000000000811e98 in __thread_mutex_unlock+0x80 ()
from /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libc.2
#2 0xc00000000054e194 in _HPMutexWrapper::unlock+0x34 ()
from /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libstd_v2.2
#3 0xc000000000513114 in std::ios_base::Init::~Init+0x104 ()
from /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libstd_v2.2
#4 0xc000000000395388 in __cxxTerm_body+0x48 ()
from /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libCsup_v2.2
#5 0xc0000000003953e8 in __cxxTerm+0x20 ()
from /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libCsup_v2.2
#6 0xc0000000007c3428 in exit+0x80 ()
from /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libc.2
#7 0x40000000000220b8 in main () at test_server.cpp:86
5 REPLIES 5
Highlighted
Honored Contributor

Re: Program getting hung in std::ios_base::Init::~Init. Need help!!

It's a bit difficult to tell, without actually knowing what your code is trying to do. What is in test_server.cpp?
Highlighted
Occasional Visitor

Re: Program getting hung in std::ios_base::Init::~Init. Need help!!

Clarification, I am using a cross compiler to compile the app on HPUX-11.23. As long as the cross compiler is mounted it picks the libs from those directories, i.e., /build/PA_IA/ux/vbe/usr/lib/pa20_64, otherwise, it picks it from the standard /usr/lib/pa20_64. Either way the result is the same.

Appreciate any help on this.
Thanks,
Ranga.
Highlighted
Occasional Visitor

Re: Program getting hung in std::ios_base::Init::~Init. Need help!!

Hi Stephen,
Thanks for replying.

It's a typical client/server application. server listens and forks off on each client's request. It's a test application that tests various APIs.

This same application runs fine on PA32, and even on IA64, but not on PA64.

I am compiling it with -DPTHREAD_COMPAT_MODE. So, I can use older platform built thirdparty libs.

Why is it getting hung in the std::ios_base::Init::~Init while doing a mutex unlock? Any ideas!

[Is there something that I need to take care of while doing a fork, and using -DPTHREAD_COMPAT_MODE? (If I don't use this flag, I get unresolved symbol on pthread_attr_init.)]
--
Ranga.

Highlighted
Honored Contributor

Re: Program getting hung in std::ios_base::Init::~Init. Need help!!

Again, without seeing the actual code, it's difficult to diagnose. For instance in 32-bit mode, a long and an int are both the same size, in 64-bit mode they aren't. You could be slicing a structure by using an inappropriate variable type for example.

The code appears to be processing the exit() call in your main() section. This could be as the result of an explicit exit(), an implicit exit() or a simple return. Can you write a short piece of code that demonstrates the problem? Can you compile it with debugging symbols and use a debugger to see what is happening, as a stack trace isn't particularly useful.
Highlighted
Acclaimed Contributor

Re: Program getting hung in std::ios_base::Init::~Init. Need help!!

>My program is getting hung in the std::ios_base::Init::~Init function call
#0 0xc000000000662360 in pthread_mutex_unlock+0 /build/PA_IA/ux/vbe/pa/usr/lib/pa20_64/libpthread.1

 

Is it hanging or did you get a signal?  It shouldn't hang on the first instruction of pthread_mutex_unlock.

Also, it is better if you use the shlibs in /usr/lib/ for libs like libc and libpthread.