restify / restify/clients

Socket hangup when forcing restify client to retry ad infinitum

Open
#122 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
58
Forks
35
Avg merge
22h 4m
Merged PRs (30d)
10

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Restify v4.2.0 client configuration shown in the issue, especially createStringClient, the retry option, and the client.get callback. Reproduce the socket hang-up behavior with retries set to Infinity and compare it with the intended retry behavior. Done means identifying whether the configuration is supported and documenting or correcting the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.