Bug#1089580: visualvm: JVM crashes with StackOverflowError at startup

Julien Plissonneau Duquène sre4ever at free.fr
Mon Feb 10 16:27:31 GMT 2025


Control: tags -1 - moreinfo

Hi,

While trying to craft a Vagrantfile to reproduce this it appeared that I 
misdiagnosed the issue in multiple ways. The packaged visualvm actually 
runs fine with the default JDK when the JDK 11 is not installed.

The issue can be reproduced by installing a JDK 11 on a Trixie system. 
I'm attaching a Vagrantfile [1] for testing.

The `visualvm` startup script ignores JAVA_HOME and uses the JDK 11 if 
it's installed on the system rather than the default JDK and I didn't 
notice this before filing this bug report.

It is possible to work around this issue either by using the --jdkhome 
CLI argument, or by adding a configuration file, e.g.:
echo visualvm_jdkhome=/usr/lib/jvm/default-java > 
~/.visualvm/2.1.10/etc/visualvm.conf

Le 2025-02-04 14:26, Tobias Wich a écrit :
> 
> The start script /usr/bin/visualvm has code which always selects Java 
> 11, when installed. When changing line 80 as follows, it starts 
> properly with Java 21.
> 
> - for j in /usr/lib/jvm/java-11-openjdk-$ARCH 
> /usr/lib/jvm/default-java; do
> + for j in /usr/lib/jvm/default-java; do

I don't think the hardcoded path for the JDK 11 in the launcher script 
is still necessary. The modification suggested above should be enough to 
close this bug.

For the record:
- removing -Djava.security.manager=allow from the java invocation makes 
it possible to run visualvm with the JDK 11. On my system it is usable, 
but on the VM with a 16bpp depth the graphical rendering is unusable 
(windows only show a uniform plain color), reconfiguring the X server 
for a 24bpp depth makes visualvm/JDK11 usable again
- setting the property above is required to run visualvm with the 
default JDK 21 (with deprecation warnings though); runs fine with 16bpp 
and 24bpp depths
- there is probably an underlying bug either in the JDK 11 or in 
visualvm that causes the JVM to crash when the (required for JDK21) 
property is defined.

Thanks,


[1]: https://salsa.debian.org/-/snippets/773

-- 
Julien Plissonneau Duquène
-------------- next part --------------
# Usage: vagrant up --provider=libvirt

Vagrant.configure("2") do |config|
  config.vm.box = "debian/testing64"
  config.vm.box_version = "0"
  #config.vm.box_version = "20250126.1"
  # Note: https://vagrantcloud.com/debian/boxes/testing64/versions/20250126.1/providers/libvirt/amd64/vagrant.box
  #       fails with 429 Too Many Requests
  #       -> download with a browser from:
  #       https://portal.cloud.hashicorp.com/vagrant/discover/debian/testing64/versions/20250126.1
  #       and run:
  #       vagrant box add --provider libvirt --name "debian/testing64" --checksum 073c794a90187cff320096c3ff0310d4e69f5469e93bbc354dd59584a0c8294b trixie_607a06e9-dc01-11ef-8648-52d4cdf5194b.box
  config.vm.box_download_checksum = "073c794a90187cff320096c3ff0310d4e69f5469e93bbc354dd59584a0c8294b"
  config.vm.box_download_checksum_type = "sha256"

  config.vm.box_check_update = false

  bugref = "1089580"

  config.vm.define "testing" do |it|
    it.vm.hostname = "testing"
  end

  config.vm.provider "libvirt" do |libvirt|
    # unfortunately won't work OOTB:
    #libvirt.qemu_use_session = true

    libvirt.default_prefix = "bug-#{bugref}-"
  end

  config.vm.provision "shell", inline: <<-'SHELL'
apt-get purge -y unattended-upgrades
apt-get -y -U install --no-install-recommends apt-eatmydata zstd kbd
apt-get -y upgrade
cat > /var/tmp/runonce.sh <<EOD
openvt -s -- journalctl --unit=tmp-runonce.service --follow
cat > /etc/apt/sources.list.d/trixie.sources <<EOD2
Types: deb deb-src
URIs: https://deb.debian.org/debian
Suites: trixie
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOD2
rm /etc/apt/sources.list
cat > /etc/apt/apt.conf.d/20tum.conf <<EOD2
APT::Default-Release "trixie";
EOD2
cat > /etc/apt/sources.list.d/unstable.sources <<EOD2
Types: deb deb-src
URIs: https://deb.debian.org/debian
Suites: unstable
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOD2
apt-get -U purge -y '~o'
apt-get install -y --no-install-recommends openbox-lxde-session \\
    lxterminal notification-daemon polkitd xdg-utils \\
    lightdm-autologin-greeter xserver-xorg-video-fbdev \\
    xserver-xorg-input-libinput openjdk-11-jdk visualvm
systemctl stop lightdm
sed -i -e 's/\\(autologin-user=\\).*/\\1vagrant/' \\
    /etc/lightdm/lightdm.conf.d/lightdm-autologin-greeter.conf
systemctl start lightdm
systemctl disable tmp-runonce.service
rm /etc/systemd/system/tmp-runonce.service # /var/tmp/runonce.sh
echo Waiting for X to start...
while [ ! -f /run/lightdm/root/:0 ] ; do sleep 1 ; done
echo Waiting for openbox to start...
while ! pidof openbox ; do sleep 1 ; done
echo Starting visualvm...
sudo -i -u vagrant -n DISPLAY=:0 lxterminal --geometry=124x32 \\
    -t 'visualvm output' \\
    -e '( visualvm && echo visualvm exited normally. || echo visualVM FAILED with exit code \$? >&2 ) 2>&1 | tee visualvm.log ; less -M visualvm.log ; /bin/bash'
EOD
echo Done.
cat > /etc/systemd/system/tmp-runonce.service <<EOD
[Unit]
Description=Run once temporary script after reboot.

[Service]
Type=oneshot
ExecStart=/bin/sh /var/tmp/runonce.sh

[Install]
WantedBy=multi-user.target
EOD
systemctl enable tmp-runonce.service
reboot
SHELL

  config.vm.post_up_message = <<EOT
================================================================

      The VM will now restart and complete configuration.

  Please use a GUI client to connect to the VM and wait for it
  to start visualvm, e.g.:

  virt-viewer -c qemu:///system -- bug-#{bugref}-testing

================================================================
EOT

end


More information about the pkg-java-maintainers mailing list