Search code examples
node.jsnoflo

EADDRINUSE when starting an xpress/Server example


I'm pretty new to noflo, so this is probably due to me doing something dumb.

I'm getting an issue when trying to start a noflo graph from the noflo-ui. Basically I get a EADDRINUSE error (the port is in use) from the first xpress/Server node in my graph, I believe. I'm running the ui locally if that matters (I don't think it should).

Usually, if I was running a normal Express service, I would just kill the 'runaway' process which is hogging the port, but I'm having problems finding it. I've tried things like "netstat -p tcp | grep " and "ps -ef | grep " to no avail.

I've also tried a couple of 'noflo' things, which may or may not be a good idea. 1) First I tried deleting the browser database completely (I'm still not 100% sure how this relates to the runtime environment and have tried variations of passing parameters to the noflo-nodejs command and using the json config created using the noflo-nodejs-init). 2) Second, I created a new graph which uses a different port. By stopping/restarting the new graph in the ui and testing the expected endpoints through postman, I have realised that actually the process of starting seems to start an xpressServer for both the new and the old port, so I can do a GET on both http://localhost:8000/hello and http://localhost:8001/hello and get 'hello' back.

Could anyone tell me what I've done wrong and the best approach for resolving it if possible.

NOTE: I did try restarting my Mac which did not seem to help initially either, so I can only assume chrome is caching something I have missed perhaps ... (a guess). Having done a hard reboot this morning and making sure all my apps are closed, this does seem to have resolved itself but I would still like to understand what is going on, so I don't end up in this situation again.

Thanks


Solution

  • The noflo-xpress Server component frees up its port(s) at the component teardown stage.

    This means that to free up the port you have to either:

    1. Stop the network execution (causing teardowns to be called) using network.stop() (or via the "pause button" in Flowhub)
    2. Stop the NoFlo runtime process where you run noflo-xpress