Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jul 2, 2020

No description provided.

@fanquake fanquake added the Tests label Jul 2, 2020
@maflcko maflcko closed this Jul 2, 2020
@maflcko maflcko reopened this Jul 2, 2020
@maflcko
Copy link
Member Author

maflcko commented Jul 2, 2020

@sipsorcery Any thoughts on this?

Also, unrelated, I was wondering how to enable C++17 in appveyor. I.e. how to pass down this option: https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019

@sipsorcery
Copy link
Contributor

@MarcoFalke the appveyor cache is being used to store dependencies not the build results:

cache:
- C:\tools\vcpkg\installed -> build_msvc\vcpkg-packages.txt
- C:\Qt5.9.8_x64_static_vs2019

If the cache is wiped out by setting APPVEYOR_SAVE_CACHE_ON_ERROR: false then the next build after a failure will have to restore all the dependencies. This will more than likely result in the build never being able to complete since restoring dependencies, building Bitcoin Core and running the tests is unlikely to fit within the appveyor time limit (depending on what the time limit currently allocated to Bitcoin Core is). I'd strongly advise against merging this change. After the first failed build it's likely all subsequent appveyor builds will fail with a timeout.

At one point clcache was used to cache the build results but during my testing I was never convinced it reduced the build time (the project seems to be discontinued now so perhaps I wasn't the only one with that finding).

For the C++17 build it will need a compiler option set in common.init.vcxproj. I can test and submit a PR for that if you like? I can remove the CLCACHE_SERVER: 1 variable at the same time.

@maflcko
Copy link
Member Author

maflcko commented Jul 2, 2020

This will more than likely result in the build never being able to complete

I have concluded the opposite:

  • The same cache is wiped when build_msvc/vcpkg-packages.txt changes. So if builds never could succeed from scratch, then how did we get the first compilation to finish? Or how could we change packages in the future if the cache never gets invalidated?
  • If a build times out, why would there be any time to upload the cache? I think APPVEYOR_SAVE_CACHE_ON_ERROR refers to a build or test error, not a timeout.
  • This morning a pull request failed to build and seemingly corrupted the cache. See the picture and links below.

First failure (pull): https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/33856815
First passing build (The pull that fixed it by removing the cache): https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/33867492

Interestingly the first passing build with the invalidated cache took the same time to build as it takes other builds to run, so maybe the cache is not needed after all?

Screenshot_2020-07-02 Bitcoin Core - AppVeyor

@sipsorcery
Copy link
Contributor

The same cache is wiped when build_msvc/vcpkg-packages.txt changes. So if builds never could succeed from scratch, then how did we get the first compilation to finish? Or how could we change packages in the future if the cache never gets invalidated?

It is/was a juggling act. On my fork I have an appveyor-force-refresh branch (bit out of date now) that uses Exit-AppveyorBuild after the dependencies are installed that exits the job before the build solely to get the dependency cache set. After that run I'd switch back to master and do the build with the dependencies already in the cache.

If a build times out, why would there be any time to upload the cache? I think APPVEYOR_SAVE_CACHE_ON_ERROR refers to a build or test error, not a timeout.

Yes you are right my mistake. As per above I used to have to exit the job early to avoid a timeout in order to get the cache updated.

Interestingly the first passing build with the invalidated cache took the same time to build as it takes other builds to run, so maybe the cache is not needed after all?

From a quick look at the appveyor job history there was a spike of jobs rebuilding the vcpkg dependencies. I suspect, but didn't verify, that a PR changed the build_msvc\vcpkg-packages.txt file and thereby invalidated the C:\tools\vcpkg\installed cache entry. The subsequent PR most likely had the original packages file causing it to also invalidate the cache.

The following jobs all use the vcpkg cache WITHOUT re-generating:

  • master.22376 45:21
  • master.22375 44:19
  • master.22374 45:27
  • master.22373 45:51

These jobs DID rebuild the vcpkg dependencies:

  • master.22370 60:04
  • master.22369 60:03
  • master.22368 60:02

So a consistent 15 minute difference if vcpkg dependencies need to be rebuilt. Also the Bitcoin Core appveyor jobs do seem to have more resources than free/personal appveyor accounts. My own appveyor account can't build + test Bitcoin core in under an hour even with the dependencies in the cache.

But I know where you're coming from, caches are always a pain precisely because of issues like this. I was obviously a bit melodramatic when I said all builds will fail if this PR is merged. The builds referenced above show they are still passing even when the vcpkg dependencies are rebuilt, they just take 15 minutes longer.

I guess if the cache is causing issues AND the build can still be done under the appveyor time limit it does make sense to remove it. Waiting an hour for a CI job seems like it's too long but if there's a queue of jobs an extra 15 minutes is not noticeable. It would mean free/personal appveyor accounts are unlikely to ever be able to use this script successfully but that's the case now any way.

@maflcko
Copy link
Member Author

maflcko commented Jul 3, 2020

Oh, I see. I think we got our max timeout raised by staff at some point, which you can also raise in your forked repo.

Lets continue the C++17 discussion in #16684 (comment)

Closing this pull for now.

@maflcko maflcko closed this Jul 3, 2020
@maflcko maflcko deleted the 2007-ciAppv branch July 3, 2020 11:08
@maflcko maflcko restored the 2007-ciAppv branch July 4, 2020 10:51
@maflcko maflcko reopened this Jul 4, 2020
@maflcko
Copy link
Member Author

maflcko commented Jul 4, 2020

reopen per #19440 (comment)

@maflcko
Copy link
Member Author

maflcko commented Jul 4, 2020

Going to merge this to see if it helps with #19440 (comment)

If not, the cache should probably be removed altogether.

@sipsorcery
Copy link
Contributor

ACK 666686f.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 4, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@maflcko maflcko closed this Jul 4, 2020
@maflcko maflcko deleted the 2007-ciAppv branch July 4, 2020 18:03
maflcko pushed a commit that referenced this pull request Jul 4, 2020
…locks from appveyor config

961e667 Remove cached directories and associated script blocks from appveyor CI configuration. (Aaron Clauson)

Pull request description:

  Appveyor CI jobs have been failing in the last 24 hours due to a seemingly corrupted cache, see #19440.

  It's possible that the appveyor cache issue is related to the[ recent update](https://www.appveyor.com/updates/2020/07/03/) of the Visual Studio 2019 image

  PR #19431 changes the "save cache or error" to false in an attempt to avoid a failing CI job from potentially corrupting the cache. In theory the only way a PR could affect the cache is if the `vcpkg` install list changed. That happens very rarely and did not happen in the last 24 hours and so was not the cause of the current cache problems.

  I have done some testing with appveyor build jobs on my own fork and found that installing the `vcpkg` dependencies from scratch and doing a full build can now be done in just under 60 minutes. This is the first time in over 5 months I have been able to build Bitcoin Core on appveyor. Either the new Visual Studio 2019 image has dramatically reduced the build time or appveyor images have had their CPU increased.

  This PR removes all use of dependency caching from the appveyor CI config. The trade-off is the 15 minutes saved on each build from having the dependencies cached versus the hours maintainers need to spend investigating when the CI jobs start failing.

ACKs for top commit:
  MarcoFalke:
    ACK 961e667

Tree-SHA512: 788c7efbfe6e044739ec41b08df30e24e26bfe0f31d1f5695e7243222a2eb649a2b5fd0254a9238fd416661dc05f737b0545d39feea7aa0da2236fffd7683a1b
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants