Hi! I'm seeing a configuration cache crash but I d...
# configuration-cache
i
Hi! I'm seeing a configuration cache crash but I don't understand it.
Copy code
Exception in thread "DefaultSharedObjectDecoder reader thread" org.gradle.api.GradleException: Could not load the value of 
  field `collection` of `kotlin.collections.builders.SerializedCollection` bean found in 
  field `_byTask` of `org.jetbrains.kotlin.gradle.targets.js.nodejs.TasksRequirements` bean found in 
  field `tasksRequirements` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolver.KotlinCompilationNpmResolution` bean found in 
  field `byCompilation` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolved.KotlinProjectNpmResolution` bean found in 
  field `v` of `java.util.Collections$SingletonMap` bean found in field `projects` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolved.KotlinRootNpmResolution` bean found in 
  field `__resolution__` of `org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager$Parameters_Decorated` bean found in Gradle runtime.
	at org.gradle.internal.serialize.graph.BeanPropertyExtensionsKt.readPropertyValue(BeanPropertyExtensions.kt:70)
	at org.gradle.internal.serialize.beans.services.BeanPropertyReader.readFieldOf(BeanPropertyReader.kt:93)
…
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 53 out of bounds for length 4
	at org.gradle.internal.serialize.codecs.core.jos.JavaObjectSerializationCodec.decode(JavaObjectSerializationCodec.kt:299)
	at org.gradle.internal.serialize.graph.codecs.BindingsBackedCodec.decode(BindingsBackedCodec.kt:92)

* What went wrong:
Could not load the value of field `__npmResolutionManager__` of task `:jsPackageJson` of type `org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask`.
No build scan was generated, even though they are enabled. From what I can tell, this was introduced by this commit, but I don't understand why.
v
Did you get the configuration cache report generated and can share it? It should also be generated even if not advertised on command line, if possible.
i
No, it don't see it in
build/reports/configuration-cache
.
On CI it mentions having generated a Problems report but it's not generated locally šŸ˜•
r
The
ArrayIndexOutOfBoundsException
suggests a bug in the configuration cache. Even without a reproducer, this would be worthwhile reporting, the stacktrace alone may be sufficient.
Do you have CC parallel store enabled, by any chance?
i
That repository just has
--configuration-cache
šŸ‘ 1
r
Could be a corrupted cache entry, if this is for a cache hit.
i
The full stack trace is available in the last link I shared above ↑
r
Sure, just suggesting this could be a bug, and an issue report would increase the chances of it being fixed.
i
On the Gradle GitHub?
šŸ‘ 1
Could be a corrupted cache entry, if this is for a cache hit.
It's reproducible between multiple installations, without shared build cache.
m
If the issue is reproducible, it may be worth it to try enabling integrity checks: https://docs.gradle.org/current/userguide/configuration_cache_debugging.html#config_cache:integrity_check It may help to pinpoint broken serialization logic, if that is the cause.
i
Just tried enabling them, I don't see a difference in the standard output
v
Did you make sure when trying with that option that a new CC entry was written? If only an existing one is reused, the additional check data is missing from the entry
i
Just tried again after deleting
.gradle/configuration-cache
, I don't see a difference
Would you have an idea of how to workaround this?
r
Ivan, could you try to disable parallel caching? (by commenting out this line in
gradle.properties
)
Copy code
#org.gradle.configuration-cache.parallel=true
I confirmed your reproducer does not need parallel CC. On the bright side, seems it was fixed in 9.0.
šŸ‘€ 1
v
Great, do you have an idea why enabling the integrity checks did not find the problem?
r
Integrity checks make sure the entire payload for every object we deserialize was effectively read, it does not change the way exceptions in deserialization are handled.
It is about detecting serialization issues as they happen for every object read (instead of letting it show up as an error reading the next object).
v
Ah, and that was just a different exception, I see, thx.
šŸ‘ 1
r
Basically, it adds a marker after each object payload, and ensures we see the marker again once the object is fully read.
šŸ‘Œ 1
v
Ah, ok, I wonder that this is then so much overhead it is not enabled by default
r
Indeed
m
It can inflate the entry by 15% quite easily, so this matters for larger builds.
v
Oh, ok
i
It can inflate the entry by 15% quite easily
Does it particularly slow down the build? Personally, I care about speed but not much about storage space, so I may enable it by default if it doesn't slow down too much
On the bright side, seems it was fixed in 9.0.
Thanks, I'll try upgrading as soon as I can.
m
Does it particularly slow down the build?
Today probably not. I'm not 100% sure, but I don't recall seeing an effect in our performance tests. Main danger with enabling the check permanently is that a new Gradle version may add new, slower diagnostics without you noticing. Obviously, we're aiming more at another end of speed-vs.-thoroughness tradeoff here.
šŸ‘ 1