【问题标题】:What causes the ESOCKETTIMEDOUT or ECONNREFUSED error under load with Docker/Node?是什么导致 Docker/Node 在负载下出现 ESOCKETTIMEDOUT 或 ECONNREFUSED 错误?
【发布时间】:2018-05-25 16:06:33
【问题描述】:

我们在 docker 上运行的 Node API 在负载下遇到 ESOCKETTIMEDOUT 或 ECONNREFUSED 错误。当我们从节点 API 调用 .NET API 时会发生这种情况。

{   [-] 
         _anonFuncCount:     3  
         _body:  {"events":[{"serviceCategoryCode":{"codeValue":"core"},"eventNameCode":{"codeValue":"clock.punch","shortName":"Clock Punch"},"data":{"eventContext":{"associateOID":"","workAssignmentId":""},"transform":{"clockEntry":{"deviceDateTime":"2017-12-10T18:21:46-04:00","entryDateTime":"2017-12-10T18:21:46-04:00","actionCode":{"codeValue":"clockout","shortName":"clockout"},"laborAllocations":[]}}}}]} 
         _cacheURL:  /api/offlinePunch  
         _clen:  424    
         _consuming:     true   
         _contentType:   application/json   
         _currentHandler:    handler-2  
         _currentRoute:  postapiofflinepunch100 
         _dtraceId:  5276   
         _dumped:    false  
         _events:   {   [+] 
        }   
         _eventsCount:   4  
         _matchedVersion:    1.0.0  
         _negotiator:   {   [+] 
        }   
         _parsedBody:    true   
         _readBody:  true   
         _readableState:    {   [+] 
        }   
         _time:  1512958462607  
         _timerMap: {   [+] 
        }   
         _url:  {   [+] 
        }   
         _version:   \x7e1  
         body:  {   [+] 
        }   
         client:     ~socket    
         complete:   true   
         connection:     ~socket    
         context:    ~params    
         domain:     null   
         headers:   {   [+] 
        }   
         httpVersion:    1.1    
         httpVersionMajor:   1  
         httpVersionMinor:   1  
         log:    ~socket~_httpMessage~log   
         method:     POST   
         params:    {   [+] 
        }   
         query: {   [+] 
        }   
         rawBody:    {"events":[{"serviceCategoryCode":{"codeValue":"core"},"eventNameCode":{"codeValue":"clock.punch","shortName":"Clock Punch"},"data":{"eventContext":{"associateOID":"","workAssignmentId":""},"transform":{"clockEntry":{"deviceDateTime":"2017-12-10T18:21:46-04:00","entryDateTime":"2017-12-10T18:21:46-04:00","actionCode":{"codeValue":"clockout","shortName":"clockout"},"laborAllocations":[]}}}}]} 
         rawHeaders:    [   [+] 
        ]   
         rawTrailers:   [   [+] 
        ]   
         readable:   false  
         route: {   [+] 
        }   
         serverName:     time-clocking-api  
         socket:    {   [+] 
        }   
         statusCode:     null   
         statusMessage:  null   
         timers:    [   [+] 
        ]   
         trailers:  {   [+] 
        }   
         upgrade:    false  
         url:    /api/offlinePunch  
         uuid:   f008be5d-ee11-4e1e-8ae4-afa47dc5e587   
    }   

【问题讨论】:

  • 您可能溢出了服务器上的积压队列。

标签: node.js docker


【解决方案1】:

这很可能是由于同一问题here。此外,here 很好地解释了节点中发生的事情。您可能需要在 Docker 容器中设置 UV_THREADPOOL_SIZE。

【讨论】:

  • 我认为如果您发布答案而不仅仅是一个链接会更好。
  • @FrancisZabala 发布链接提供了我在自己研究/解决此问题时发现的大量信息,如果我的解决方案不适合他们,则允许读者进一步调查。根据我的经验,这种情况经常发生,进一步阅读提供了自己解决问题的机会。另外,我没有明确说明uv_threadpool_size=64,因为它已经在第一个链接中说明了。在决定什么是“更好”之前,请阅读链接。
  • 同意你的看法。太奇怪了,有人说仅仅通过添加链接是不好的,但是在这个stackoverflow.com/questions/25681386/… 中,你的答案很好。如果可以,我将删除反对票
猜你喜欢
  • 2019-10-08
  • 1970-01-01
  • 2022-06-28
  • 1970-01-01
  • 2022-10-17
  • 1970-01-01
  • 2022-12-18
  • 1970-01-01
  • 2021-01-08
相关资源
最近更新 更多