XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.2k stars 511 forks source link

nodejs process stays alive for another 20 seconds after disconnect #792

Closed michielbdejong closed 4 years ago

michielbdejong commented 7 years ago

To reproduce:

const RippleAPI = require('ripple-lib').RippleAPI
const api = new RippleAPI({ server: 'wss://s.altnet.rippletest.net:51233' })
api.connect().then(() => {
  console.log('connected')
  return api.disconnect()
}).then(() => {
  console.log('disconnected')
})

And then:

$ time node test-disconnect.js
connected
disconnected

real    0m20.853s
user    0m0.687s
sys 0m0.061s

Continuation of https://github.com/ripple/ilp-plugin-xrp-escrow/issues/14

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/48957720-nodejs-process-stays-alive-for-another-20-seconds-after-disconnect?utm_campaign=plugin&utm_content=tracker%2F323756&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F323756&utm_medium=issues&utm_source=github).
michielbdejong commented 6 years ago

@sentientwaffle I think you fixed what sounds like the same issue in https://github.com/interledgerjs/ilp-plugin-bells/pull/153 right?

sentientwaffle commented 6 years ago

It does look similar. I think unref()ing the timer on https://github.com/ripple/ripple-lib/blob/a9e5ac6290ef2fa17fadb34e808e4f5080d7ba32/src/common/connection.js#L443 will fix the issue.

FKSRipple commented 4 years ago

Fixed by #773