首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Node/Redis/Socket/pm2服务器在约11小时后关闭连接

问Node/Redis/Socket/pm2服务器在约11小时后关闭连接
EN

Stack Overflow用户
提问于 2017-02-07 16:13:11
回答 1查看 637关注 0票数 0

我的node/nginx/redis/socket/pm2服务器有问题。它似乎只是因为mysql节点包抛出的错误而失败。

现在我在uncaughtException和SIGTERM上使用process.exit(0),PM2会自动重启它。

问题仍然是它的死亡显然是没有原因的,服务器没有经历负载,内存使用没有达到峰值。

我现在完全迷路了,我看过其他的解决方案,昨晚实现了一大堆解决方案,但错误仍然是在今天凌晨4点抛出的

"socket = 1 disconnect\n... user disconnected | Number of connections remaining: 1\n",

Redis在启动时显示两个警告,但我的日志文件是空的

代码语言:javascript
复制
    14718:M 06 Feb 17:57:38.107 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
14718:M 06 Feb 17:57:38.107 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

pm2在其日志中报告以下问题:

代码语言:javascript
复制
Error: Connection lost: The server closed the connection.
at Protocol.end (/usr/___/___/app/node_modules/mysql/lib/protocol/Protocol.js:109:13)
at Socket.<anonymous> (/usr/___/___/app/node_modules/mysql/lib/Connection.js:109:28)
at emitNone (events.js:91:20)
at Socket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
EN

回答 1

Stack Overflow用户

发布于 2017-02-08 17:57:29

如果有人遇到这个问题,

我能够追踪到这个问题是100%由mysql节点模块引起的。通过按照https://github.com/mysqljs/mysql#server-disconnects执行一些错误处理修复了该问题

查看nodejs mysql Error: Connection lost The server closed the connection。

*此问题应标记为重复

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42084776

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档