1747984 Members
4528 Online
108756 Solutions
New Discussion юеВ

Re: SIGBUS Error

 
SOLVED
Go to solution
ShivS
Frequent Advisor

SIGBUS Error

Hi,

The SIGBUS is happening when the memory (allocated as new SomeClass[]) is de-allocated using delete[]. Note that the memory that the system tries to allocate could be as high as 1541262816 bytes.

Following are the details of the machine I am having the SIGBUS error:

$uname -a
HP-UX ocpdev1 B.11.11 U 9000/800 ocpdev1 unlimited-user license

Following are some of the kernel parameters (output from kmtune):
Parameter: maxdsiz
Current: 1073741824
Planned: 1073741824
Default: 0x10000000

Parameter: maxdsiz_64bit
Current: 8589934592
Planned: 8589934592
Default: 0x0000000040000000

Parameter: maxfiles
Current: 260
Planned: 260
Default: 60

Parameter: maxfiles_lim
Current: 1024
Planned: 1024
Default: 1024

Parameter: maxssiz
Current: 134217728
Planned: 134217728
Default: 0x00800000

Parameter: maxssiz_64bit
Current: 268435456
Planned: 268435456
Default: 0x00800000

Parameter: maxtsiz
Current: 134217728
Planned: 134217728
Default: 0x04000000

Parameter: maxtsiz_64bit
Current: 0x40000000
Planned: 0X40000000
Default: 0x0000000040000000

1) Can somebody please explain the meaning of the above mentioned kernel parameters?
2) Do these parameters require any change? Are there any change?
3) Are there any side effects by increasing/decreasing these parameters?
4) Should I look at any other parameters?

Output of ulimit:
$ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 1048576
stack(kbytes) 131072
memory(kbytes) unlimited
coredump(blocks) 4194303

Thanks in advance!

-Shiv


5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: SIGBUS Error

Hi Shiv:

A SIGBUS error is a memory access error that occurs when your program tries to point to an invalid memory address. A NULL pointer is one example. This is a program bug.

As for the kernel parameters mentioned, the manpages (for 11.23 for example) offer some good descriptions. The 'maxdsiz' parameters control the size of data segments (the heap and what you 'malloc()'). The 'maxxsiz' parameters fence the stack size for your program. The 'maxtsiz' parameter controls the maxiumum text (instruction) size. The ones labeled 64-bit are for 64-bit processes; those without the "64" are for 32-bit processes.

The 'maxfiles' and 'maxfiles_lim' do not relate to memory but rather to the maxiumum number of file descriptors a process may have. The first is the "soft" limit; the second is the "hard" limit.

Regards!

...JRF...
ShivS
Frequent Advisor

Re: SIGBUS Error

Hi James,

Thanks for your reply.

The program did allocate memory using new and did its job, but it failed while delet[]'ing this memory. This is what is bothering me. If it did allocate, then why should it give a SIGBUS while deleting it.

Note that the memory that the program tries to allocate could be as high as 1541262816 bytes. There are other objects that are allocated and yet to be deleted when this memory is being allocated.

From the details that I provided, do I have to change any of the kernel parametes?

Thanks again!
-Shiv
Dennis Handly
Acclaimed Contributor

Re: SIGBUS Error

>The program did allocate memory using new and did its job, but it failed while delete[]'ing this memory.

Then you have corrupted the heap.
Do you have a stack trace of your signal?

>Note that the memory that the program tries to allocate could be as high as 1.541 Gb.

Unless you link with -N, or compile with +DD64, you can't get bigger than 1 Gb.

>From the details that I provided, do I have to change any of the kernel parameters?

Is this a 64 bit application? If not, your maxdsiz is too small.

Otherwise, you have to debug your application. See the following how to use gdb:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1320687
ShivS
Frequent Advisor

Re: SIGBUS Error

Hi Dennis,

Thanks for your reply.

Following are the compiler options that are used in the project:

-g -Wl,+n,-a,archive -D_HPUX_SOURCE +DA2.0W

I am not sure what does the option +n in -Wl,+n mean. Sometimes I see -Wl,+s also. I am not sure what +s option means here.

Based on above information, can you give some suggestions?

Thanks
Shiv
Dennis Handly
Acclaimed Contributor

Re: SIGBUS Error

>Following are the compiler options that are used in the project:
-g -Wl,+n,-a,archive +DA2.0W

You are 64 bit. But you should replace the obsolete +DA2.0W by +DD64. You probably should also split up the two linker options:
-Wl,+n -Wl,-a,archive

>I am not sure what does the option +n in -Wl,+n mean. Sometimes I see -Wl,+s also.

Look at ld(1) for +n (keep scanning archives) and +s (allow SHLIB_PATH/LD_LIBRARY_PATH).

>can you give some suggestions?

Again, download wdb and debug the heap corruption as in the above URL.