JDK-6585673 : AWT_TOOLKIT=MToolkit broken with jdk 1.5.0_12
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux
  • CPU: x86
  • Submitted: 2007-07-26
  • Updated: 2020-02-07
  • Resolved: 2020-02-07
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_12-b04, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
uname -a
Linux energy 2.6.21.3cfsv16libatareiser4 #3 SMP Sun Jun 10 16:02:24 CEST 2007 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ AuthenticAMD GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
emerge --info
Portage 2.1.2.9 (default-linux/amd64/2007.0, gcc-4.1.2, glibc-2.5-r3, 2.6.21.3cfsv16libatareiser4 x86_64)
=================================================================
System uname: 2.6.21.3cfsv16libatareiser4 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4600+
Gentoo Base System release 1.12.10
Timestamp of tree: Wed, 13 Jun 2007 17:30:01 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.3.6-r2, 2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17.50.0.16
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -msse3 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=k8 -O2 -msse3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig candy ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
LC_ALL="de_DE@euro"
LINGUAS="de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/gentoo-de"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 7zip S3TC X Xaw3d a52 aac acpi addbookmarks aiglx aim aio akode alias alsa altenburgcards amarok amd64 aotuv aqua_theme asf athena audiofile autoreplace bash-completion berkdb binary-drivers bitmap-fonts bluetooth boost bzip2 cairo cdda cddb cdinstall cdparanoia cdr cdrom cdsound cegui cg clamav cli connectionstatus contactnotes cracklib crypt css cups curl dbus depth32 dhcp dio divx dnd double-precision dpms dri dts dv dvd dvdr dvdread emerald emul-linux-x86 encode exif expat exscalibar extra-cardsets fame fasttrack ffmpeg fftw filter_default filter_legacy filter_light flac foomaticdb fortran ftp gadu gdbm gif gimp gimpprint glitz glut glx gnokii gnutella gpgme gpm gtk gtk2 hddtemp highlight history iconv icq id3 imagemagick imlib inotify irc irmc isdnlog jabber java javascript jce jingle joystick jpeg jpeg2k kcal kde kdecards kdeenablefinal kdehiddenvisibility kdepim kdm kexi kipi kqemu lame lcms lesstif libg++ libwww lm_sensors logitech-mouse lzo lzw mad magic maps matroska midi mime mjpeg mmap mmx mmxext mng mp3 mp4 mpeg mpeg2 mplayer msn mudflap mule musepack ncurses neXt net newspr ngui nls no-old-linux nocd nosendmail nowin nowlistening nptl nptlonly nsplugin nvidia offensive ogg openexr opengl openmp oscar pam paste64 pch pcre pdf perl physfs player plugins png pnm posix ppds pppd python qt3 qt4 quicktime rar readline recode reflection reiser4 reiserfs remix resolvconf rogue rtc sametime scanner schedule scsi sdl sdl-sound sdlaudio sendfile server session sharedmem slp smp sms sndfile sockets sounds spell spl sqlite sqlite3 srt sse sse-filters sse2 sse3 ssl startup-notification statistics stats stencil-buffer stroke subp subtitles svg sysfs sysvipc szip tcpd texteffect textures tga theora threads tiff timidity tk toolbar tools transcode translator truetype truetype-fonts type1 type1-fonts unicode unzip usb userlocales utempter v4l v4l2 vcd videos visualization vorbis webdav webpresence wmf wmp wxwindows x264 xanim xcomposite xemacs xext xface xine xml xorg xosd xpm xrandr xscreensaver xskatcards xv xvid xvmc yiff yv12 zlib zvbi" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" USERLAND="GNU" VIDEO_CARDS="nvidia vesa vga v4l nv"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


A DESCRIPTION OF THE PROBLEM :
when AWT_TOOLKIT=MToolkit is set, java apps fail with this error:
for example triplea:
 triplea

Runtime link error - it appears that libXt got loaded before libXm,
which is not allowed.
Exception in thread "main" java.lang.InternalError: libXt loaded before libXm
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
        at java.lang.Runtime.loadLibrary0(Runtime.java:822)
        at java.lang.System.loadLibrary(System.java:993)
        at sun.font.FontManager$1.run(FontManager.java:178)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.font.FontManager.<clinit>(FontManager.java:173)
        at
sun.java2d.SunGraphicsEnvironment.addDirFonts(SunGraphicsEnvironment.java:722)
        at
sun.java2d.SunGraphicsEnvironment.registerFontsInDir(SunGraphicsEnvironment.java:602)
        at
sun.java2d.SunGraphicsEnvironment.access$200(SunGraphicsEnvironment.java:58)
        at
sun.java2d.SunGraphicsEnvironment$1.run(SunGraphicsEnvironment.java:174)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.java2d.SunGraphicsEnvironment.<init>(SunGraphicsEnvironment.java:94)
        at
sun.awt.X11GraphicsEnvironment.<init>(X11GraphicsEnvironment.java:164)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
        at java.awt.Window.init(Window.java:271)
        at java.awt.Window.<init>(Window.java:319)
        at java.awt.Frame.<init>(Frame.java:419)
        at javax.swing.JFrame.<init>(JFrame.java:194)
        at games.strategy.debug.Console.<init>(Console.java:71)
        at games.strategy.debug.Console.getConsole(Console.java:53)
        at
games.strategy.engine.framework.GameRunner2.main(GameRunner2.java:35)
        at games.strategy.engine.framework.GameRunner.main(GameRunner.java:115)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
install latest 5.0 release of java. The 1.5.0_11 release works fine

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the apps should work normally - and they do without AWT_TOOLKIT=MToolkit
ACTUAL -
with AWT_TOOLKIT=MToolkit set, apps throw the error above and quit.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
there is no hs_err_pid-file generated.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
I can't. I am just a user. Triplea is available from triplea.sourceforge.net
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
unset AWT_TOOLKIT=MToolkit works around that bug

Comments
MToolkit was removed in jdk7.
07-02-2020

EVALUATION As far as I understand, with jdk 6.0 and 7 we have a plain crash on amd64 platform with MToolkit. That is covered with 6511454 and we'll look into this. It should be fixed in 6.0 but not in jdk7 since MToolkit will be decommissioned there. Version 1.5 fails altogether differently. I reassign this bug to CTE but will try to reproduce it after fixing 6511454.
27-07-2007

EVALUATION Similar defect while embedding the Java app: http://my.opera.com/community/forums/topic.dml?id=187461
26-07-2007

EVALUATION The defect also reproducible in customer's env. with simple test like following: import java.awt.*; public class Test { public static void main(String [] args) { System.out.println(Toolkit.getDefaultToolkit()); } } We don't have the environment to handle this issue. Strace, started on customer's machine (attached) shows the correct order of loading libraries. Note, that on 32bit platform we don't enter into if (v != NULL && dladdr(v, &dlinfo)) statement (taken from awt_LoadLibrary.c): if (!XAWT) { > /* Has a Motif library been loaded already, e.g. by an > application > * embedding java? Netscape plugin? > */ > > v = dlsym(RTLD_DEFAULT, "vendorShellWidgetClass"); > if (v != NULL && dladdr(v, &dlinfo)) { > /* > * If we are picking up the vendorShellWigetClass from > libXt > * instead of libXm (it exists in both), then we are > very stuck. > * Abort. > */ > if (strstr(dlinfo.dli_fname, "libXt.so") != NULL) { > xt_before_xm = 1; > }
26-07-2007