Skip to content

Fix crash when outbound connection fails #3456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

- fix(outbound): in outbound, fix a crash when socket connection errors #3456

### [3.1.0] - 2025-01-30

#### Changes
Expand Down
9 changes: 8 additions & 1 deletion outbound/client_pool.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const util = require('node:util');

const utils = require('haraka-utils');
const net_utils = require('haraka-net-utils')

Expand Down Expand Up @@ -32,7 +34,12 @@
socket.end();
socket.removeAllListeners();
socket.destroy();
callback(err.message, null);
const errMsg = err.message ?
err.message :
err instanceof AggregateError ?
err.map(e => e.message).join(', ') :
util.inspect(err, { depth: 3 });
callback(errMsg, null);

Check warning on line 42 in outbound/client_pool.js

View check run for this annotation

Codecov / codecov/patch

outbound/client_pool.js#L37-L42

Added lines #L37 - L42 were not covered by tests
})

socket.once('timeout', () => {
Expand Down
Loading