2016-09-22 25 views
0

我使用nodejs(0.12)和express(3.1.0)。 我的服務器保存了一段時間運行完美,但一些次後,就開始給400(壞請求),並保持它給400對接下來的所有請求nodejs服務器提供錯誤的請求(400)錯誤。爲什麼?

message: "Error: Bad Request 
at SendStream.error (/var/www/storehippo/node_modules/express/node_modules/send/lib/send.js:145:16) 
at SendStream.pipe (/var/www/storehippo/node_modules/express/node_modules/send/lib/send.js:298:31) 
at Object.static (/var/www/storehippo/node_modules/express/node_modules/connect/lib/middleware/static.js:83:8) 
at Object.handle (eval at eval at wrapHandle (/var/www/storehippo/node_modules/newrelic/lib/instrumentation/connect.js:1:0)) 
at /var/www/storehippo/node_modules/express/node_modules/connect/lib/proto.js:199:15 
at /var/www/storehippo/node_modules/newrelic/lib/transaction/tracer/index.js:157:28 
at Object.<anonymous> (/var/www/storehippo/dist/dist_17-09-2016_10:20:03/app/index.js:252:5) 
at Object.handle (eval at eval at wrapHandle (/var/www/storehippo/node_modules/newrelic/lib/instrumentation/connect.js:1:0)) 
at /var/www/storehippo/node_modules/express/node_modules/connect/lib/proto.js:199:15 
at /var/www/storehippo/node_modules/newrelic/lib/transaction/tracer/index.js:157:28" 

爲了修復它,我必須重新啓動我的服務器和無法找到它的根本原因。

如何找到根本原因並解決它?

+1

您需要提供比這更多的信息。 –

+0

請爲我們提供一些解決問題的代碼。 –

+0

@ravishankar恩?你解決了嗎? – rsp

回答

1

首先,您正在使用節點0.12 - 當前LTS版本(推薦用於所有用途)是4.5.0,當前版本是6.6.0(6.x將在下個月變爲LTS)。您可能會考慮升級Node,因爲您使用的是過時的版本。 0.12的維護期將在幾個月內結束,然後將不再獲得任何更新,請參閱:https://github.com/nodejs/LTS#lts_schedule

您使用的Express模塊​​也非常過時。最新的3.x是我認爲3.21.2和當前版本的Express是4.14.0。

現在,如果您想查找問題,那麼您應該從查看/var/www/storehippo/dist/dist_17-09-2016_10:20:03/app/index.js的第252行開始,因爲這似乎是您自己的代碼在該堆棧跟蹤中的唯一行。其他線路似乎都是外部模塊,但問題可能在於其中一個模塊。

可能有很多原因,爲什麼你的服務器表現良好,然後開始行爲不當 - 你可能有一些內存泄漏,一些資源沒有被釋放並在一段時間後枯竭,你可能會改變你的應用程序的某些狀態導致其他請求失敗等。

不幸的是,您沒有包含任何可以幫助您發現問題的信息。

相關問題