Calls to cfg_get(tm, tm_cfg, default_reason) and cfg_get(tm, tm_cfg, tm_auto_inv_100_r) on Solaris/SPARC cause a bus error. Looking though some mailing list archives, it appears a similar issue was fixed in the registrar module but I couldn't find patch referenced.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655
This usually happens when the field in the structure is not 32bit aligned. However, upon quick look, it seems to be in this case. It is sparc 64, right?
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-223909626
Hi Daniel,
Yes this is sparc64. I did some digging and added some logging to try to find out whats going on. The is no bus error from the main process during init. I suspect commit 1b366aa1c6c37e2320da10fb68f0370199333f5d might have something to do with it as I reverted part of that in cfg_destroy_groups to fix another bus error during shutdown. It looks like the pointer assignment *(char **) causes issues for some reason.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-223967667
Not sure if that is the reason, old patch, but you can try and report the result.
Maybe the pointer needs to be 8byte aligned in this case, I will try to search more on this topic.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-224016189
Hi Daniel, It appears that the pointer does need to be 8 byte aligned. Do you have any suggestions for debugging this further? Any idea why the bus error only on the child processes? I'm happy to provide access to hardware and any relevant backtraces.
Thanks for your help!
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-224206354
Can you try with master branch? I pushed a patch to relocate the pointers at the beginning of the structure, so they should be aligned now.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-224282415
Hi Daniel, Unfortunately I'm still getting the bus error in the child processes. I added the following debug ``` diff --git a/modules/tm/tm.c b/modules/tm/tm.c index 29a7326..cb972df 100644 --- a/modules/tm/tm.c +++ b/modules/tm/tm.c @@ -824,6 +824,7 @@ static int mod_init(void) tm_ctx_init(); #endif tm_init = 1; + LOG(L_ERR, "tm_auto_inv_100_r: %s\n", cfg_get(tm, tm_cfg, tm_auto_inv_100_r)); return 0; }
@@ -844,6 +845,7 @@ static int child_init(int rank) " generator\n"); return -2; } + LOG(L_ERR, "tm_auto_inv_100_r: %s\n", cfg_get(tm, tm_cfg, tm_auto_inv_100_r)); return 0; } ``` When kamailio starts up, I receive the below log messge
0(4498) ERROR: tm [tm.c:827]: mod_init(): tm_auto_inv_100_r: Trying Bus Error (core dumped)
Program terminated with signal 10, Bus error. #0 0xfffffffed125b2b4 in child_init (rank=-127) at tm.c:848 848 LOG(L_ERR, "tm_auto_inv_100_r: %s\n", cfg_get(tm, tm_cfg, tm_auto_inv_100_r));
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-224684993
Also I tried a 32 bit build and it seems to be ok. Here are the 64bit complier flags: gcc -fPIC -DPIC -g -funroll-loops -fno-strict-overflow -ftree-vectorize -Wall -O2 -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9 -DNAME='"kamailio"' -DVERSION='"5.0.0-dev5"' -DARCH='"sparc64"' -DOS='solaris_' -DOS_QUOTED='"solaris"' -DCOMPILER='"gcc 4.8.2"' -D__CPU_sparc64 -D__OS_solaris -DSER_VER=5000000 -DCFG_DIR='"/opt/kamailio/etc/kamailio/"' -DRUN_DIR='"/var/run/kamailio/"' -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC -DTLSF_MALLOC -DDBG_SR_MEMORY -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS -DMALLOC_STATS -DWITH_AS_SUPPORT -DUSE_SCTP -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DSPARC64_MODE -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD -DHAVE_ALLOCA_H -DUSE_SIGACTION -DHAVE_DEVPOLL -DHAVE_SELECT -DHAVE_FILIO_H -DSER_MOD_INTERFACE -DWITH_EVENT_LOCAL_REQUEST -DMO D_NAME='"tm"' -c tm.c -o tm.o -MMD -MP
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-224687574
Hi Daniel, I had a chance to do some more testing with a 32 bit build and the bus error with the tm_cfg struct is not present but there are others: Program terminated with signal 10, Bus error. #0 0x0018ceb0 in sip_msg_shm_clone ()
I realize that not many people are using SPARC so thanks very much for your assistance. We can provide hardware if that would help.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-226892448
Got into a bit of traveling lately, with no time to pursue on this issue. Having access to the hardware will be useful, indeed. Maybe we can discuss for remote access sometime next week.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-227352654
Hi Daniel, Is there any debugging info that would be helpful? Do you have any idea why the bus error occurs in the child process but not the main? I don't know if that provides any clues as to where I should look.
Thanks!
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-229242650
Hi Daniel, I found it! The cfg_block_t struct was 4 byte aligned because of sizeof(atomic_t) = 4. I added an int _pad which fixes the bus error on Sparc64.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-229988302
Closed #655.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#event-712035085
Fixed in master by merging the PR #693, to be backported.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/655#issuecomment-230290191