0

I am running an application (over and over again in a for loop) which is very heavyweight. I attempt to start the application via a python script.

Sometimes when I do that, I get a ERR_CONNECTION_REFUSED. Note: I am also running this on a grid machine which has several users with several processes running. If I run this application on my local machine (several times) I do not get this error.

My instinct is telling me that since the application is heavyweight, the "server" side of the application which should start right after the client is not starting on time and is being delayed.

Another hint which also points me to this direction is that I measure the time it takes for the application to start, it varies between 10 to 32 seconds.

Is there any suggestion of how I can prove that this is actually the scenario which is happening? Any tracing/process tools I can use for this?

  • 1
    Are you able to add logging to your application? If the client calls connect before the server calls listen, or if the server doesnt call accept often enough and the accept queue gets too large, the client will get a connection refused error. – Mark Plotnick Sep 7 '19 at 22:59
  • no I cant :( I don't have the source. – Har Sep 8 '19 at 10:02
  • @MarkPlotnick that's interesting though, the accept queue gets too large, how can that happen? Is that many processes performing an accept? – Har Sep 8 '19 at 11:16
  • 1
    The typical way to get connection refused, though, is for there to be no listener on that port on the server's system. The server should start, and call listen, before any clients try to connect to it. – Mark Plotnick Sep 8 '19 at 12:11
  • 1
    You might try strace -f -e trace=network yourpythoncommand and watch the sequence of listen and connect calls. – Mark Plotnick Sep 8 '19 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.