thinkjs icon indicating copy to clipboard operation
thinkjs copied to clipboard

3.x 线上服务运行一段时间 数据库未自动重连 访问挂起卡死

Open tigerui opened this issue 9 years ago • 10 comments

DESC

本地开发的时候也经常 TIMEOUT 必须重启项目,本来以为是网络问题,数据库是外网访问rds。

ENV

Platform: centos Node.js Version: v6.11.0 ThinkJS Version: thinkjs beta4

tigerui avatar Aug 19 '17 03:08 tigerui

请提供具体的错误信息,用的是阿里云?数据库的超时时间设置的是多少?

welefen avatar Aug 19 '17 09:08 welefen

数据库是阿里云RDS mysql 5.7 ,错误信息等复现在报过来,现在需要观察 这是数据库超时时间设置信息

mysql>show variables like  '%timeout%';
+-----------------------------+-----------------+
| Variable_name               | Value           |
+-----------------------------+-----------------+
| connect_timeout             | 10              |
| delayed_insert_timeout      | 300             |
| have_statement_timeout      | YES             |
| innodb_flush_log_at_timeout | 1               |
| innodb_lock_wait_timeout    | 50              |
| innodb_rollback_on_timeout  | OFF             |
| interactive_timeout         | 7200            |
| lock_wait_timeout           | 31536000        |
| net_read_timeout            | 30              |
| net_write_timeout           | 60              |
| rpl_stop_slave_timeout      | 31536000        |
| slave_net_timeout           | 60              |
| wait_timeout                | 86400           |
+-----------------------------+-----------------+

tigerui avatar Aug 19 '17 09:08 tigerui

服务器也是内网同一可用区

tigerui avatar Aug 19 '17 09:08 tigerui

@tigerui 你看本地能不能复现这个问题,我们这边的服务(基于3.0)运行了很长时间暂时没出现这种情况

welefen avatar Aug 19 '17 13:08 welefen

挺奇怪的,之前只要本地电脑是待机状态,掀开来,thinkjs 必须重启一下,不然就会先是请求挂起,然后过个几十秒 thinkjs 就打印出 mysql TIMEOUT。不过之前从来没在线上遇到过,我尝试一下复现

tigerui avatar Aug 19 '17 16:08 tigerui

现在本机电脑待机状态能复现么?我这边试了下待机状态没啥问题

welefen avatar Aug 20 '17 08:08 welefen

没有复现 尝试了很多次,断网、待机状态等等

tigerui avatar Aug 20 '17 09:08 tigerui

@tigerui 那先关闭该 issue,复现后再 reopen

welefen avatar Aug 21 '17 10:08 welefen

一直被这个问题困扰。 远程连接的是腾讯云的数据库。 本地开发环境mac。node 8/12 都试过 版本"thinkjs": "^3.2.10" 运行只要隔一段时间没有请求。再重新请求API,总是要等30s甚至60s才恢复正常数据返回。 如果杀掉进程,重新run,连接数据库是很快的,不需要等。

cleocn avatar Dec 17 '21 02:12 cleocn

image

cleocn avatar Dec 17 '21 02:12 cleocn