问题描述
- express connect-timeout 中间件 超时
-
express connect-timeout 中间件 超时时 报这个error??超时时怎么没有回调函数处理呀?
[2015-07-31 11:46:18.983] [ERROR] console - ServiceUnavailableError: Response ti
meout
at IncomingMessage. (/opt/data/nlb-server-dev/node_modules/connec
t-timeout/index.js:69:8)
at IncomingMessage.EventEmitter.emit (events.js:95:17)
at null._onTimeout (/opt/data/nlb-server-dev/node_modules/connect-timeout/in
dex.js:41:11)
at Timer.listOnTimeout as ontimeout[2015-07-31 11:46:18.990] [ERROR] exception-log - Server web-server-1: Caught ex
ception: Error: Can't set headers after they are sent. stack: Error: Can't set h
eaders after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
at ServerResponse.res.set.res.header (/opt/data/nlb-server-dev/node_modules/
express/lib/response.js:561:10)
at ServerResponse.res.send (/opt/data/nlb-server-dev/node_modules/express/li
b/response.js:133:12)
at ServerResponse.res.json (/opt/data/nlb-server-dev/node_modules/express/li
b/response.js:210:15)
at ServerResponse.res.send (/opt/data/nlb-server-dev/node_modules/express/li
b/response.js:121:21)
at /opt/data/nlb-server-dev/app/services/web/adminHandler.js:110:9
at Object.utils.invokeCallback (/opt/data/nlb-server-dev/app/util/utils.js:9
:8)
at /opt/data/nlb-server-dev/app/dao/baseDao.js:48:13
at Query._callback (/opt/data/nlb-server-dev/app/dao/mysql/mysql.js:55:9)
at Query.Sequence.end (/opt/data/nlb-server-dev/node_modules/mysql/lib/proto
col/sequences/Sequence.js:78:24)ServiceUnavailableError: Response timeout
? ?at IncomingMessage.<anonymous> (/opt/data/nlb-server-dev/node_modules/connect-timeout/index.js:69:8)
? ?at IncomingMessage.EventEmitter.emit (events.js:95:17)
? ?at null._onTimeout (/opt/data/nlb-server-dev/node_modules/connect-timeout/index.js:41:11)
? ?at Timer.listOnTimeout as ontimeout
解决方案
https://cnodejs.org/topic/504c13f6e2b845157707aaf4