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

HTTP API Prevents Graceful Shutdown w/ Chrome #478

Closed
spble opened this issue Jul 31, 2019 · 5 comments
Closed

HTTP API Prevents Graceful Shutdown w/ Chrome #478

spble opened this issue Jul 31, 2019 · 5 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed task Task to be completed

Comments

@spble
Copy link
Contributor

spble commented Jul 31, 2019

Description

With the inclusion of the graceful_shutdown function in the RESTful HTTP API, Lighthouse should properly shutdown on an interrupt such as Ctrl+C, however it does not.

Present Behaviour

  1. Start the beacon_node
  2. Make a HTTP request to the API
  3. Shutdown the beacon_node
  4. beacon_node hangs indefinitely, until...
  5. Make another HTTP request to the API
  6. beacon_node exits.

Expected Behaviour

  1. Start the beacon_node
  2. Make a HTTP request to the API
  3. Shutdown the beacon_node
  4. beacon_node exits.

Steps to resolve

There are several issues on the hyper github which may assist in resolving this issue, these must be revised and a solution devised that is elegant and encompasses all of the client services (API, RPC, etc.).

e.g. hyperium/hyper#1681

@spble spble self-assigned this Jul 31, 2019
@spble spble added bug Something isn't working help wanted Extra attention is needed task Task to be completed labels Jul 31, 2019
@spble spble added this to the v0.0.1 milestone Jul 31, 2019
@paulhauner
Copy link
Member

Note: this issue is only present when using Chrome to access the API. Using curl does not result in Hyper "hanging".

This leads me to believe that Chrome is keeping a connection alive and Hyper is acting correctly.

I still think we should leave this open until we figure out exactly what's going on with Chrome :)

@paulhauner paulhauner changed the title HTTP API Prevents Graceful Shutdown HTTP API Prevents Graceful Shutdown w/ Chrome Jul 31, 2019
@paulhauner paulhauner removed this from the v0.0.1 milestone Oct 25, 2019
@adaszko
Copy link
Contributor

adaszko commented Mar 4, 2020

I'm gonna take a look at this issue. Ping me if you have any additional information please.

@paulhauner paulhauner assigned adaszko and unassigned spble Mar 4, 2020
@adaszko
Copy link
Contributor

adaszko commented Mar 6, 2020

Turns out Chrome doesn't cause the Hyper HTTP server to hang. The shutdown simply takes a bit longer.

Here's how to the ^C looks with Firefox:
image

And with Chrome:
image

It can be seen that Chrome sends keepalives until it's connection timeout elapses. It's a separate confounding factor that Chrome has larger connection timeout settings than other browsers: 300 seconds compared to e.g. Firefox'es 90 (by default).

My opinion based on that is that the issue can be closed as there's nothing the built-in HTTP server does wrong.

@paulhauner
Copy link
Member

Great, thanks @adaszko!

I'm confident in saying that this is expected and reasonable behavior and that this issue can be closed :)

@surya-prakash-susarla
Copy link

Hey folks, quick question, I have been trying to create a server which simply shuts down after a GET request is received (an OAuth response scenario) and I seem to be running into the same issue. Using hyper with Safari works perfectly but with Chrome I run into the issue above where the exit only happens after the second request is made. Can anyone suggest a workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed task Task to be completed
Projects
None yet
Development

No branches or pull requests

4 participants