LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-29-2019, 09:38 AM   #1
sindh
LQ Newbie
 
Registered: Aug 2014
Posts: 28

Rep: Reputation: Disabled
Segmentation fault while running a c++ program on AIX


Segmentation fault resulted while running a c++ program that creates maps from tables.

1. Program created files of size 392MB
2. failed with generating core. gdb didn't give any failure message related to program.

Please find the below details:
#1
uname -a
AIX work 1 6 000CEA68D700

#2
ulimts for the system as below:
core file size (blocks) unlimited
data seg size (kbytes) unlimited
file size (blocks) unlimited
max memory size (kbytes) unlimited
stack size (kbytes) unlimited
cpu time (seconds) unlimited
pipe size (512 bytes) 64
open files 65534
virtual memory (kbytes) 4194302


#3
Process stats just before it failed:
#ps aux | head -1; ps aux | sort -rn +2 | head -10
USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
Broken pipe
root 14614718 24.8 0.0 132 136 - A May 29 131162:55 yes
root 131076 11.7 0.0 448 448 - A Apr 10 341998:24 wait
root 917532 11.1 0.0 448 448 - A Apr 10 324137:13 wait
root 983070 10.4 0.0 448 448 - A Apr 10 302968:26 wait
root 1048608 9.7 0.0 448 448 - A Apr 10 283044:28 wait
root 23068854 3.9 0.0 25456 27024 - A 07:35:51 8:30 ./scan -home:/
work 24051892 3.6 4.0 262264 262740 pts/25 A 08:24:27 0:57 ./myprogram
root 19333240 0.5 1.0 69556 55720 - A Jun 08 13667:32 /opt/BESClient
root 2687146 0.1 0.0 612 304 - A Apr 10 1529:59 /usr/sbin/sync


Highlighted the process I am running in red.

Please let me know if I am missing anything here.
 
Old 08-29-2019, 09:48 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,283

Rep: Reputation: 858Reputation: 858Reputation: 858Reputation: 858Reputation: 858Reputation: 858Reputation: 858
Segmentation fault usually means access to an illegal virtual address. You have to talk to the author(s) of the program.

By the way, AIX is not Linux, but perhaps it's permissible to post AIX questions here.
 
Old 08-29-2019, 09:52 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,010
Blog Entries: 13

Rep: Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451Reputation: 3451
The presumption here is that this is your source file.

If so:
Please give the version information for your C++ compiler.
Please give the full compile command used.
Besides what you have shown, how have you attempted to debug this? Such as any form of symbolic debugging or debug print statements?

@berndbausch,

Sorry we crossed paths with our replies. I was planning, and have moved, this thread to Programming. Doesn't matter the OS for that forum.

Last edited by rtmistler; 08-29-2019 at 09:53 AM.
 
Old 08-30-2019, 05:48 AM   #4
sindh
LQ Newbie
 
Registered: Aug 2014
Posts: 28

Original Poster
Rep: Reputation: Disabled
@berndbausch, @rtmistler,

Thanks for your response on this. I got a solution for this today.

I added the below env variable, and reran the test. And it worked for me. It turned out that it was due to the default size limit in memory allocation on AIX. we must set the following environment variable to allocate more than 256MB on AIX
export LDR_CNTRL=MAXDATA=0x80000000
more info about this variable:https://www.ibm.com/support/knowledg...ldr_cntrl.html

Now, my doubt is, what is the default size limit for memory allocation in other unix/linux flavors, what is the maximum allowed and does it impact other processes(in terms of performance) if we do so?

Thanks,
Sindh

Last edited by sindh; 08-30-2019 at 06:00 AM.
 
Old 08-30-2019, 06:14 AM   #5
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,283

Rep: Reputation: 858Reputation: 858Reputation: 858Reputation: 858Reputation: 858Reputation: 858Reputation: 858
Quote:
Originally Posted by sindh View Post

Now, my doubt is, what is the default size limit for memory allocation in other unix/linux flavors, what is the maximum allowed and does it impact other processes(in terms of performance) if we do so?
I believe there is no limit by default, and the limit can be set with the shell's ulimit command or the setrlimit() system call.

Limiting a process' data size ensures that it can't consume all the memory. It forces proceses to be good citizens, and ensures that processes with memory leaks will eventually be unable to allocate more memory. Indirectly, it can improve overall system performance by limiting memory usage.
 
Old 08-30-2019, 11:15 AM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,844

Rep: Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320
@OP: To summarize: you should move from 32-bit to 64-bit.

Last edited by NevemTeve; 08-30-2019 at 11:17 AM.
 
  


Reply

Tags
aix, core dump, memory errors, segmentation fault


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] segmentation fault(core dumped) while running wireless simulation rc49 Linux - Newbie 3 08-13-2015 09:15 AM
[SOLVED] Segmentation fault while trying to run C program. jahobjafwar Programming 2 07-28-2011 09:10 PM
[SOLVED] segmentation fault while running Clonezilla laginagesh Linux - Software 4 09-09-2009 01:00 AM
segmentation fault while running ymessenger felnlily Linux - Software 3 02-03-2005 03:01 AM
Segmentation fault while running RPM KaruppuSwamy.T Linux - General 5 12-03-2004 05:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration