NodeJs - 看到奇怪的行为 - 可能是事件循环卡住的情况

时间:2017-01-19 13:47:05

标签: mysql node.js libuv

最近我们在生产中发现了一种行为。以下是情景。

我们正在使用nodejs和mysql服务器

有一个包含四个步骤的api调用

 1 Insert a record.
 2 Make a upstream call and get a id 
 3 Update the record with the id created in step 1
 4 Send a email.

以下是我们看到的逐步奇怪的行为。

- We got this api call on lets say day 1. 
 - Step 1 completed succcessfully as seen in our db and logs.
 - They were no further updates and none of the steps 2,3,4 executed .There was nothing in db and strangely nothing was in the logs related to step 2 ,3 ,4 .
 - Next day when we came , we saw that step 2, 3, 4 were executed. We could see everything in the logs as well as db and updated_at was of second day.

我的问题是关于此的解释。这似乎是一个节点js bug,其中第1步之后的回调被卡住并且从未在第1天返回。可能在第2天执行回调并且一切都很顺利。这似乎是libuv或节点事件循环中的事件循环错误。

任何人都观察到类似的行为以及如何解决它。我们也在观察其他记录的类似行为。

0 个答案:

没有答案