zoukankan      html  css  js  c++  java
  • 【ask】Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

    1.周五对nodejs tcp长连接服务器框架进行压测,一切开始比较常规(没什么特殊问题)。

    2.突然手一哆嗦,把压测用的客户端群一起关闭了。

    3.这个时候nodejs的服务器爆出了"Caught exception: Error: read ECONNRESET"。

    4.这个以前做linux服务器时候见过(忽略掉SIGPIPE信号,nodejs默认也是这么做的),没有太在意。

    5.但是紧接着标题里的错误出现了,一看这个我感觉肯定不是自己直接调用的原因。

    6.心想先写一个最简单的服务器,只链接不接包也不发包,然后一起关闭压测用客户端群。看看什么样子。

    7.依然出现

     Caught exception: Error: read ECONNRESET
        at errnoException (net.js:904:11)
        at TCP.onread (net.js:558:19)
    ......(若干条)
    (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
    ......(若干条)
    node.js:0
    // Copyright Joyent, Inc. and other Node contributors.
    ^
    RangeError: Maximum call stack size exceeded
     
    8.我想这肯定不是我或者是nodejs本身的问题,可能是有哪没设置好的问题。(linux进程的句柄数默认不也是1024么!需要用ulimit -n设置才行)。
    9.想到这里开始在nodejs官方文档里看,是一个一个api的看啊(有点暴力,但是我一开始就是认为这应该是全局的设置问题,所以就是从process这里开始的,所以几分钟内就看到了这个)!
    10.试着改了一下,立刻见效了。
    11.但是心里仍然有些不踏实,恐怕还是要等搞定cocos2d-x的问题之后有时间,再来看看nodejs这块的源码。

    process.maxTickDepth

    • Number Default = 1000

    Callbacks passed to process.nextTick will usually be called at the end of the current flow of execution, and are thus approximately as fast as calling a function synchronously. Left unchecked, this would starve the event loop, preventing any I/O from occurring.  

  • 相关阅读:
    oracle中varchar2和nvarchar2的区别
    Hbuilder与夜神连接
    BUILD 2015: Visual Studio对GitHub的支持
    Visual Studio Developer Assistant 3月新功能展示
    Visual Studio 发布新版API智能提示
    微软发布手机版 Sample Browser。7000多示例代码一手掌握
    微软 PowerShell Script Explorer 满血复活,正式发布
    IBM的“认知计算时代”
    最新 Windows 10 应用项目模板发布
    Windows 10四大版本区别详解:家庭版, 专业版, 企业版和教育版
  • 原文地址:https://www.cnblogs.com/wangnan1979/p/3905088.html
Copyright © 2011-2022 走看看