Today I spent a long time debugging a hanging program using the mahi client. The result of this investigation was that I inadvertently used the client after it had been closed. Restify's http agent, the default agent for the node-mahi client, is configured using keep alive. As a result, there was an extra socket open after the program's work had finished, resulting in the process hanging for 2 minutes or so until it timed out. (This socket was never cleaned up, as close() had already been called on the client.)
It would be nice if the client set a flag on itself when the close() method is invoked and return an error (or perhaps fail an assertion) on other methods if the client has been marked as closed.
Today I spent a long time debugging a hanging program using the mahi client. The result of this investigation was that I inadvertently used the client after it had been closed. Restify's http agent, the default agent for the node-mahi client, is configured using keep alive. As a result, there was an extra socket open after the program's work had finished, resulting in the process hanging for 2 minutes or so until it timed out. (This socket was never cleaned up, as
close()had already been called on the client.)It would be nice if the client set a flag on itself when the
close()method is invoked and return an error (or perhaps fail an assertion) on other methods if the client has been marked as closed.