This message was deleted.
# configuration-cache
s
This message was deleted.
v
Not that I'm aware of
r
There isn’t.
Is this a case in which the plugin causes so many configuration cache problems that you’d like to automatically disable cc whenever the plugin is applied or something else?
j
Probably same issue I had where using that function plus
warn
is not possible
v
My guess would have been that it does some other CC incompatible things like registering incompatible listeners and similar.
d
yes, i tried to hook up an internal plugin and there's a lot of errors that aren't very obvious how to fix.. our internal classes use gson
Copy code
2022-06-24 07:27:50 PDT	               > Configuration cache state could not be cached: field 'constructorConstructor' from type 'com.google.gson.Gson': error writing value of type 'com.google.gson.internal.ConstructorConstructor'
2022-06-24 07:27:50 PDT	                  > Configuration cache state could not be cached: field 'accessor' from type 'com.google.gson.internal.ConstructorConstructor': error writing value of type 'com.google.gson.internal.reflect.UnsafeReflectionAccessor'
2022-06-24 07:27:50 PDT	                     > Configuration cache state could not be cached: field 'overrideField' from type 'com.google.gson.internal.reflect.UnsafeReflectionAccessor': error writing value of type 'java.lang.reflect.Field'
2022-06-24 07:27:50 PDT	                        > Configuration cache state could not be cached: field 'root' from type 'java.lang.reflect.Field': error writing value of type 'java.lang.reflect.Field'
2022-06-24 07:27:50 PDT	                           > Configuration cache state could not be cached: field 'overrideFieldAccessor' from type 'java.lang.reflect.Field': error writing value of type 'jdk.internal.reflect.UnsafeBooleanFieldAccessorImpl'
2022-06-24 07:27:50 PDT	                              > Unable to make field protected final java.lang.reflect.Field jdk.internal.reflect.UnsafeFieldAccessorImpl.field accessible: module java.base does not "opens jdk.internal.reflect" to unnamed module @24b175f
v
Hard to tell without seeing your code. The HTML configuration cache report should tell you though where the problems originate from exactly. It seems you have some state that the cache tries to serialize that is not serializable.
d
i can share the full snippet in #C02MMEYC7HA
but it's not blocking since this is CI only code.. so i'm trying to work on guarding it
here's the trace, a bit obfuscated
v
Is
com.foo.plugins.gradle.scan.data.SkippedCompilationTask
your task?
d
Yes, and I've tried marking that as non cachaeble, but the error surfaces from the plugin too
v
If I read it correctly, that task has a field called
__buildScanExtension__
where you store the
com.gradle.enterprise.gradleplugin.internal.extension.DelegatingBuildScanExtension
instance which is not properly serializable and thus the tasks state cannot be cached.
d
our plugins initialize
FooTaskContext
which gives the same stack trace
Copy code
private val taskContext: FooTaskContext by lazy { FooTaskContext(project) }
at the top level in those plugins
i did mark that as
@get:Internal
Copy code
@get:Internal
    abstract val buildScanExtension: Property<BuildScanExtension>
v
at the top level in those plugins
Having that in the plugin is probably not the problem. But I guess you inject that into your tasks and if the cache tries to serialize the state of the tasks to the cache, that fails.
i did mark that as
@get:Internal
That's for whether it is considered as input or output for up-to-date checks and build output cache key calculation. It is meaningless for configuration cache. The configuration cache needs to serialize the complete state of the object, (unless there was some transient setting I don't remember right now), so that it can restore the tasks state from the cache. This even affects private fields. How else should the task work when it is restored from cache and no code to set those fields is executed?
d
i see, maybe instead of passing buildScan to the task, I should access it directly from
project
for the other area.. i'll take another look.. it doesn't feel too good guard CI code
on second thought, my build with config cache works locally and it goes through the
__buildScanExtension__
code path, so it makes me think that it's more due to the other part inside
FooTaskContext
v
I should access it directly from
project
At execution time? That would not be configuration cache safe either.
😅 1