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

Travis - set context timeouts #1590

Merged
merged 1 commit into from
Aug 9, 2018
Merged

Travis - set context timeouts #1590

merged 1 commit into from
Aug 9, 2018

Conversation

offerm
Copy link
Contributor

@offerm offerm commented Jul 19, 2018

some RPC calls are reusing the context of priors calls without resetting the timeout to 15 seconds. In a loaded system, this may lead to a random error since the 15 seconds may not cover all RPC calls.

@offerm offerm changed the title set timeouts and allow tickers to tick for coverage Travis - set timeouts and allow tickers to tick for coverage Jul 19, 2018
lnd_test.go Outdated
@@ -1025,6 +1028,7 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false)
ctxt, _ = context.WithTimeout(ctxb, timeout)
closeChannelAndAssert(ctxt, t, net, net.Bob, chanPoint2, false)
ctxt, _ = context.WithTimeout(ctxb, timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Good catch! The ctxt, _ = context.WithTimeout below can be removed, as it is obviously misplaced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed. Thanks for noticing

// without this the code handling the logTicker and fwdEventicker
// may not be called (randomally) during coverage tests and there will
// be a drop in coverage stats (build fail)
time.Sleep(16 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't really want to introduce more sleeps in the tests...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@halseth Please let me know what you want to do to as an alternative.
As ugly as this sleep is, without it we can't be sure that these two tickers actually ticks. If the tests run fast (stronger, not loaded machine) the tickers will not tick and the relevant code will not execute. This will cause a failure in coveralls step.

If you want to have a consistent build process, we better have this sleep (or look for something more complicated to ensure the ticker execution).

Let me know what you suggest.

Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look at how other tickers are being mocked:

BatchTicker: &mockTicker{time.NewTicker(batchTimeout).C},
, might be able to do something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I don't think that we want to mock or test these tickers here. The intention is that coveralls produces consistent results.
Mocking the ticker will prevent that code from running and reduce coverage so what will we gain.

I spend a lot of time on the analysis of the reasons for Travis and coveralls failures. I'm not a maintainer of this project but if I were, I would first make sure there is a stable test/build environment and only after that work on improvements.
The current situation where a PR may fail on different reasons which have nothing to do with the change done in that PR is not good.

I don't see what is wrong with these 16 seconds sleep.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@halseth BTW, see last checks of this simple PR. 2 failures which are unrelated to the change. At least coversall.io is green.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you mock the ticker, you can make it tick immediately, and won't have to wait the 16 seconds on it to happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@halseth please note that the ticker related change is now on its own PR.

@halseth
Copy link
Contributor

halseth commented Jul 25, 2018

The changes to lnd_test seems a bit unrelated to the ticker change? Could be made separate PRs I believe.

Also note that a recent PR of mine alters how timeouts are set during integration tests: #1621

@offerm
Copy link
Contributor Author

offerm commented Jul 25, 2018

Yes, I can make it two separate PRs. Will be done next week when I'm back from my vacation.

some RPC calls are reusing the context of priors calls without resetting the timeout to 15 seconds. In a loaded system this may lead to a random error since the 15 seconds may not cover all RPC calls.

removed one misplaced context setting
@offerm
Copy link
Contributor Author

offerm commented Jul 27, 2018

@halseth see #1641

@offerm offerm changed the title Travis - set timeouts and allow tickers to tick for coverage Travis - set context timeouts Jul 31, 2018
@offerm
Copy link
Contributor Author

offerm commented Jul 31, 2018

@halseth @Roasbeef removed the ticker related changes to a separate PR. Let me know if you need anything else on this one.

Also,

This PRs are important: #1588 #1589 #1591 #1592

If you don't want to work on these just let me know and I will close them.

Thanks

@halseth
Copy link
Contributor

halseth commented Jul 31, 2018

Blocked by #1621

@offerm
Copy link
Contributor Author

offerm commented Jul 31, 2018

@halseth not that I understand why #1621 should block this one.

My original PR #1493 was labeled as P2 by @Roasbeef. I spend a lot of time analyzing each and every failure I had. I found several issues. Some of them impact only the build process and others also relevant to production execution.

You have asked me to break the PR into small PRs. I spend time also on doing this just to find that most of these PRs are not even getting attention.

Looks like you are not really open to external contribution.

@halseth
Copy link
Contributor

halseth commented Aug 1, 2018

@offerm We appreciate your contributions, really! Right now we are preparing the v0.5 release, that's why some PRs (you are not alone) might not get all the attention they should have, as we have a very limited number of people and hours. Will get to it eventually, though!

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🥇

@Roasbeef Roasbeef merged commit 57d87ae into lightningnetwork:master Aug 9, 2018
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.

None yet

3 participants