-
Notifications
You must be signed in to change notification settings - Fork 409
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
dokkaJavadocJar fires "java.lang.OutOfMemoryError: Metaspace" #1405
Comments
This is really bizarre. Dokka is indeed memory-intensive in some parts, which are not yet optimized, but it should only affect heap space. I don't know what could cause overflow of metaspace. We will definitely profile that. |
Also thanks for suggesting a workaround. I'll repost it for the better visibility. Workaround:put |
Could you check if this is reproducible if you run |
If you need a project to reproduce it happens in the integration tests of our Gradle plugin which runs dokka. The commit vanniktech/gradle-maven-publish-plugin@3ef0227 |
Both seem working |
What does this have to do with the daemon, @Kordyjan? |
Just got again |
I get the same error for dokkaHtml for a not-so-large multi-module project. And yes, it is reproducible. Enlarging metaspace seems to be working. |
I'm getting the same problem here, with or without the daemon. |
In my case I had to bump the metaspace even further (1024m). |
I believe one reason for this is parallel execution which spawns multiple processes which fight over the same resource. Running with the |
Although 512MB is not enough for my project, I also had to bump to 1024. I wouldn't be surprised you need even more if you have more modules |
Any updates on this? It's turning out to be a pretty massive issue because we're having trouble publishing our library that has lots of modules. Happy to spend some time debugging if someone can point me in the right direction. |
This issue is even more problematic since the Gradle Daemon doesn't die but rather hangs so you have to manually kill it. The error in question something like this:
|
I'm having the exact same experience in a rather small multi-module project. Already tried to increase metaspace and to disable parallelism but it didn't provide any deterministic results. |
I am also experiencing the same issue in https://github.com/micronaut-projects/micronaut-kotlin/tree/issue-78 Running Definitely seems a memory leak is the culprit, please let us know how profiling that bit goes!
|
Frequent OOM error in a fairly small project.
Since the usual first response from any OOS maintainer is "have you tried the latest version", I'm running v1.4.10.2. @willbuck A Javadoc engine shouldn't need 2G RAM to generate a dozen or so HTML files (that's how many for me). |
Mee too, pretty small project: https://github.com/Kotlin/kotlin-jupyter/tree/notebook-api |
I have the same issue, simple multimodule object. The gradle properties helps locally, but my CI system is github actions, i dont have 2G available there |
Today I saw some new errors related to this:
This time it actually shows some more info on when you get OOM. It seems to be while reading the metadata/class files for the kotlin stdlib in my case. This happened while generating gfm docs specifically. |
In our project the problem disappeared after upgrading to Dokka 1.6.10. |
Just got again this using dokka 1.6.21 with Kotlin 1.7.0.
If I build again without making any changes, it usually works. I have |
Just failed again, differently:
|
Hi @GlenKPeterson! Are you using tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
configureEach {
samples.from("samples/basic.kt", "samples/advanced.kt")
}
}
} If not, I'm afraid that might be related to Gradle daemons not freeing memory. Try running your builds with Running |
Thanks for your response. I'm always using
Could that be what's messing me up? I searched my entire project for "samples" and only found an image: I only have one |
@GlenKPeterson is
If you're not using samples, you should not experience any major leaks. If it's an open source project, I can have a look, but if it's closed source, there's little I can do. Try increasing metaspace and have a look at the Metaspace Graph in VisualVM. You should see the saw-like pattern just like in the screenshot above. If it only goes up and never down, try pressing If you need help or have questions, feel free to reach out to me at |
* Upgrade mvn publish pluging; fix dokka setup for change * Attempt to get dokkaGfm to work properly - OOM/Metaspace problem, see: Kotlin/dokka#1405 * Upgrade to Kotlin 1.5 * Upgrade to kotlin 1.5; fix misk-admin config; use --no-daemon --> still OOM/Metaspace :( * Do Dokka tasks in separate daemons and separate modules; reduce memeory required * Remove non-existent dir call * Only do the publish docs when building master
I was just clearing large files out of my drive and found more data for you. I still get this issue from time to time. After looking at this briefly, I wonder if I'm using too many links in my KotlinDocs? Or linking to the Java or Kotlin documentation on the web too often? I have a vague recollection of using a compile parameter to specify which version of the standard library documentation to link to, but don't remember if that's for this project or not. |
* refactor examples and integration tests - example and integration test projects are automatically copied from Dokka src - integration tests will use the example and integration tests projects * prep dokkatoo example projects * updating integration tests and test projects * git ignore gradle.properties in dokkatoo examples * add code for includeBuild-ing the example projects * setup dokkatoo gradle-example * a bit of integration-test refactoring * add remoteUrl util function * rm setting null into dokkatooCacheDirectory (it's not necessary) * update a couple of build script comments * implement GradleExampleTest * update .gitignore to be more comprehensive * add options for increasing DokkaGenerator memory, and also increase the memory * increase Gradle memory * fix BasicProjectIntegrationTest * try fixing task updateGradlePropertiesInDokkatooExamples * move the integration tests into separate sourceSets * the integration tests keep running out of memory, so fork on every test * try fixing testMavenRepo on Windows * try fixing testMavenRepo on Windows * try fixing testMavenRepo on Windows * try fixing testMavenRepo on Windows * try increases MaxMetaspace Kotlin/dokka#1405 * try fixing updateTestReportCss task output warnings * more memory increasing
I am working on a replacement for the Dokka Gradle Plugin, https://github.com/adamko-dev/dokkatoo, which uses the Gradle Worker API to run Dokka in an isolated process. I had hoped that running Dokka in an isolated daemon would help, especially as Gradle should re-use the daemon, but unfortunately it hasn't helped, and anecdotally OOM errors seem to be triggered more often for even the basic examples andintegration-test projects. Here is an example failure: https://github.com/adamko-dev/dokkatoo/actions/runs/4211535460/jobs/7310041760 Since I have set up Dokka to run in a separate process it should be possible to analyze the process independently of other work. I will see if I can set this up, but if anyone would like to try, please check out the project and run the tests, and hints or tips would be appreciated! |
We've fixed all known Metaspace leaks as of today, and added some tests to detect such problems in the future. Unfortunately, Dokka still requires a considerable amount of memory to document large projects. If you are experiencing Metaspace-related issues when running Dokka:
If you you have suspicions that Dokka is leaking memory or the Metaspace size you've set goes beyound reasonable, please create a separate issue for your case. We would appreciate having a reproducer and as much information as possible to collect. I'm closing this general issue so that we can concentrate on specific cases. |
* Upgrade mvn publish pluging; fix dokka setup for change * Attempt to get dokkaGfm to work properly - OOM/Metaspace problem, see: Kotlin/dokka#1405 * Upgrade to Kotlin 1.5 * Upgrade to kotlin 1.5; fix misk-admin config; use --no-daemon --> still OOM/Metaspace :( * Do Dokka tasks in separate daemons and separate modules; reduce memeory required * Remove non-existent dir call * Only do the publish docs when building master
Question
I added the following in my
build.gradle.kts
However
dokkaJavadocJar
produces the titled error:and the following
But I'm pretty sure is
dokkaJavadocJar
the error root because if I comment it out, it works flawlessIn order to fix this, I added in
gradle.properties
Installation
I wonder if this is "fine" or something nasty is happening in the background I shall be aware of
Ps: the very same problem happens also in other projects
The text was updated successfully, but these errors were encountered: