Search code examples
node.jsconnection-refused

Getting strange connection refused behavior


I have a express nodejs application that has just recently exhibited strange 'connection refused' behavior. It probably is related to my upgrade of nodejs - to version 6.10.0 (and I also tried 7.9.0). Even if the upgrade is the start of the cause, I would like to understand why this is happening.

The behavior is: Consistently, it alternates between successfully bringing up the application, and getting a 'connection refused error'. This pattern is consistent. I like consistency - as opposed to intermittency - but I am having difficulty knowing where to start looking.

You see this for yourself, at http://162.243.254.205:1880/ (node 7.9.0)

When I get a "refused to connect", Chrome Devtools shows all files "connection refused". Reloading the url is then repeatedly successful. ie.

:1880/ritc_style.css Failed to load resource: net::ERR_CONNECTION_REFUSED
:1880/bootstrap/css/bootstrap.min.css Failed to load resource: net::ERR_CONNECTION_REFUSED
:1880/orion/built-editor.css Failed to load resource: net::ERR_CONNECTION_REFUSED
:1880/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css Failed to load resource: net::ERR_CONNECTION_REFUSED
:1880/jsonviewer/jsonviewer.css Failed to load resource: net::ERR_CONNECTION_REFUSED
:1880/font-awesome/css/font-awesome.min.css Failed to load resource: net::ERR_CONNECTION_REFUSED
:1880/style.css Failed to load resource: net::ERR_CONNECTION_REFUSED
jquery-1.11.1.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
bootstrap.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
jquery-ui-1.10.3.custom.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
jquery.ui.touch-punch.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
jquery.confirm.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
tinymce.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
marked.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
built-editor.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
ace.js Failed to load resource: net::ERR_CONNECTION_REFUSED
ext-language_tools.js Failed to load resource: net::ERR_CONNECTION_REFUSED
d3.v3.min.js Failed to load resource: net::ERR_CONNECTION_REFUSED
main.js Failed to load resource: net::ERR_CONNECTION_REFUSED
settings.js Failed to load resource: net::ERR_CONNECTION_REFUSED

...

The 'connection refused' message makes it look like a network issue. However, if I substitute a simple test on the server (a helloworld express app) I do not get this behavior, so it must have something to do with nodejs.

I am at a loss!

Can anyone help?

Thanks

Colin Goldberg


Solution

  • I have found the reason for this.

    Using Chrome all the time - which is my preference - was the reason I did not get to this point sooner. All I was getting in Chrome was the alternating information - success (with appropriate console logs), and failure (a list of connection refused messages) - consistently repeated.

    When I ran it in Firefox, it first succeeded, then failed, then succeeded, then failed (ie. same behavior!). But on the second failure it gave the error message "Unable to Connect to (IP address)" - ie. different behavior than Chrome.

    I then found an error message in the log (somehow I had missed this before) indicating that an (obscure) module had crashed - one that saved and removed events (hence the alternating behavior). Upgrading this module (ultron) seems to have fixed the problem.

    Thank you Glen for your words of encouragement. As I am (most often) in a hurry to get things done, it is easy to panic - especially near the end of the day. A good night's sleep got me into the right frame of mind to think more clearly.

    Colin Goldberg