WebThingsIO/webthing-node

Node does not exit after server.stop()

jaller94 opened this issue · 2 comments

Code to reproduce

I am using Node v10.11.0.

const { SingleThing, Thing, WebThingServer } = require('webthing');

async function test() {
  const thing = new Thing();
  const server = new WebThingServer(new SingleThing(thing), 8000);
  console.log('starting...');
  await server.start();
  console.log('started');
  console.log('stopping...');
  server.stop();
  console.log('stopped');
}

test().catch(console.error);

After completing tests in a repository of mine Jest has to be force exited for the process to quit.

git clone git@gitlab.com:webthings/all-webthings.git
cd all-webthings
git checkout cf92a899d376ca48411b56f04ca0c2915a41d2ba
npm test -- --detectOpenHandles

This output the following on my machine:

Ran all test suites.

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  Timeout

      at Object.<anonymous> (node_modules/dnssd/lib/sleep.js:14:16)
      at Object.<anonymous> (node_modules/dnssd/lib/Advertisement.js:14:13)

Because I assume that this is an issue more related to dnssd I filed it in that repository as well: DeMille/dnssd.js#10.

rzr commented

is it present in latest release ?

Yes. This is an issue with the dnssd library.