2

我正在尝试为我的应用程序禁用核心转储,我改变了ulimit -c 0

但是,每当我尝试使用 gdb 附加到该进程时,gdb --pid=<pid>然后 gcore 我仍然会获得该应用程序的核心转储。我正在使用 bash:

-bash-3.2$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 65600
max locked memory       (kbytes, -l) 50000000
max memory size         (kbytes, -m) unlimited
open files                      (-n) 131072
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 131072
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
-bash-3.2$ ps -ef | grep top
oracle    8951  8879  0 Mar05 ?        00:01:44 /u01/R122_EBS/fs1/FMW_Home/jrockit32 jre/bin/java -classpath /u01/R122_EBS/fs1/FMW_Home/webtier/opmn/lib/wlfullclient.jar:/u01/R122_EBS/fs1/FMW_Home/Oracle_EBS-app1/shared-libs/ebs-appsborg/WEB-INF/lib/ebsAppsborgManifest.jar:/u01/R122_EBS/fs1/EBSapps/comn/java/classes -mx256m oracle.apps.ad.tools.configuration.RegisterWLSListeners -appsuser APPS -appshost rws3510293 -appsjdbcconnectdesc jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS=(PROTOCOL=tcp)(HOST=rws3510293.us.oracle.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=rahulshr))) -adtop /u01/R122_EBS/fs1/EBSapps/appl/ad/12.0.0 -wlshost rws3510293 -wlsuser weblogic -wlsport 7001 -dbsid rahulshr -dbhost rws3510293 -dbdomain us.oracle.com -dbport 1521 -outdir /u01/R122_EBS/fs1/inst/apps/rahulshr_rws3510293/appltmp/Tue_Mar_5_00_42_52_2013 -log /u01/R122_EBS/fs1/inst/apps/rahulshr_rws3510293/logs/appl/rgf/Tue_Mar_5_00_42_52_2013/adRegisterWLSListeners.log -promptmsg hide -contextfile /u01/R122_EBS/fs1/inst/apps/rahulshr_rws3510293/appl/admin/rahulshr_rws3510293.xml
oracle   23694 22895  0 Mar05 pts/0    00:00:00 top
oracle   26235 22895  0 01:51 pts/0    00:00:00 grep top
-bash-3.2$ gcore
usage:  gcore [-o filename] pid
-bash-3.2$ gcore 23694
0x000000355cacbfe8 in tcsetattr () from /lib64/libc.so.6
Saved corefile core.23694

[2]+  Stopped                 top
-bash-3.2$ ls -l
total 2384
-rw-r--r-- 1 oracle dba 2425288 Mar  6 01:52 core.23694
drwxr----- 3 oracle dba    4096 Mar  5 03:32 oradiag_oracle
-rwxr-xr-x 1 oracle dba      20 Mar  5 04:06 test.sh
-bash-3.2$
4

1 回答 1

3

中的gcore命令gdb没有使用内核中的 Linux 核心文件转储代码。它正在遍历内存本身,并以与进程核心文件相同的格式写出二进制文件。这很明显,因为在发出 之后该进程仍然处于活动状态gcore,而如果 Linux 正在转储核心文件,则该进程将被终止。

于 2013-03-06T07:59:05.430 回答