Question: Has anyone run across this error before ...
# kobweb
r
Question: Has anyone run across this error before when building their app (kobweb run --path=site):
Copy code
> Task :site:kspKotlinJs FAILED
e: java.lang.IllegalStateException: Storage for [/Users/ryan/repos/ryan/fsryan/consulting/wagemix/monolith/site/build/kspCaches/js/jsMain/symbolLookups/file-to-id.tab] is already registered
I'm hitting this even if I delete the build directory and run again.
m
I've seen it a couple of times but nothing to do with kobweb
r
Yah--I believe that.
m
I think it's an incremental compilation issue
r
But I just need to find if anyone has a workaround.
m
Or maybe a concurrent Gradle invocation or something fishy like this
r
interestingly, though, it is now happening every build for me.
m
Last time this happened, I rerun with
--rerun-tasks
I think
--rerun-tasks --no-build-cache --no-configuration-cache
usually works 🙂
YMMV
r
Ah--okay--so I invoke gradle directly, then.
Well . . .still happening, unfortunately.
l
FYI the kobweb cli supports passing gradle args
kobweb run --gradle "--rerun-tasks - - no-build-cache"
r
Thanks, but same result.
l
Try adding
ksp.incremental=false
to your
gradle.properties
file maybe? Maybe also
ksp.useKSP2=false
.
r
Perhaps if I mention what I did when this started happening, that could help direct the conversation. I had an algorithm that I wanted to test, so I added
Copy code
js(IR) {
        browser {
            testTask {
                useKarma {
                    useFirefoxHeadless()
                    webpackConfig.cssSupport {
                        enabled = true
                    }
                }
            }
        }
        binaries.library()
    }
to the kotlin block. It was able to run the tests just fine for a while, but eventually, this issue occurred. Unfortunately, removing that block from the gradle build did not fix this--even on a clean build.
Yah--I think you're on it with the ksp.incremental=false suggestion. However, I'm worried about this, as it would mean that clean doesn't actually clean.
I can confirm that that worked.
(just adding ksp.incremental=false)
l
Clean could not be enough if build cache is reused, but if you passed
--no-build-cache
then I don't know why it wouldn't work
r
I see.
Okay. I'll try this.
I'd like to keep incremental ksp if I can.
Thank you for your help @Letter and @mbonnin
👍 2
l
Looks like there are a couple open issues about the underlying ksp bug: https://github.com/google/ksp/issues?q=KspCaches
c
>
--rerun-tasks --no-build-cache --no-configuration-cache
usually works
--rerun-tasks
forbids Gradle from reading from the build cache already.
--no-build-cache
also forbids writing to the build cache, but if you have an incremental compilation issue, it's often better to allow Gradle to write to the build cache so it can overwrite whatever broken thing was stored before (and yeah, never trust
clean
, it's not about incremental stuff)
👍 2
r
Thanks for your help.
k
I have seen this issue when I encountered frequent OutOfMemory issue. I did a complete reset
Copy code
gradle --stop
Copy code
delete .gradle folder and included a  gradle.properties under the site folder with these settings:   
org.gradle.configuration-cache=true
org.gradle.jvmargs=-Xmx4G -Xms512M -XX:MaxMetaspaceSize=1G -XX:+UseParallelGC -Dfile.encoding=UTF-8
org.gradle.parallel=false
in case you haven't already sorted the issue
r
Thanks, @Kumaran Masilamani. No--the gradle daemon was not at issue here. The issue was my understanding of incremental ksp combined with an existing bug. However @Letter and @mbonnin’s responses above gave me what I needed.
b
I was also getting this issue when gradle ran OutOfMemory (after a lot of live reloads), doing a
gradle --stop
always fixed it for me