No space left on device

本文探讨了在Linux环境下遇到的Nospaceleftondevice错误,解释了这一问题通常并非磁盘空间不足,而是由于系统信号量资源耗尽。文章深入介绍了信号量的概念及其在多线程环境中的作用,并提供了具体的排查与解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我在oracle、jboss、apache的linux环境下中遇到过"No space left on device"的错误,开始的时候以为是磁盘空间不够,但是发现很多时候,并不是这样,是因为系统的信号量不够用了

# ipcs -s
______________________________ Semaphore Arrays ______________________________
key        semid      owner      perms      nsems
0x00000000 19234816   oraclerac1    600        1
0x00000000 19267585   oraclerac1    600        1
0x00000000 19300354   oraclerac1    600        1
0x00000000 19398659   oraclerac1    600        1
0x00000000 19431428   oraclerac1    600        1
0x00000000 19464197   oraclerac1    600        1
0x00000000 19562502   oraclerac1    600        1


用这行命令删除所有的信号量即可:ipcs -s | grep nobody | perl -lane 'print `ipcrm sem $F[1]`'

当然也可以修改信号量的配置,etc/sysctl.conf,修改kernel.sem参数即可,那么我想说的是为什么要修改信号量,信号量是什么,如何设置?

 

为什么?

因为Semaphore是在多线程环境下使用的一种设施, 它负责协调各个线程, 以保证它们能够正确、合理的使用公共资源。

 

 

是什么?

Semaphore分为单值和多值两种,前者只能被一个线程获得,后者可以被若干个线程获得。假设停车场只有三个车位,一开始三个车位都是空的。这时如果同时来了五辆车,看门人允许其中三辆不受阻碍的进入,然后放下车拦,剩下的车则必须在入口等待,此后来的车也都不得不在入口处等待。这时,有一辆车离开停车场,看门人得知后,打开车拦,放入一辆,如果又离开两辆,则又可以放入两辆,如此往复。在这个停车场系统中,车位是公共资源,每辆车好比一个线程,看门人起的就是信号量的作用,因此信号量的特性如下:信号量是一个非负整数(车位数),所有通过它的线程(车辆)都会将该整数减一(通过它当然是为了使用资源),当该整数值为零时,所有试图通过它的线程都将处于等待状态。在信号量上我们定义两种操作: Wait(等待) 和 Release(释放)。 当一个线程调用Wait(等待)操作时,它要么通过然后将信号量减一,要么一直等下去,直到信号量大于一或超时。Release(释放)实际上是在信号量上执行加操作,对应于车辆离开停车场,加操作实际上是释放了由信号量守护的资源

 

如何设置?

查看kernel.sem查看当前设置:#cat /proc/sys/kernel/sem,4个参数分别对应:SEMMSL、SEMMNS、SEMOPM、SEMMNI这四个核心参数,

SEMMSL :用于控制每个信号集的最大信号数量,建议将 SEMMSL 设置为参数文件中的最大 PROCESSES或Thread实例参数的设置值再加上 10。

SEMMNS:用于控制整个 Linux 系统中信号(而不是信号集)的最大数,建议将 SEMMNS 设置为:系统中每个PROCESSES或Thread实例参数设置值的总和,加上最大 PROCESSES或Thread值的两倍,最后根据系统中 中间件或数据库的数量,每个加 10 。

 SEMOPM: 内核参数用于控制每个 semop 系统调用可以执行的信号操作的数量。一个信号集能够拥有每个信号集中最大数量的SEMMSL 信号,因此建议设置 SEMOPM 等于SEMMSL ,建议将SEMOPM 的值设置为不少于PROCESSES或Thread最小值 。

SEMMNI :内核参数用于控制整个 Linux 系统中信号集的最大数量。建议将 SEMMNI 的值设置为不少于PROCESSES或Thread的最小值。

 

输入目标进程PID: 19934 sh: can't create /proc/sys/kernel/yama/ptrace_scope: No such file or directory 警告:无法设置ptrace_scope,可能需要手动设置 已附加线程: tid=19941 已附加线程: tid=19942 已附加线程: tid=19943 已附加线程: tid=19944 已附加线程: tid=19945 已附加线程: tid=19946 已附加线程: tid=19947 已附加线程: tid=19948 已附加线程: tid=19949 已附加线程: tid=19954 已附加线程: tid=19955 已附加线程: tid=19959 已附加线程: tid=19962 已附加线程: tid=19963 已附加线程: tid=19968 已附加线程: tid=19977 已附加线程: tid=19981 已附加线程: tid=19982 已附加线程: tid=19983 已附加线程: tid=20010 已附加线程: tid=20012 已附加线程: tid=20013 已附加线程: tid=20027 已附加线程: tid=20038 已附加线程: tid=20039 已附加线程: tid=20040 已附加线程: tid=20041 已附加线程: tid=20046 已附加线程: tid=20063 已附加线程: tid=20065 已附加线程: tid=20066 已附加线程: tid=20072 已附加线程: tid=20075 已附加线程: tid=20076 已附加线程: tid=20077 已附加线程: tid=20078 已附加线程: tid=20080 已附加线程: tid=20091 已附加线程: tid=20094 已附加线程: tid=20096 已附加线程: tid=20097 已附加线程: tid=20117 已附加线程: tid=20135 已附加线程: tid=20143 已附加线程: tid=20146 已附加线程: tid=20147 已附加线程: tid=20164 已附加线程: tid=20165 已附加线程: tid=20166 已附加线程: tid=20167 已附加线程: tid=20174 已附加线程: tid=20180 已附加线程: tid=20219 已附加线程: tid=20227 已附加线程: tid=20228 已附加线程: tid=20229 已附加线程: tid=20232 已附加线程: tid=20233 已附加线程: tid=20234 已附加线程: tid=20241 已附加线程: tid=20242 已附加线程: tid=20247 已附加线程: tid=20248 输入断点地址(十六进制): 0x7651822168 选择断点类型(0:执行,1:读,2:写,3:读写): 0 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device PTRACE_SETREGSET设置失败: No space left on device 线程19934断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19941断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19942断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19943断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19944断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19945断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19946断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19947断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19948断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19949断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19954断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19955断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19959断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19962断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19963断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19968断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19977断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19981断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19982断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程19983断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20010断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20012断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20013断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20027断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20038断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20039断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20040断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20041断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20046断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20063断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20065断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20066断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20072断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20075断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20076断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20077断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20078断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20080断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20091断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20094断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20096断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20097断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20117断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20135断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20143断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20146断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20147断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20164断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20165断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20166断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20167断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20174断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20180断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20219断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20227断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20228断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20229断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20232断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20233断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20234断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20241断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20242断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20247断点设置失败 PTRACE_SETREGSET设置失败: No space left on device 线程20248断点设置失败 恢复进程执行... 等待断点触发... 停止事件(si_code=0xffffffff) 清理断点... 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 清除执行断点失败: No space left on device 清除观察点失败: No space left on device 分离调试会话... sh: can't create /proc/sys/kernel/yama/ptrace_scope: No such file or directory 修复好完整发给我
最新发布
07-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值