Skip to content

[WIP based on PR #16032] - Issue #16003: add kafka to no-error testing#16395

Closed
dejan2609 wants to merge 6 commits intocheckstyle:masterfrom
dejan2609:i16003-kafka
Closed

[WIP based on PR #16032] - Issue #16003: add kafka to no-error testing#16395
dejan2609 wants to merge 6 commits intocheckstyle:masterfrom
dejan2609:i16003-kafka

Conversation

@dejan2609
Copy link
Copy Markdown

See this PR for prologue: #16032 (comment)

Related issue: #16003

@romani
Copy link
Copy Markdown
Member

romani commented Feb 22, 2025

@dejan2609 , I appreciate your help.

@dejan2609
Copy link
Copy Markdown
Author

I made some limited progress; will try to compare build environment configurations (i.e. Apache Kafka Github Actions vs. Checkstyle Travis CI).

Herewith an error from Travis CI:

> Task :coordinator-common:classes
Skipping task ':coordinator-common:classes' as it has no actions.
Resolve mutations for :coordinator-common:checkstyleMain (Thread[#86,included builds,5,main]) started.
:coordinator-common:checkstyleMain (Thread[#86,included builds,5,main]) started.

> Task :coordinator-common:checkstyleMain
Caching disabled for task ':coordinator-common:checkstyleMain' because:
  Build cache is disabled
Task ':coordinator-common:checkstyleMain' is not up-to-date because:
  No history is available.
Starting process 'Gradle Worker Daemon 2'. Working directory: /home/circleci/.gradle/workers Command: /usr/local/jdk-21.0.5/bin/java -Dcheckstyle.enableExternalDtdLoad=false --add-opens java.prefs/java.util.prefs=ALL-UNNAMED @/home/circleci/.gradle/.tmp/gradle-worker-classpath6644201704756195266txt -Xms200m -Xmx1g -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 2'
Successfully started process 'Gradle Worker Daemon 2'
Started Gradle worker daemon (1.305 secs) with fork options DaemonForkOptions{executable=/usr/local/jdk-21.0.5/bin/java, minHeapSize=200m, maxHeapSize=1g, jvmArgs=[--add-opens, java.prefs/java.util.prefs=ALL-UNNAMED], keepAliveMode=SESSION}.

This JVM does not support getting OS memory, so no OS memory status updates will be broadcast

> Task :coordinator-common:checkstyleMain
Running checkstyle with toolchain '/usr/local/jdk-21.0.5'.
[ant:checkstyle] Running Checkstyle 10.21.1-SNAPSHOT on 27 files

The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=0f700024-4129-4544-9e94-197aff8c8cd7, currentDir=/home/circleci/project/.ci-temp/kafka}
Attempting to read last messages from the daemon log...
Daemon pid: 430
  log file: /home/circleci/.gradle/daemon/8.13/daemon-430.out.log
----- Last 20 lines from daemon log file - daemon-430.out.log -----
Compiling with toolchain '/usr/local/jdk-21.0.5'.
Compiling with JDK Java compiler API.
Class dependency analysis for incremental compilation took 0.063 secs.
Created classpath snapshot for incremental compilation in 0.074 secs.
work action resolve main (project :coordinator-common) (Thread[#86,included builds,5,main]) started.
Resolve mutations for :coordinator-common:classes (Thread[#86,included builds,5,main]) started.
:coordinator-common:classes (Thread[#86,included builds,5,main]) started.
Skipping task ':coordinator-common:classes' as it has no actions.
Resolve mutations for :coordinator-common:checkstyleMain (Thread[#86,included builds,5,main]) started.
:coordinator-common:checkstyleMain (Thread[#86,included builds,5,main]) started.
Caching disabled for task ':coordinator-common:checkstyleMain' because:
  Build cache is disabled
Task ':coordinator-common:checkstyleMain' is not up-to-date because:
  No history is available.
Starting process 'Gradle Worker Daemon 2'. Working directory: /home/circleci/.gradle/workers Command: /usr/local/jdk-21.0.5/bin/java -Dcheckstyle.enableExternalDtdLoad=false --add-opens java.prefs/java.util.prefs=ALL-UNNAMED @/home/circleci/.gradle/.tmp/gradle-worker-classpath6644201704756195266txt -Xms200m -Xmx1g -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 2'
Successfully started process 'Gradle Worker Daemon 2'
Started Gradle worker daemon (1.305 secs) with fork options DaemonForkOptions{executable=/usr/local/jdk-21.0.5/bin/java, minHeapSize=200m, maxHeapSize=1g, jvmArgs=[--add-opens, java.prefs/java.util.prefs=ALL-UNNAMED], keepAliveMode=SESSION}.
This JVM does not support getting OS memory, so no OS memory status updates will be broadcast
Running checkstyle with toolchain '/usr/local/jdk-21.0.5'.
[ant:checkstyle] Running Checkstyle 10.21.1-SNAPSHOT on 27 files----- End of the daemon log -----


FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

* Try:
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.launcher.daemon.client.DaemonDisappearedException: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
	at org.gradle.launcher.daemon.client.DaemonClient.handleDaemonDisappearance(DaemonClient.java:283)
	at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:256)

error_stacktrace.txt

@dejan2609
Copy link
Copy Markdown
Author

@romani just for the recored: is Travis CI usage mandatory for Checkstyle team?
Or build can be spawned on Github Actions also ?

@romani
Copy link
Copy Markdown
Member

romani commented Mar 22, 2025

we can use any CI , github action is ok.
CircleCI is very quick CI too.
@dejan2609

@dejan2609
Copy link
Copy Markdown
Author

dejan2609 commented Mar 24, 2025

Ok then, let's wait with moving to GA or Circle CI (I think I can solve this on Travis CI).
Will send some more updates soon.

@dejan2609
Copy link
Copy Markdown
Author

Some updates: it seems that CircleCI somehow fails to honor Kafka Gradle settings/options/memory limits (and hence Gradle build on CircleCI fails due to lack of resources).

I'm experimenting with replicating Kafka Gradle settings onto Circle CI (here is the resource: https://circleci.com/docs/java-oom/#using-java-environment-variables-to-set-memory-limits).

@dejan2609
Copy link
Copy Markdown
Author

@romani I'm back, hopefully will be able to solve this in the foreseeable future 🛠️ 🙂

@romani
Copy link
Copy Markdown
Member

romani commented Oct 10, 2025

I will have a bit more time in winter too, so we can collaborate.
If you be a bit verbose in comments, I might suggest something on the go.

We can make github action for this task, if circleci is so capricious.
Keep in mind we are on jdk17 , and all CI are moved to jdk21 as preparation to moving checkstyle min jdk to version 21 in January 2026

@dejan2609
Copy link
Copy Markdown
Author

We have a deal @romani ! Github Actions it is then 🤝

Incoming shameless plug 😎: I spent some time camping in Kafka's corner and scored a few wins there (Gradle 9 upgrade and Java 25 build).
So, Kafka builds on GA and against Java 17/25 matrix and hence I don't expect this issue to be that hard (but one never knows).
Let's nail this during the winter 🔨 ❄️ ☃️ 🙂

@stoyanK7
Copy link
Copy Markdown
Collaborator

stoyanK7 commented Dec 2, 2025

Some updates: it seems that CircleCI somehow fails to honor Kafka Gradle settings/options/memory limits (and hence Gradle build on CircleCI fails due to lack of resources).

@dejan2609 Do you remember if the message mentioned what the memory tipping point was?

@dejan2609
Copy link
Copy Markdown
Author

@stoyanK7 Здравей, Стоян, поздрави от Белград !

Things have changed on Kafka side quite a bit: both Gradle and Java versions are upgraded and you also have to factor in that my attempt was made on CircleCI (and CheckStyle team now opts exclusively for Github Actions) so those errors are kind of obsolete.

Also: given a fact that Kafka CI build is also using Github Actions we can be 💯 percent sure that build should (must) work fine in CheckStyle setup.

From where I see this one should execute following (or similar) Gradle command via CheckStyle GA worklow:

  ./gradlew --stacktrace --info --console=plain --no-daemon checkstyleMain checkstyleTest -x test \
    -PcheckstyleVersion="${CS_POM_VERSION}" \
    -I localRepo.gradle

Related notable comments:

⚠️ potential pitfall: Gradle daemon issues. I don't expect them now, but we will sort that out somehow (if they occur, God forbid).

@dejan2609
Copy link
Copy Markdown
Author

One more thing to add: I will put this stalled PR to rest 🙂

@stoyanK7 feel free to add me to your future PR (I can provide some non-binding review).

@dejan2609 dejan2609 closed this Dec 3, 2025
@stoyanK7
Copy link
Copy Markdown
Collaborator

stoyanK7 commented Dec 8, 2025

@dejan2609 Поздрави от София, Деян!

Thanks for the detailed response.

Things have changed on Kafka side quite a bit: both Gradle and Java versions are upgraded and you also have to factor in that my attempt was made on CircleCI (and CheckStyle team now opts exclusively for Github Actions) so those errors are kind of obsolete.

I'll first do my best to make it work on CircleCI. If I see it's a hassle, I'll opt for GitHub Actions. I'm curious to find out what's wrong with the memory usage 🤔

feel free to add me to your future PR (I can provide some non-binding review).

Of course! I'll open a PR in the following days and tag you 🚀

@dejan2609
Copy link
Copy Markdown
Author

dejan2609 commented Dec 8, 2025

@stoyanK7 for all I know (please read this: for all I can remember): we (both @romani and me) had issues with CircleCI Gradle build that would just stop (best bet: due to lack of memory): #16032 (comment)

Question is: do you want to utilize Gradle daemon build in a first place ?

Now, given a fact that Kafka is building against two Java versions (17 and 25, at the moment) answer is probably yes.
On the other hand: if CheckStyle team wants to perform checks with Kafka trunk (and latest CheckStyle snapshot) only against one Java version (and hence only single Gradle execution is required) maybe you could completely drop Gradle daemon usage in your Circle CI setup ?

Here me out: if you want to try your luck with Circle CI my suggestion would be to:

  • disable Gradle daemon
  • setup CircleCI job properly
  • and only then re-enable Gradle daemon (if you opt for a daemon at all, that is).

⚠️ Pitfall: Circle CI has this matrix, you may have to wrap your had around here few times 🙂 find it useful: https://circleci.com/docs/guides/optimize/java-oom/#using-java-environment-variables-to-set-memory-limits

That would be my 2 cents on this 🪙 🪙

Off topic: Levski or CSKA ? ⚽ 😃

@romani
Copy link
Copy Markdown
Member

romani commented Dec 9, 2025

Now, given a fact that Kafka is building against two Java versions (17 and 25, at the moment) answer is probably yes.

On January I will merge jdk21 migration. So better to target jdk25 execution for Kafka.

Off topic: не знал что ЦСКА существует в других странах. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants