Skip navigation.
The QNX Community Portal

View topic - showmem crash with signal 11(get_mem_info)

Page 1 of 1

showmem crash with signal 11(get_mem_info)

PostPosted: Wed Jul 05, 2017 4:46 am
by Qinrui.Yang
when we test the pid memory, we call showmem -P pid every 1 minute, after about 10 hours, we found the issue (showmem crash with signal 11).

i debug the core file via gdb, you can see the result.
(gdb) bt
#0 0x00103364 in get_mem_info (fd=<value optimized out>, shared_blocks=<value optimized out>, opts=<value optimized out>) at /builds/650SP1/latest/svn/utils/s/showmem/extractmaps.c:394
#1 0x00103d64 in build_block_list (pidlist=<value optimized out>, pidnum=<value optimized out>, opts=<value optimized out>) at /builds/650SP1/latest/svn/utils/s/showmem/extractmaps.c:539
#2 0x00104420 in main (argc=2, argv=0xffce4) at /builds/650SP1/latest/svn/utils/s/showmem/showmem.c:131

due to no source code of showmem, maybe someonce can give some suggestion about the issue, thanks a lot!

Re: showmem crash with signal 11(get_mem_info)

PostPosted: Wed Jul 05, 2017 2:53 pm
by maschoen
The following reply is IMHO just common sense.

It seems like you are using a utility intended for investigation and debugging in a production manner. I know it is very in fashion these days to try to throw mash things together this way rather than understanding your real need and writing real code. In other words, laziness. Of course this is the type of result you get. Why you think this is an issue is unclear. Can't you just retry?

I suspect the crash comes from one of two places. It might be that the PID you are using has expired in some way, such as the process exiting or crashing, but maybe showmem does not handle this well. This would be easy to test, eg. "showmem -P 0" Another possibility is you have discovered a rare bug in showmem that shows up about once in every 600 runs. You could try to test this by repeatedly enter the command, but I think you have better things to do with your time. It could be a race condition that you can't reproduce manually. The bug might be in the showmem program, or it might be in the get_mem_info() call. You could try to get the source from QNX, but unless you have a service contract, I wouldn't count on it. Even with a contract, getting attention can be like pulling teeth these days.

There is however something you can do. Presumably you want to monitor the memory usage of one of your own processes. This is already a red flag, suggesting you have poorly written out of control code, but maybe you have no choice. So you can look up the API for get_mem_info() and write your own utility that you will have the source code for. If you can't find any docs, then find out how the OS allows you to get the information you need.

Re: showmem crash with signal 11(get_mem_info)

PostPosted: Thu Jul 06, 2017 1:04 am
by Qinrui.Yang
hi Mashoen,

thanks for your reply.

the background is the 3st application has some memory issue and need to monitor the PID mem status, so they use showmem to get the info.

i agree with your suggestion, and test with "showmem -P 1", i think PID 1(procnto-smp-instr) should be normal all the time.

that can help us to get the direction(PID issue or showmem bug).