-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
end msg to unopened socket #1779
Comments
That code isn’t right (see #1386 (comment)), but what will hang? |
const pg = require('pg')
;(async () => {
console.time('time')
process.on('exit', () => console.timeEnd('time'))
// connect to PG server which available only through VPN over UDP
const client = new pg.Client({ connectionString: '...' })
client.on('error', (err) => console.log(err))
const tid = setTimeout(() => {
console.log('timeout!')
// client.end()
// client.connection.stream.destroy()
}, 1000)
await client.connect()
console.log('connected')
clearTimeout(tid)
client.end()
})().catch((err) => {
console.error(err.stack || err)
process.exit(1)
}) with
with
|
So the request is for |
Sorry for unclear description for example. |
Writing to such socket do not throw error on [email protected]. PR #1847 partially solve this problem. |
node-postgres/lib/connection.js
Lines 315 to 322 in 060a35f
pg module tries send end message and don't consider if socket is open, app will hang.
The text was updated successfully, but these errors were encountered: