Wrong Java version on Debian: a race condition

Reading time: about 1 min


  • Behind The Scenes

Lucid Software validates every pull request for its internal code base. Running over 1000 builds a day across 80 projects strains the robustness of our code, tests, and tools.

For example, several times a week, builds complained about the default Java version. It didn't make much sense. Our servers are configured by Chef, which runs at boot and every 30 minutes thereafter. During each run, update-java-alternatives sets Java 8 as the default. But somehow, the build servers were occasionally using an older version.

Each time update-java-alternatives ran, it reset Java to the "automatic default", which for Ubuntu 14.04 is Java 7. It then set Java back to the requested version. Any build that started a JVM in the intervening few milliseconds failed.

Try it yourself. Poll the symlink:
$ while :; do readlink /etc/alternatives/java; sleep 0.01; done
And then run update-java-alternativtes:
$ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
Watch the left terminal closely, and you can see the Java version regress.

A patch is available on the Debian bug tracker for the java-common package.


About Lucid

Lucid Software is a pioneer and leader in visual collaboration dedicated to helping teams build the future. With its products—Lucidchart, Lucidspark, and Lucidscale—teams are supported from ideation to execution and are empowered to align around a shared vision, clarify complexity, and collaborate visually, no matter where they are. Lucid is proud to serve top businesses around the world, including customers such as Google, GE, and NBC Universal, and 99% of the Fortune 500. Lucid partners with industry leaders, including Google, Atlassian, and Microsoft. Since its founding, Lucid has received numerous awards for its products, business, and workplace culture. For more information, visit lucid.co.

Get Started

  • Contact Sales


  • Lucidspark
  • Lucidchart
  • Lucidscale
PrivacyLegalCookie settingsCookie policy
  • linkedin
  • twitter
  • instagram
  • facebook
  • youtube
  • glassdoor
  • tiktok

© 2024 Lucid Software Inc.