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

lntest: set ReadHeaderTimeout for http client #7715

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

bshramin
Copy link
Contributor

Change Description

Add ReadHeaderTimeout for HTTP client in lntests.
Fixes #7232
The same code can be found here: https://github.com/lightningnetwork/lnd/blob/master/tls_manager.go#L424

Steps to Test

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

@ellemouton
Copy link
Collaborator

Thanks for the PR @bshramin :)

I dont think this fixes #7232 though - that issue is suggesting that we should make the timeout configurable.

@bshramin
Copy link
Contributor Author

Thanks for the PR @bshramin :)

I dont think this fixes #7232 though - that issue is suggesting that we should make the timeout configurable.

You're right, but it's still an improvement. I do need some guidance for making it configurable.

@Chinwendu20
Copy link
Contributor

Chinwendu20 commented Sep 8, 2023

My understanding is that there should be a global variable for the ReadHeaderTimeout and this variable should be included as an arg for every occurrence of http.Server. In that way the timeout is configurable. IMO, I think the PR is a good start, just that it does not cover all the instances and the variable is not global per see? Maybe creating another package in the internal folder, where the variable would live would suffice.

@ellemouton
Copy link
Collaborator

To make it configurable, you need to add a variable to the main LND Config struct. The value can then be pulled from that struct (as is done for the Addr: cfg.Profile line two lines above your change

@bshramin
Copy link
Contributor Author

al variable for the ReadHeaderTimeout and this variable should be included as an arg for every occurrence of http.Server. In that way the timeout is configurable. IMO, I think the PR is a good start, just that it does not cover all the instances and the variable is not global per see? Maybe creating another package in the internal folder, where the variable would live would suffice.

Will work on it soon.

@bshramin
Copy link
Contributor Author

@ellemouton Does this look better?

@ellemouton
Copy link
Collaborator

@bshramin - looks better but a few things still missing:

  1. we should use the config value for all http.Server instances too(for example, the TlsManager one)
  2. with the current version of the PR, it will set the timeout to zero. We still need to use the 5 seconds as a default

@bshramin
Copy link
Contributor Author

bshramin commented Oct 6, 2023

@bshramin - looks better but a few things still missing:

  1. we should use the config value for all http.Server instances too(for example, the TlsManager one)
  2. with the current version of the PR, it will set the timeout to zero. We still need to use the 5 seconds as a default

Thank you, Elle. How are we looking now?

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! The commit messages don't have the right format, for reference pls check this link.

lnd.go Outdated Show resolved Hide resolved
config.go Outdated Show resolved Hide resolved
config.go Show resolved Hide resolved
tls_manager.go Show resolved Hide resolved
config.go Show resolved Hide resolved
@bshramin bshramin force-pushed the http-client-timeout branch 2 times, most recently from 9e53b99 to 7812dcf Compare October 10, 2023 19:22
@bshramin
Copy link
Contributor Author

@yyforyongyu Thank you for the comments. Is it better now?

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Very close! Could you take a look at the CI? It gives you instructions on what needs to be fixed,

  • need to update the sample config
  • need to add release notes(0.18.0)

The itests are flakes which can be ignored atm except this one,

--- FAIL: TestLightningNetworkDaemon/tranche02/70-of-135/bitcoind/REST_API/websocket_bi-directional_subscription (59.05s)

Not sure if it's related to this PR.

@bshramin bshramin force-pushed the http-client-timeout branch from 42aa8e3 to 7812dcf Compare October 12, 2023 04:05
@bshramin bshramin force-pushed the http-client-timeout branch 3 times, most recently from 10d23c3 to 1b9fb1f Compare October 12, 2023 04:22
@bshramin
Copy link
Contributor Author

bshramin commented Oct 12, 2023

Very close! Could you take a look at the CI? It gives you instructions on what needs to be fixed,

  • need to update the sample config
  • need to add release notes(0.18.0)

The itests are flakes which can be ignored atm except this one,

--- FAIL: TestLightningNetworkDaemon/tranche02/70-of-135/bitcoind/REST_API/websocket_bi-directional_subscription (59.05s)

Not sure if it's related to this PR.

Thank you for the detailed explanations. Is it better now?

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

LGTM🎉

docs/release-notes/release-notes-0.18.0.md Show resolved Hide resolved
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Very very close, just three small comments.

docs/release-notes/release-notes-0.18.0.md Outdated Show resolved Hide resolved
lntest/fee_service.go Outdated Show resolved Hide resolved
sample-lnd.conf Outdated Show resolved Hide resolved
@bshramin bshramin force-pushed the http-client-timeout branch 2 times, most recently from e44eadb to 023e62b Compare October 13, 2023 20:40
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 🎉

lntest/fee_service.go Outdated Show resolved Hide resolved
@bshramin bshramin force-pushed the http-client-timeout branch from 023e62b to eb907fc Compare October 16, 2023 21:32
lntest/fee_service.go Outdated Show resolved Hide resolved
@bshramin bshramin force-pushed the http-client-timeout branch from eb907fc to 0c64a18 Compare October 17, 2023 17:25
@guggero guggero added this to the v0.17.1 milestone Oct 17, 2023
@guggero guggero merged commit 91d9108 into lightningnetwork:master Oct 17, 2023
24 of 25 checks passed
@Roasbeef Roasbeef modified the milestones: v0.17.1, v0.18.0 Oct 31, 2023
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.

[feature]: make HTTP read header timeout configurable
6 participants