容器运行报错线程创建失败
redhat容器内部执行程序报错如下
Starting program: /home/soft/HPCServer/./HPCServer
warning: Error disabling address space randomization: Operation not permitted
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.34-105.oe2203sp1.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
warning: Ignoring non-absolute filename: <libnsl.so.1>
Missing separate debuginfo for libnsl.so.1
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/96/fffd935288296af9a07b535c736e0e376ba55a.debug
warning: Ignoring non-absolute filename: <./libsasl2.so.3>
Missing separate debuginfo for ./libsasl2.so.3
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/57/d7f694ff1bff339da151ca41399c5c94a6933a.debug
hpr tls index{2}
hlog.async=>_sync=1
SyncLogHandler!
schina !!! HPR_CreateThread_Local HPR_Thread_Create error, return -1 3
schina !!! HPR_InitThread_Local HPR_CreateThread_Local error, return -1 2
schina !!! HPR_ThreadPool_Create HPR_InitThread_Local error, return -1 3
Program received signal SIGSEGV, Segmentation fault.
0x00007fc9839a1081 in __gnu_cxx::__exchange_and_add (__val=-1, __mem=0x3030303030307838) at /usr/include/c++/4.8/ext/atomicity.h:49
49 /usr/include/c++/4.8/ext/atomicity.h: No such file or directory.
Missing separate debuginfos, use: dnf debuginfo-install e2fsprogs-1.46.4-17.oe2203sp1.x86_64 keyutils-libs-1.6.3-4.oe2203sp1.x86_64 krb5-libs-1.19.2-6.oe2203sp1.x86_64 libgcc-10.3.1-20.x86_64 libselinux-3.3-2.oe2203sp1.x86_64 libstdc++-10.3.1-20.x86_64 libxcrypt-4.4.26-4.oe2203sp1.x86_64 pcre2-10.39-6.oe2203sp1.x86_64 zlib-1.2.11-22.oe2203sp1.x86_64
解决方法:
修改dockersrun命令
#!/bin/bash docker stop hpcserver docker rm hpcserver docker run -d \ --name hpcserver \ --restart=unless-stopped \ -p 0.0.0.0:30990:30990 \ -p 0.0.0.0:31250:1250/udp \ -e HPC_MSGHANDER_IP="10.19.170.33" \ -e MY_POD_NAME=hpcserver \ --cpu-period=100000 \ --cpu-quota=100000 \ --memory=1005Mi \ --ulimit nproc=65535:65535 \ --ulimit nofile=65535:65535 \ --security-opt seccomp=unconfined \ --cap-add=SYS_PTRACE \ --mount type=bind,source=/home/ssd/AlgorithmLib,destination=/home/ssd/AlgorithmLib \ --mount type=bind,source=/home/ssd/HMSProxy,destination=/home/ssd/HMSProxy \ --mount type=bind,source=/home/ssd/log/HPCServer/,destination=/home/ssd/log/HPCServer/ \ --mount type=bind,source=/opt/opsmgr/web/opsMgrAgent/data/custom/,destination=/opt/opsmgr/web/opsMgrAgent/data/custom/ \ docker.hikcloud:30001/hpc-deepmind/hpcserver:V4.1.0-20260707
1. --ulimit nproc=65535:65535 (最重要)
- 增加容器内可创建的最大进程/线程数
- 解决
HPR_Thread_Create error问题
2. --ulimit nofile=65535:65535
- 增加文件描述符限制
- 防止因文件描述符不足导致的问题
3. --security-opt seccomp=unconfined
- 禁用 seccomp 安全策略
- 允许程序使用
clone系统调用创建线程 - 解决
errno = 1 (EPERM)问题
4. --cap-add=SYS_PTRACE
- 添加 ptrace 系统调用权限
- 允许程序进行调试和跟踪

浙公网安备 33010602011771号