Operating System - HP-UX
1837791 Members
3083 Online
110120 Solutions
New Discussion

Re: strftime() causes SIGBUS, Bus error

 
Siva Shanmugam
New Member

strftime() causes SIGBUS, Bus error

In HP-UX 11.00.01, strftime() causes SIGBUS violation sometimes.

There are about 12 places where this function was used in the product, and
about 4 of them have been found to be malfunctioning. The same code was
perfectly ok on HP-UX 10.20, so chances of any memory/storage problems are not
there.

Also not sure if this is related to the context switching problem.

gdb stack back trace was used to track the bug.
------------------------------------------------
Program received signal SIGBUS, Bus error.
0x148a8c in __strftime_std () from slpi_sce_sample
(gdb) bt
#0 0x148a8c in __strftime_std () from slpi_sce_sample
#1 0xc0192fec in _strftime () from /usr/lib/libc.2
#2 0x10bd98 in bcd_enc_DateAndTime () from slpi_sce_sample
------------------------------------------------
P.S Are there any alternatives to this function call?
2 REPLIES 2
Gregory Lajon_2
New Member

Re: strftime() causes SIGBUS, Bus error

Hi,

From my experience, I can say that what causes
sigbus or sigsegv is not necessary the portion of
code that was executed at the time the process
was killed. It actually can be far away.

Depending on the OS and compiler, ie the way the
memory is managed, an error in a program can rise
as a fault or remain hidden.

You can try to replace those calls with some others,
from a library, and see if you still have the problem.

There is a commercial software called purify that
could help. On Linux, the equivalent one is Electric
Fence, but I have never tested it.

Hope this helps,

Greg.
Siva Shanmugam
New Member

Re: strftime() causes SIGBUS, Bus error

If I use strftime.o from the previous release of HP-UX 11.00.00, and link it in
my executable on my current version of HP-UX 11.00.01, this WORKS, and there is
no problem in any of the occurences.

I still suspect strftime() on 11.00.01