Skip to content

Infinite background loop if ECONNREFUSED from oN.ingest.sentry.io #18802

@alxndrsn

Description

@alxndrsn

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

10.33.0

Framework Version

@sentry/node 10.33.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

const Sentry = require('@sentry/node');

const key = 'bbbbeeeeeeeeeeeeeffffffffffff';

Sentry.init({
  dsn: `https://${key}@o1.ingest.sentry.io/123`,
});

Sentry.captureException(new Error('wat'));

Steps to Reproduce

  1. add an entry to /etc/hosts: 0.0.0.0 o1.ingest.sentry.io
  2. run the code above

If you want more info, add debug: true to the Sentry.init() opts.

Expected Result

Sentry should fail to send to the ingest DSN, and then the script should exit.

Actual Result

Script loops forever.

Example logs

With debug: true:

Sentry Logger [log]: Initializing Sentry: process: 1853533, thread: main.
Sentry Logger [log]: Cleared AI provider skip registrations
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: NodeSystemError
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: LocalVariablesAsync
Sentry Logger [log]: Integration installed: Context
Sentry Logger [log]: Integration installed: ChildProcess
Sentry Logger [log]: Integration installed: ProcessSession
Sentry Logger [log]: Integration installed: Modules
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: NodeFetch
Sentry Logger [log]: SDK initialized from CommonJS
Sentry Logger [log]: @opentelemetry/api: Registered a global for diag v1.9.0.
Sentry Logger [log]: @opentelemetry/api: Registered a global for trace v1.9.0.
Sentry Logger [log]: @opentelemetry/api: Registered a global for propagation v1.9.0.
Sentry Logger [log]: @opentelemetry/api: Registered a global for context v1.9.0.
Sentry Logger [log]: Captured error event `wat`
Sentry Logger [warn]: Discarded session because of missing or non-string release
Sentry Logger [log]: Recording outcome: "network_error:error"
Sentry Logger [error]: Encountered error running transport request: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [error]: Error while sending envelope: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: Sending outcomes: [ { reason: 'network_error', category: 'error', quantity: 1 } ]
Sentry Logger [log]: Recording outcome: "network_error:internal"
Sentry Logger [error]: Encountered error running transport request: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [error]: Error while sending envelope: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: Sending outcomes: [ { reason: 'network_error', category: 'internal', quantity: 1 } ]
Sentry Logger [log]: Recording outcome: "network_error:internal"
Sentry Logger [error]: Encountered error running transport request: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [error]: Error while sending envelope: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: Sending outcomes: [ { reason: 'network_error', category: 'internal', quantity: 1 } ]
Sentry Logger [log]: Recording outcome: "network_error:internal"
Sentry Logger [error]: Encountered error running transport request: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [error]: Error while sending envelope: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: Sending outcomes: [ { reason: 'network_error', category: 'internal', quantity: 1 } ]
Sentry Logger [log]: Recording outcome: "network_error:internal"
Sentry Logger [error]: Encountered error running transport request: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [error]: Error while sending envelope: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: Sending outcomes: [ { reason: 'network_error', category: 'internal', quantity: 1 } ]
Sentry Logger [log]: Recording outcome: "network_error:internal"
Sentry Logger [error]: Encountered error running transport request: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
Sentry Logger [error]: Error while sending envelope: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '0.0.0.0',
  port: 443
}
...

Additional Context

Encountered while running Sentry in a locked down environment. The /etc/hosts entry is an attempt to recreate that.

Relates to today's email "Final reminder: Sentry's ingestion endpoints change tomorrow (Jan 13)". It reads:

Once the update completes, the old IPs will no longer work and ingestion traffic may fail.

It may be that the impact is bigger than just ingestion traffic failing.

Workarounds

The infinite loop can be avoided by:

  1. setting sendClientReports: false in Sentry.init({ ... })
  2. calling Sentry.close() at the end of the script

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions