Coredump正在被截断

Coredump正在被截断

本文介绍了Coredump正在被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置

  ulimit -c unlimited。 

在c ++程序中,我们正在做

  struct rlimit corelimit; 
if(getrlimit(RLIMIT_CORE,& corelimit)!= 0){
return -1;
}
corelimit.rlim_cur = RLIM_INFINITY;
corelimit.rlim_max = RLIM_INFINITY;
if(setrlimit(RLIMIT_CORE,& corelimit)!= 0){
return -1;
}

但是每当程序崩溃时,它生成的核心转储就会被截断。

  BFD:警告:/mnt/coredump/core.6685.1325912972被截断:期望的核心文件大小> = 1136525312,找到: 638976. 

可能是什么问题?

我们使用 Ubuntu 10.04.3 LTS

  Linux ip- < IP> 2.6.32-318-ec2#38-Ubuntu SMP Thu Sep 1 18:09:30 UTC 2011 x86_64 GNU / Linux 

这是我的/etc/security/limits.conf

 #/etc/security/limits.conf 

#每条线以下面的形式描述用户的限制:

#< domain> <类型> <项目> <值GT;

#其中:
#< domain>可以是:
# - 一个用户名
# - 一个组名,带有@group语法
# - 通配符*,默认条目
# - 通配符%,can也用于%组语法,
#用于maxlogin限制
# - 注意:组和通配符限制不适用于根。
#要为root用户应用限制,请使用< domain>必须是
#文字用户名root。

#< type>可以有两个值:
# - soft用于执行软限制
# - hard用于执行硬限制

#< item>可以是以下之一:
核心 - 限制核心文件大小(KB)
# - data - 最大数据大小(KB)
# - fsize - 最大文件大小
# - memlock - 最大锁定内存地址空间(KB)
# - nofile - 最大打开文件数量
# - rss - 最大驻留集大小(KB)
- 堆栈 - 最大堆栈大小(KB)
# - cpu - 最大CPU时间(MIN)
# - nproc - 最大进程数量
# - as - 地址空间限制)
# - maxlogins - 此用户的最大登录次数
# - maxsyslogins - 系统上登录的最大次数
# - priority - 使用
运行用户进程的优先级# - 锁定 - 用户可以容纳的最大文件锁数
# - sigpending - 最大待处理信号数量
# - msgqueue - POSIX消息队列使用的最大内存(字节)
#不错 - 最高优先级允许升至值:[-20,19]
# - rtprio - max实时优先级
# - chroot - 将根目录更改为目录(特定于Debian)

#< domain> <类型> <项目> <值GT;


#*软核0
#根核硬核100000
#*硬rss 10000
#@学生硬nproc 20
#@ faculty soft nproc 20
#@ faculty hard nproc 50
#ftp hard nproc 0
#ftp - chroot / ftp
#@ student - maxlogins 4



#所有用户
* hard nofile 16384
* soft nofile 9000

更多详细信息

我使用gcc优化标志

  O3 

我将堆栈线程大小设置为 .5 mb

解决方案

我记得有一个硬限制可以由管理员设置,而软限制由用户设置。如果软限制比硬限制更强,则取硬限制值。
我不确定这是否适用于任何shell,但我只知道它来自bash。


I am setting

ulimit -c unlimited.

And in c++ program we are doing

struct rlimit corelimit;
  if (getrlimit(RLIMIT_CORE, &corelimit) != 0) {
    return -1;
  }
  corelimit.rlim_cur = RLIM_INFINITY;
  corelimit.rlim_max = RLIM_INFINITY;
  if (setrlimit(RLIMIT_CORE, &corelimit) != 0) {
    return -1;
  }

but whenever program is getting crashed the core dump generated by it is getting truncated.

BFD: Warning: /mnt/coredump/core.6685.1325912972 is truncated: expected core file size >= 1136525312, found: 638976.

What can be the issue ?

We are using Ubuntu 10.04.3 LTS

Linux ip-<ip> 2.6.32-318-ec2 #38-Ubuntu SMP Thu Sep 1 18:09:30 UTC 2011 x86_64 GNU/Linux

This is my /etc/security/limits.conf

# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - an user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#        - NOTE: group and wildcard limits are not applied to root.
#          To apply a limit to the root user, <domain> must be
#          the literal username root.
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#        - chroot - change root to directory (Debian-specific)
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#root            hard    core            100000
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#    ftp             -       chroot          /ftp
#@student        -       maxlogins       4



#for all users
* hard nofile 16384
* soft nofile 9000

More Details

I am using gcc optimization flag

O3

I am setting stack thread size to .5 mb.

解决方案

I remember there is a hard limit which can be set by the administrator, and a soft limit which is set by the user. If the soft limit is stronger than the hard limit, the hard limit value is taken.I'm not sure this is valid for any shell though, I only know it from bash.

这篇关于Coredump正在被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 19:23