skywalking docker部署报错Out of Memory Error (workerManager.hpp:70)

文章描述了一种JavaDocker容器因使用较旧Docker版本与基于Ubuntu22.04LTS的新Java映像不兼容导致的内存不足问题。解决方法是升级Docker服务器到至少20.10.10版本。

部分报错内容

[0.003s][warning][os,thread] Failed to start thread "GC Thread#0" - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create worker GC thread. Out of system resources.
# Can not save log file, dump to screen..
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create worker GC thread. Out of system resources.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Unscaled Compressed Oops mode in which the Java heap is
#     placed in the first 4GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth

### 解决 SkyWalking OAPServerBootstrap Netty bind 地址已在使用问题 当遇到 SkyWalking 启动时出现的绑定地址已被使用问题(`Address already in use: bind`),通常是因为目标端口已经被其他进程占用。以下是解决此问题的详细方法: #### 1. 检查端口占用情况 通过命令行工具检查目标端口是否被占用,例如 SkyWalking 默认使用的 12800 端口: ```bash netstat -tulnp | grep 12800 ``` 如果输出中显示有进程占用了该端口,则需要进一步定位并释放该端口。 #### 2. 杀掉占用端口的进程 根据上一步的输出结果,找到占用端口的进程 ID(PID)。例如,假设输出为: ``` tcp 0 0 127.0.0.1:12800 0.0.0.0:* LISTEN 1234/java ``` 其中 `1234` 是 PID。可以通过以下命令杀掉该进程: ```bash kill -9 1234 ``` #### 3. 修改 SkyWalking 配置文件 如果无法停止占用端口的进程或希望避免冲突,可以修改 SkyWalking 的配置文件以更改默认端口。SkyWalking 的主要配置文件为 `application.yml`[^1],路径通常为: ``` /oap-server/config/application.yml ``` 在该文件中找到与 Netty 绑定相关的配置项,例如: ```yaml storage: armeria: grpc: serverPort: 12800 ``` 将 `serverPort` 的值更改为未被占用的端口,例如 `12801`。 #### 4. 确保 Docker 容器端口映射正确 如果使用 Docker 部署 SkyWalking,确保容器内的端口与宿主机端口映射一致。例如,启动 SkyWalking UI 容器时的命令应包含正确的端口映射[^3]: ```bash docker run --name oap-ui --restart always -d -e TZ="Asia/Shanghai" --link oap:oap -p 8888:8080 -e SW_OAP_ADDRESS=http://oap:12801 apache/skywalking-ui:8.7.0 ``` 注意,这里将 `SW_OAP_ADDRESS` 的端口从默认的 `12800` 更改为 `12801`。 #### 5. 避免 Spring Boot 工程端口冲突 如果在同一环境中运行了其他 Spring Boot 应用程序,并且这些应用程序的端口与 SkyWalking 的端口冲突,可以参考以下方法解决: - 修改 Spring Boot 应用程序的端口号,在其 `application.yml` 或 `application.properties` 文件中设置不同的端口[^4]。 - 使用 IDEA 的 Services 视图检查所有正在运行的服务及其端口号,确保没有重复。 --- ### 示例代码:修改 SkyWalking 配置文件 以下是修改后的 `application.yml` 配置示例: ```yaml storage: armeria: grpc: serverPort: 12801 ``` --- ### 注意事项 - 在生产环境中,建议定期检查端口占用情况,避免因端口冲突导致服务不可用。 - 如果频繁遇到端口冲突问题,可以考虑动态分配端口或使用容器编排工具(如 Kubernetes)管理服务端口。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值