NodeJS 无法捕获的异常
我有一个写入数据存储的应用程序,因此我尝试将 HTTP 请求发送到数据存储(hbase + stargate)。 ETIMEDOUT 异常,它会终止进程。
我在每个存在或至少看似存在的套接字连接上都有 .on('error') ,包括请求和响应。我什至采取了极端的步骤,对源代码进行了更改,这应该“忽略”第三篇文章中的这些错误:
http://comments.gmane.org/gmane.comp.lang.javascript.nodejs/25283
我什至有一个
process.on('uncaughtException', function(){})
所有这些仍然无济于事,并且我的进程不断死亡。可能会丢失 ZMQ 流队列中建立的所有内容。
最奇怪的部分是 4 个服务器集群中的一台服务器运行良好。
I have an application which writes to a datastore, so I attempt to send an HTTP request out to the datastore (hbase + stargate). ETIMEDOUT exception, which kills the process.
I have .on('error') on every socket connection present or at least seemingly present, including requests and responses. I even took an extreme step and make a change to the source code, which is supposed to "ignore" those errors in the third post:
http://comments.gmane.org/gmane.comp.lang.javascript.nodejs/25283
I even have a
process.on('uncaughtException', function(){})
All of this still to no avail, and my processes keep dying. Potentially losing everything that built up in the ZMQ stream queue.
The weirdest part yet is that one server out of the 4 server cluster, behaves just fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的数据存储区也遇到了类似的问题,该问题依赖于 HTTP 请求。
您如何发送“HTTP 请求”?有图书馆吗?您是否尝试过对 HTTP 请求设置超时限制以避免 ETIMEDOUT 异常?尽管这没有解决主要问题,但它将使您能够通过抛出您自己的受控异常来捕获超时。
I had a like-issue with our datastore that relied on HTTP requests.
How are you sending the "HTTP request out"? Is it with a library? Have you tried putting a timeout limit on the HTTP request to avoid the ETIMEDOUT exception? Although this does not address the main issue, it will give you the ability to catch the timeout by throwing your own controlled exception.