Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc-js: transition out of TRANSIENT_FAILURE if backoff timer has ended #1446

Merged

Conversation

murgatroid99
Copy link
Member

If the backoff timer ends before the connection attempt fails, the subchannel needs to transition into TRANSIENT_FAILURE briefly to signal to the channel that the connection attempt failed, but then it needs to transition out of TRANSIENT_FAILURE to be able to try to connect again.

This fixes #1434.

* TRANSIENT_FAILURE as though the backoff timer is ending right now */
if (!this.backoffTimeout.isRunning()) {
process.nextTick(() => {
this.handleBackoffTimer();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I think I would've liked it slightly better if there was a way to restart the backoffTimeout with a deadline of "now", which would've essentially streamlined this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fundamentally, what's happening here is that the backoff timer already triggered, but the result of the timer was deferred until this state transition. It's important here that the backoffTimeout is not reset, and that it keeps any backoff it has accumulated.

@murgatroid99 murgatroid99 merged commit 8482928 into grpc:master Jun 3, 2020
@sidd-kulk
Copy link

package.json:

"@google-cloud/pubsub": "^1.1.6",
    "@grpc/grpc-js": "^1.1.7",
package-lock.json
"@google-cloud/pubsub": {
      "version": "1.7.3",
      "resolved": "https://registry.npmjs.org/@google-cloud/pubsub/-/pubsub-1.7.3.tgz",
...
"@grpc/grpc-js": {
          "version": "1.0.5",
          "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.0.5.tgz",
          "integrity": "sha512-Hm+xOiqAhcpT9RYM8lc15dbQD7aQurM7ZU8ulmulepiPlN7iwBXXwP3vSBUimoFoApRqz7pSIisXU8pZaCB4og==",
          "requires": {
            "semver": "^6.2.0"
          }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call stuck connecting when server is initially unavailable, but becomes available later
3 participants