NodeJS agent showing "Error: socket hang up"

book

Article ID: 141677

calendar_today

Updated On:

Products

CA Application Performance Management Agent (APM / Wily / Introscope) CA Application Performance Management (APM / Wily / Introscope) INTROSCOPE DX Application Performance Management

Issue/Introduction

One of the agents of one specific Node application has stopped reporting metrics while others are running fine. The logs show the following error:

- error: [PID:1]: Possibly Unhandled Rejection at: Promise  Promise {
  <rejected> { Error: socket hang up
      at createHangUpError (_http_client.js:323:15)
      at Socket.socketOnEnd (_http_client.js:426:23)
      at Socket.emit (events.js:194:15)
      at endReadableNT (_stream_readable.js:1125:12)
      at /opt/.npm-global/lib/node_modules/ca-apm-probe/node_modules/async-listener/glue.js:188:31
      at process._tickCallback (internal/process/next_tick.js:63:19)
    code: 'ECONNRESET',

NodeJS collector is running locally to the Node application in RedHat Linux but inside a docker container. 

Cause

IP Address was wrong when defined the APMIA IP Address in ca-apm-probe

Environment

APM 10.7SP3
APMIA 10.7.0.202 (Build 993600) with NodeExtension (only)
NodeJS 10.15.3
ca-apm-probe 1.10.82

Resolution

1.- Add the following first line to your application main entry point script (for example, server or server.js):
var probe = require('ca-apm-probe').start(<infrastructure-agent-host>, <infrastructure-agent-port>, <probe-name>);

- Optionally, you can specify arguments. For example, if Infrastructure Agent is running on a different host or port, you can specify corresponding arguments. 
- Make sure the arguments in quotes, eg:
var probe = require('ca-apm-probe').start('systemExample.com', 5005, 'hello-world-app');

- Make sure the agent can find the hostname otherwise try using the IP address of the Infrastructure Agent (if using localhost then try 127.0.0.1 instead)

2.- Save the file and restart the agent

Additional Information

Case 20104121