carbon-io / carbond

MIT License
2 stars 5 forks source link

SIGINT takes a very long time to close server under certain circumstances #211

Closed tfogo closed 7 years ago

tfogo commented 7 years ago

Say you have an endpoint that hangs and doesn't return anything to the client, eg:

var carbon = require('carbon-io')
var o = carbon.atom.o(module).main
var __ = carbon.fibers.__(module)

__(function() {
  module.exports = o({
    _type: carbon.carbond.Service,
    port: 8888,
    endpoints: {
      hello: o({
        _type: carbon.carbond.Endpoint,
        get: function(req) {
          console.log("Don't return anything")
        }
      })
    }
  })
});

Now, if I make a call to /hello, when I try to Ctrl-C out of the process on the shell, it takes much longer than expected to kill the process. It ouputs these lines:

[Fri Jun 23 2017 10:28:46 GMT-0700 (PDT)] INFO: Service stopping...
[Fri Jun 23 2017 10:28:46 GMT-0700 (PDT)] INFO: Service stopping HTTP server

At this point it hangs. Then after over a minute it continues:

[Fri Jun 23 2017 10:30:41 GMT-0700 (PDT)] INFO: Service closing database connections
[Fri Jun 23 2017 10:30:41 GMT-0700 (PDT)] INFO: Service stopped
[Fri Jun 23 2017 10:30:41 GMT-0700 (PDT)] INFO: bye

Expected behavior: kill the process quickly on SIGINT

willshulman commented 7 years ago

Greg assigning to you so you can explain status to Tim and link to the other ticket we have on node env (could not find it)

tfogo commented 7 years ago

Duplicate of #166