Should 'Task graph calculation' and 'Configuration...
# community-support
a
Should 'Task graph calculation' and 'Configuration caching' take so long? I'm making minor changes to source files and re-running the same task, and it's really disruptive that Gradle is dragging its feet for 2 minutes every build. The build scan gives zero useful information Can I do anything to investigate?
c
I would think "it depends" calculating my configuration cache is easily the slowest part of my build, it's like 45s. which is why the configuration cache is useful, so you don't have to recalculate it every time. Should it? I don't know, I have no idea what gradle is doing that it's caching. We don't know what task you're running, any configuration properties, or what you're modifying. So to answer this further is kind of hard. Possible you can get more information by increasing logging verbosity to --debug... . Sorry not being very helpful 😉
a
I think we're on the same wavelength Caleb, I just needed to vent more than anything, so vague advice helps 😁
c
I'm all about promoting venting! I have this special attachment valve to my neck that lets me do that. It's called my mouth and it's constantly running...
plus1 1
a
It's a closed source project, otherwise I would share the source & scan. It's using Kotlin Multiplatform 1.9.32, and Gradle 8.7, so it should be fast. Something unusual about it is that there are many composite builds.
The timeline on the scan is just bizarre, look at all that wasted time
w
I’m making minor changes to source files and re-running the same task
If you are only doing source file changes, the next build should be a configuration cache hit. Does the console give you any indication why it isn’t a CC hit?
a
yeah, that's what I thought too @wolfs I've run with
--debug
and I can see thousands of lines about fingerprinting files, and it seems slow
debug.log.txt
w
You don’t need debug for that. You can check the CC report. And there will be some printout at the beginning, like https://ge.gradle.org/s/r6thvbkjtqx7c/console-log?page=1#L0
a
the only message I can see about configuration cache is this, but that file hasn't been changed in a long time
Copy code
Calculating task graph as configuration cache cannot be reused because the file system entry 'modules/interop/build/tmp/downloadSource/Images/icon.jpg' has been removed.
is the configuration cache supposed to be monitoring the .git directory?
w
Hmm… For some reason that jpg ends up as an input of the build configuration.
It should not be monitoring the
.git
directory.
🤔 1
So some plugin (or your build logic) reads the
.git
directory at configuration time.
a
And now I see this message
Copy code
Calculating task graph as configuration cache cannot be reused because the file system entry '.gradle/configuration-cache/cfwillt1lnakn3lk0glzqb1u/projectfingerprint2384331854675562243.tmp' has been removed.
w
Hmm… That is all very strange. Is the
.gradle
directory a configuration input as well?
a
I guess 🤷 I don't know, Gradle doesn't really explain
adding some sort of check would be helpful, so when Gradle detects it's config-caching files it probably shouldn't, it emits a warning
TIL I learned about
org.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks
though
Adding this seems to help...
Copy code
org.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=**;~/**;
ah, it might be the IDEA plugin, it's not compatible with config cache?
c
Hmm... I'm not sure that reading .git is definitively inappropriate at configuration time. For example I suspect it's my version plugin that reads .git at configuration time. However, not all configuration cache invalidations appear to be equal. Whatever is reading my git directory repopulating that part of the cache appears to be fast. Now recursively reading all of the git directory? Shouldn't be happening in my case... I read a security bug apparently there's a version of jgit in Gradle itself, which tells me it does something with Git. Also, to be honest I'm not even sure what people use the idea plugin for anymore... Seems to work pretty well without it most of the time. Also I just had another idea. Have you tried running strace against your build? That'll tell you what files are being read. It will tell you all the files that are being read, So it'll take a while to use that and figure out what the problem is most likely
a
good point, maybe some .git files are valid inputs. But reading the entire .git dir is probably not correct!
I use the IDEA plugin to exclude the Gradle generated Kotlin DSL accessor dirs, because I don't like that they clog up my search results
c
Yes I would agree with that
Oh, neat idea. You should consider reporting a bug on YouTrack to do that inside of idea. I kind of hate that too.
a
A YouTrack issue is a good idea!
c
did you create (or find) that youtrack so I can thumb it up?