0

Our Node API running on docker gets the ESOCKETTIMEDOUT or ECONNREFUSED error under load. This happens when we call the .NET API from node 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   
    }   
Graham
  • 7,431
  • 18
  • 59
  • 84
Sathiya Deva
  • 1
  • 1
  • 1

1 Answers1

3

This is most likely due to the same issue here. Also,here is an excellent explanation of what is going on in node. You may have to set the UV_THREADPOOL_SIZE in your Docker Container.

johnny_mac
  • 1,801
  • 3
  • 20
  • 48
  • 1
    I think it would be better if you post answer rather than just a link. – Francis Zabala Jun 04 '18 at 08:35
  • 1
    @FrancisZabala Posting the link provides a lot of information I discovered while researching/resolving this issue myself, allowing readers to further investigate should my solution not work for them. This happens a lot in my experience and further reading provides the opportunity to resolve the issue themselves. Also, I did not explicitly state `uv_threadpool_size=64`, because it is already stated in the first link. Please read the links before deciding what is "better". – johnny_mac Jun 04 '18 at 15:01
  • Agree with you. It so weird that some say that just by adding links is bad but in this https://stackoverflow.com/questions/25681386/hibernate-entity-fields-camelcase-database-underscore and your answer here is perfectly fine. I'll remove downvote if I am able to – Francis Zabala Jun 04 '18 at 16:16