当我运行我的测试套件时,我发现一些文本会间歇性地挂起很长时间(15 分钟到半小时),并且 PhantomJS 不断报告:

Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW
Asynchronous Sessions cleanup phase starting NOW ...

这个 Asynchronous Sessions cleanup phase starting NOW 是什么,是什么导致它挂这么久?

干杯

戴夫

最佳答案

找到的解决方法:
Asynchronous Sessions cleanup phase starting NOW ... 是由对外部提要的一些调用引起的,这些调用间歇性地变慢。这个阶段肯定一直在等待这些超时的调用,但是 PhantomJS 坐在那里等待了非常非常长的时间。

在测试时删除这些调用(使用一点 JavaScript,如果主机是 localhost,则使用虚拟对象)解决了问题。

10-06 11:22