restify / clients

HttpClient, StringClient, and JsonClient extracted from restify
MIT License
57 stars 34 forks source link

Socket hangup when forcing restify client to retry ad infinitum #122

Open zyrolasting opened 7 years ago

zyrolasting commented 7 years ago

This is a cross-post from my question on SO. I suspect this is a configuration mistake on my end, and would appreciate any help understanding where that mistake lies.


I am running several Restify v4.2.0 services in separate processes. One of them is special because it needs to be up and listening before all of the others even start.

Assume that I cannot use IPC, and all services must talk to the special service via HTTP. This leaves me with HTTP clients that attempt to contact the special service ad infinitum, waiting until it is up.

Hence this client with intentionally extreme options.

const client = restify.createStringClient({
    url,
    retry: {
        retries: Infinity,
    },
});

// Inside a promise
client.get(endpoint, function(err, req, res, data) {
    if (err) {
        reject(err);
    } else {        
        // ...

        // Probably not needed for GET, but here anyway.
        req.end();
        resolve(data);
    }
});

No matter how I configure the client, I still immediately get socket hang up errors. I want the nodeback to never fire until it finally reaches the service.

What do I need to do to my configuration to accomplish this?

zyrolasting commented 7 years ago

@retrohacker Possibly related to https://github.com/restify/node-restify/issues/483

retrohacker commented 7 years ago

Hey @zyrolasting!

Sorry for the radio silence on this issue. restify/clients is currently a bit outside of my wheelhouse (I'm still getting up to speed on the main repo). It might be a while before I am in a position to fully grok the codebase in the client repo but will follow up here when I get to that point :heart:

In the meantime, restify/clients can definitely use some love if you are interested in helping out. Would be happy to work through this together at some point.

zyrolasting commented 7 years ago

@retrohacker I can make time to work on this issue and poke around.