Couldn‘t flush user prefs: java.util.prefs.BackingStoreException: Couldn‘t get file lock

最近在部署秒杀项目的时候,部署完以后,发现项目报错,如下:

问题详情

Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4446
summary +   5121 in 00:00:35 =  144.6/s Avg:  5662 Min:  1019 Max:  8053 Err:  5121 (100.00%) Active: 4270 Started: 10000 Finished: 5730
Apr 26, 2022 11:36:10 AM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock User prefs.  Unix error code 24.
Apr 26, 2022 11:36:10 AM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
summary +   4879 in 00:00:01 = 9240.5/s Avg: 12363 Min:  1038 Max: 15500 Err:  1274 (26.11%) Active: 0 Started: 10000 Finished: 10000
summary =  10000 in 00:00:36 =  278.3/s Avg:  8931 Min:  1019 Max: 15500 Err:  6395 (63.95%)
Tidying up ...    @ Tue Apr 26 11:36:11 CST 2022 (1650944171289)

通过对报错文件的分析找到关键错误如下:
在这里插入图片描述

解决方法

linux中关于默认打开文件的数量是1024,通过ulimit -n命令可以查看

[root@bdc-test133 ~]# ulimit -n
1024

由于默认的打开文件数量1024无法支撑现在的并发请求,所以需要修改该参数值。

临时生效:可以使用ulimit -n 102400临时生效
永久生效:
修改/etc/security/limits.conf,增加如下信息:

  • soft nofile 65536 --软限制
  • hard nofile 65536 --硬限制
    然后退出当前会话,重新登录。 即可生效,重启配置也会保留。

注意:
nofile可以设置的最大值为 1048576(2**20),设置的值大于该数,就会进行登录不了。
soft 设置的值 一定要小于或等于 hard 的值。

ulimit常用命令

      -S	use the `soft' resource limit # 设置软限制
      -H	use the `hard' resource limit # 设置硬限制
      -a	all current limits are reported# 显示所有的配置。
      -b	the socket buffer size # 设置socket buffer 的最大值。
      -c	the maximum size of core files created # 设置core文件的最大值.
      -d	the maximum size of a process's data segment  # 设置线程数据段的最大值
      -e	the maximum scheduling priority (`nice') # 设置最大调度优先级
      -f	the maximum size of files written by the shell and its children # 创建文件的最大值。
      -i	the maximum number of pending signals # 设置最大的等待信号
      -l	the maximum size a process may lock into memory #设置在内存中锁定进程的最大值
      -m	the maximum resident set size 
      -n	the maximum number of open file descriptors # 设置最大可以的打开文件描述符。
      -p	the pipe buffer size
      -q	the maximum number of bytes in POSIX message queues
      -r	the maximum real-time scheduling priority
      -s	the maximum stack size
      -t	the maximum amount of cpu time in seconds
      -u	the maximum number of user processes  # 设置用户可以创建的最大进程数。
      -v	the size of virtual memory  # 设置虚拟内存的最大值
      -x	the maximum number of file locks

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Hi-Sunshine

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值