Alerts/subscriptions fail since 3.26.2 (base 6.0.0): "Error registering fonts" / "Could not initialize class sun.awt.X11FontManager". Fix: add libharfbuzz0b
-
Since 3.26.2, Metabase stopped rendering chart and table images, so alerts and dashboard subscriptions fail for both Slack and email. Depending on where you look, it shows up as one of these:
Error registering fonts: Metabase will not be able to send Pulses. This is a known issue with certain JVMs.or
Could not initialize class sun.awt.X11FontManagerThese are both the same failure. The first is what Metabase logs the first time Java's font system fails in a running process; the second is what Java reports on later attempts. It's also been reported for email pulses in 16050.
Timeline: Our Slack alerts worked correctly on 3.26.1 and failed every day after the auto-update to 3.26.2. (I've reproduced it on 3.27.1 on a staging server.)
Root cause: The package moved to cloudron/base:6.0.0 in 3.26.2 (commit 7f36d6a5). Running a font call directly against the 3.27.1 image (in a throwaway container, outside Cloudron) shows the underlying error, which Metabase's log message hides:
Please install the openjdk-*-jre package or recommended packages for openjdk-*-jre-headless. UnsatisfiedLinkError: /usr/lib/jvm/java-21-openjdk-amd64/lib/libfontmanager.so: libharfbuzz.so.0: cannot open shared object file: No such file or directoryOn Ubuntu,
libharfbuzz0bis only a recommended package foropenjdk-21-jre-headless, and it isn't in the new image. Presumably the old base image supplied it.Verified fix: installing
libharfbuzz0bin the same throwaway container makes Java's font system initialize normally (it finds 8 font families, where before it threw the error above). Installingfontconfigalone didn't help, and neither would/tmppermission orfc-cachechanges, since it's a missing library rather than a font cache issue. Suggested Dockerfile change:apt-get install -y openjdk-21-jre-headless libharfbuzz0bThe test I used:
IMG=$(sudo docker ps --format '{{.Image}}' | grep -i metabase | head -1) sudo docker run --rm --entrypoint bash "$IMG" -c ' cd /app/code T="(println :font-families (count (.getAvailableFontFamilyNames (java.awt.GraphicsEnvironment/getLocalGraphicsEnvironment))))" java -Djava.awt.headless=true -cp metabase.jar clojure.main -e "$T" 2>&1 | tail -n 8 apt-get update -qq && apt-get install -y -qq libharfbuzz0b >/dev/null 2>&1 java -Djava.awt.headless=true -cp metabase.jar clojure.main -e "$T" 2>&1 | tail -n 8'@girish It may also be worth checking other Java-based apps on base 6.0.0 that use the headless JRE for image or PDF rendering, since they could hit the same thing.
Thank you!
-
-
N nebulon marked this topic as a question
-
N nebulon has marked this topic as solved
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login