Operating System - HP-UX
1823079 Members
3389 Online
109645 Solutions
New Discussion

pthread_mutex_init problem (Bus error - core dump)

 
Milan Stojanovic
Occasional Advisor

pthread_mutex_init problem (Bus error - core dump)

Hi,

Running APEX 3.2 (ADA95) debbuger on program that core dump with the Bus error (on N4000-55 with HP-UX 11.0) produceses following error report

Debugging: /exports/devel/hats/layer5/dama.ss/hp_at3_1_00_offline.wrk/units/dama_adaptation_data_flf/dama_adaptation_data_fast_load_file_driver.
Opened view /exports/devel/hats/layer5/dama.ss/hp_at3_1_00_offline.wrk.
Opened views in link closure of dama_adaptation_data_fast_load_file_driver.
Set breakpoint [1] procedure __ADA_ELAB at 06432680: stw r2, -014(sp)
/exports/devel/hats/layer5/dama.ss/hp_at3_1_00_offline.wrk/units/dama_adaptation_data_flf/dama_adaptation_data_fast_load_file_driver
Warning: In non-Ada task, selecting an Ada task.
=> runtime tasking structures have not yet been initialized.
process received signal "Bus error" [10]
stopped in pthread_mutex_init
at 0790cb3b4: ldw 0(r4), r31



Any sugestion ?

TIA

Mila
1 REPLY 1
inactive account
Frequent Advisor

Re: pthread_mutex_init problem (Bus error - core dump)

The default stacksize in thread created with pthread_create on HP-UX is 64K which is usually too small...
We had this problem with our applications (coded in C++) and we had to increase the stacksize to 512K so that our applications run correctly.
Here is a abstract of our code to set the stack size for the new thread:
#if (defined __hpux__)
// F1020701 : Taille des piles allou??es pour les threads sous HPUX.
// La taille est ici fix??e ?? 512 Ko. Si cela ne pose pas de probl??me,
// la laisser ainsi, sinon essayer les valeurs suivantes
const size_t pthreadStackSize = 524288;
// Stack : 256 Ko
// const size_t pthreadStackSize = 262144;
// Stack : 128 Ko
// const size_t pthreadStackSize = 131072;
// Stack : 96 Ko
// const size_t pthreadStackSize = 1024;
#endif

#if (defined __hpux__)
// On alloue l'espace m??moire n??cessaire au pthread_attr_t
if((l4_error = pthread_attr_init(&lc_pthreadAttr)))
{
mb_taskAct = FALSE;
#if (defined __tg_debug__)
cout << ka_funcName << "pthread_attr_init error " << l4_error
<< flush << endl;
#endif
throw(TgExcepSys("pthread_attr_init", l4_error, 0));
}
// On change la taille de stack par defaut.
if((l4_error = pthread_attr_setstacksize(&lc_pthreadAttr,
pthreadStackSize)))
{
mb_taskAct = FALSE;
#if (defined __tg_debug__)
cout << ka_funcName << "pthread_attr_setstacksize error " << l4_error
<< flush << endl;
#endif
throw(TgExcepSys("pthread_attr_setstacksize", l4_error, 0));
}
if((l4_error = pthread_create(&mc_task, &lc_pthreadAttr,
(void *(*)(void *)) taskMainLoop, this)))
#else
if((l4_error = pthread_create(&mc_task, NULL,
(void *(*)(void *)) taskMainLoop, this)))
#endif