Skip to content

Disable ccache by default for versions older than 3.4.3 #1029

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

Merged
merged 4 commits into from
Jun 7, 2022

Conversation

eramongodb
Copy link
Contributor

Description

This PR addresses the "ccache.conf: No such file or directory" spurious failures on Evergreen by conditionally disabling ccache by default given the detected ccache version is older than 3.4.3.

After further investigation, I found this issue thread which documented the same spurious failure being observed on Evergreen. Thread participants deduced the cause to be ccache being invoked in parallel, "which is problematic because ccache creates its configuration in $HOME/.ccache/ccache.conf on first run, but in non-atomic way, which breaks with error". This issue was then reported and subsequently patched in ccache version 3.4.3.

As of time of writing, this condition to disable ccache by default should only affect Evergreen tests being run on the Ubuntu 18.04 variant, which uses ccache version 3.4.1.

Copy link
Contributor

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

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

LGTM, but one recommended tweak. Good job on tracking this back to an actual CCache bug.

@@ -12,11 +12,29 @@
find_program (CCACHE_EXECUTABLE ccache)
if (CCACHE_EXECUTABLE)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend adding AND NOT DEFINED MONGO_USE_CCACHE so that this branch only executes the first time and only if the user hasn't already provided a setting. This also prevents the message() from printing multiple times and possibly not reflecting the value that the user has set.

)

# Assume `ccache --version` mentions a simple version string, e.g. 1.2.3
set (SIMPLE_SEMVER_REGEX "([0-9]+)\.([0-9]+)\.([0-9]+)")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not always a valid assumption. For instance, on Debian stable, here is the output of ccache --version:

root@build01:~# ccache --version
ccache version 4.2

Copyright (C) 2002-2007 Andrew Tridgell
Copyright (C) 2009-2021 Joel Rosdahl and other contributors

See <https://ccache.dev/credits.html> for a complete list of contributors.

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good info, thank you. Adjusted the regex to permit omission of the patch number. Also included a CMake warning message to report when version string assumptions are violated so that the need for adjustments can be more easily detected.

Copy link
Contributor

@rcsanchez97 rcsanchez97 left a comment

Choose a reason for hiding this comment

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

LGTM

@eramongodb eramongodb merged commit f55cc6a into mongodb:master Jun 7, 2022
@eramongodb eramongodb deleted the ccache-bugfix branch June 7, 2022 18:46
Comment on lines +12 to +14
if (NOT DEFINED MONGO_USE_CCACHE)
find_program (CCACHE_EXECUTABLE ccache)
if (CCACHE_EXECUTABLE)
Copy link
Contributor

Choose a reason for hiding this comment

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

The find_program needs to occur in case that USE_CCACHE is TRUE before CCACHE_EXECUTABLE has been set. The find_program() call is already cache-aware and will be a no-op if the variable is already set to a truth-y value (i.e. has already been set or successfully found).

Suggested change
if (NOT DEFINED MONGO_USE_CCACHE)
find_program (CCACHE_EXECUTABLE ccache)
if (CCACHE_EXECUTABLE)
if (CCACHE_EXECUTABLE AND NOT DEFINED MONGO_USE_CCACHE)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, my mistake. Followup in #1031.

Comment on lines +44 to +45
endif (CCACHE_EXECUTABLE)
endif (NOT DEFINED MONGO_USE_CCACHE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
endif (CCACHE_EXECUTABLE)
endif (NOT DEFINED MONGO_USE_CCACHE)
endif ()

(To match the other suggestion)

kevinAlbs added a commit that referenced this pull request Aug 31, 2022
kevinAlbs added a commit that referenced this pull request Aug 31, 2022
* Revert "Do not elide find_package() if MONGO_USE_CCACHE is set (#1031)"

This reverts commit 237bcf8.

* Revert "Disable ccache by default for versions older than 3.4.3 (#1029)"

This reverts commit f55cc6a.
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.

3 participants