DConf worker is crashing on Ubuntu 18.04.4 LTS
Hi, Gnome Maintainers!
Recently, we noticed that our java process crashes sometimes with the following message:
*** buffer overflow detected ***: java terminated
After running the code on a fastdebug build of OpenJDK, we've noticed that the crash is happening within the "dbus worker" thread, the strace run printed:
[pid 29067] clone(child_stack=0x7f335a755fb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f335a7569d0, tls=0x7f335a756700, child_tidptr=0x7f335a7569d0) = 29345
strace: Process 29345 attached
[pid 29345] set_robust_list(0x7f335a7569e0, 24) = 0
[pid 29345] prctl(PR_SET_NAME, "dconf worker") = 0
The thread was launched from a java thread (in native) which was initializing one of the sun.aws.X11
classes, in particular receiving the display.
We've observed the following stacktrace on the dconf thread:
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007fc2d9d73801 in __GI_abort () at abort.c:79
#2 0x00007fc2d9dbc897 in __libc_message (action=action@entry=(do_abort | do_backtrace), fmt=fmt@entry=0x7fc2d9ee9988 "*** %s ***: %s terminated\n") at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007fc2d9e67cff in __GI___fortify_fail_abort (need_backtrace=need_backtrace@entry=true, msg=msg@entry=0x7fc2d9ee9905 "buffer overflow detected") at fortify_fail.c:33
#4 0x00007fc2d9e67d21 in __GI___fortify_fail (msg=msg@entry=0x7fc2d9ee9905 "buffer overflow detected") at fortify_fail.c:44
#5 0x00007fc2d9e65a10 in __GI___chk_fail () at chk_fail.c:28
#6 0x00007fc2d9e67c0a in __fdelt_chk (d=<optimized out>) at fdelt_chk.c:25
#7 0x00007fc23199d47c in g_spawn_sync (working_directory=working_directory@entry=0x0, argv=<optimized out>, envp=envp@entry=0x0, flags=flags@entry=G_SPAWN_SEARCH_PATH,
child_setup=child_setup@entry=0x0, user_data=user_data@entry=0x0, standard_output=0x7fc2309b0bb8, standard_error=0x7fc2309b0bc0, exit_status=0x7fc2309b0bb4, error=0x7fc2309b0c28)
at ../../../../glib/gspawn.c:380
#8 0x00007fc23199db26 in g_spawn_command_line_sync (command_line=command_line@entry=0x7fc2a41526c0 "dbus-launch --autolaunch=ec2014e44df13abf9a1801e9abdfbfc3 --binary-syntax --close-stderr",
standard_output=standard_output@entry=0x7fc2309b0bb8, standard_error=standard_error@entry=0x7fc2309b0bc0, exit_status=exit_status@entry=0x7fc2309b0bb4, error=error@entry=0x7fc2309b0c28)
at ../../../../glib/gspawn.c:780
#9 0x00007fc23212980d in get_session_address_dbus_launch (error=error@entry=0x7fc2309b0c28) at ../../../../gio/gdbusaddress.c:1131
#10 0x00007fc23212b30a in get_session_address_platform_specific (error=0x7fc2309b0c28) at ../../../../gio/gdbusaddress.c:1559
#11 g_dbus_address_get_for_bus_sync (bus_type=bus_type@entry=G_BUS_TYPE_SESSION, cancellable=cancellable@entry=0x0, error=error@entry=0x7fc2309b0d70) at ../../../../gio/gdbusaddress.c:1639
#12 0x00007fc2321367ee in get_uninitialized_connection (bus_type=bus_type@entry=G_BUS_TYPE_SESSION, cancellable=cancellable@entry=0x0, error=error@entry=0x7fc2309b0d70)
at ../../../../gio/gdbusconnection.c:7196
#13 0x00007fc23213c04d in g_bus_get_sync (bus_type=bus_type@entry=G_BUS_TYPE_SESSION, cancellable=cancellable@entry=0x0, error=error@entry=0x7fc2309b0d70)
at ../../../../gio/gdbusconnection.c:7291
#14 0x00007fc2309b9158 in dconf_gdbus_get_bus_in_worker (bus_type=G_BUS_TYPE_SESSION, error=error@entry=0x7fc2309b0db0) at dconf-gdbus-thread.c:185
#15 0x00007fc2309b923a in dconf_gdbus_method_call (user_data=0x7fc2a4159d40) at dconf-gdbus-thread.c:243
#16 0x00007fc231955285 in g_main_dispatch (context=0x7fc2a415de00) at ../../../../glib/gmain.c:3176
#17 g_main_context_dispatch (context=context@entry=0x7fc2a415de00) at ../../../../glib/gmain.c:3829
#18 0x00007fc231955650 in g_main_context_iterate (context=context@entry=0x7fc2a415de00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../../glib/gmain.c:3902
#19 0x00007fc2319556dc in g_main_context_iteration (context=context@entry=0x7fc2a415de00, may_block=may_block@entry=1) at ../../../../glib/gmain.c:3963
#20 0x00007fc2309b936d in dconf_gdbus_worker_thread (user_data=0x7fc2a415de00) at dconf-gdbus-thread.c:82
#21 0x00007fc23197d175 in g_thread_proxy (data=0x7fc2a40d98a0) at ../../../../glib/gthread.c:784
#22 0x00007fc2d96fa6db in start_thread (arg=0x7fc2309b1700) at pthread_create.c:463
#23 0x00007fc2d9e5488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
The "dconf worker" thread seems to be created as a result of initialization of Java AWT classes
Thread 63 "pool-2-thread-3" hit Catchpoint 3 (returned from syscall clone), clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:78
78 in ../sysdeps/unix/sysv/linux/x86_64/clone.S
(gdb) bt
#0 clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:78
#1 0x00007ffff719cec5 in create_thread (thread_ran=<synthetic pointer>, stackaddr=0x7fff507f5fc0, stopped_start=<synthetic pointer>, attr=0x7fff5f3ec250, pd=0x7fff507f6700) at ../sysdeps/unix/sysv/linux/createthread.c:100
#2 __pthread_create_2_1 (newthread=newthread@entry=0x7fffcc2e28d0, attr=attr@entry=0x7fff5f3ec250, start_routine=start_routine@entry=0x7fff517c2120 <g_thread_proxy>, arg=arg@entry=0x7fffcc2e28a0) at pthread_create.c:797
#3 0x00007fff517e0410 in g_system_thread_new (thread_func=thread_func@entry=0x7fff517c2120 <g_thread_proxy>, stack_size=stack_size@entry=0, error=error@entry=0x7fff5f3ec300) at ../../../../glib/gthread-posix.c:1177
#4 0x00007fff517c247f in g_thread_new_internal (name=0x7fff50800098 "dconf worker", proxy=0x7fff517c2120 <g_thread_proxy>, func=0x7fff507fe350 <dconf_gdbus_worker_thread>, data=0x7fffcc30ea90, stack_size=0, error=0x7fff5f3ec300)
at ../../../../glib/gthread.c:874
#5 0x00007fff517c2528 in g_thread_new (name=name@entry=0x7fff50800098 "dconf worker", func=func@entry=0x7fff507fe350 <dconf_gdbus_worker_thread>, data=data@entry=0x7fffcc30ea90) at ../../../../glib/gthread.c:827
#6 0x00007fff507fe337 in dconf_gdbus_get_worker_context () at dconf-gdbus-thread.c:98
#7 0x00007fff507fe3fb in dconf_engine_dbus_call_async_func (bus_type=G_BUS_TYPE_SESSION, bus_name=bus_name@entry=0x7fff507ffd58 "org.freedesktop.DBus", object_path=object_path@entry=0x7fff507ffd6d "/org/freedesktop/DBus",
interface_name=interface_name@entry=0x7fff507ffd58 "org.freedesktop.DBus", method_name=method_name@entry=0x7fff507ffdcc "AddMatch", parameters=0x7fffcc2e1b60, handle=0x7fffcc30d820, error=0x0) at dconf-gdbus-thread.c:284
#8 0x00007fff507fc2fa in dconf_engine_watch_fast (engine=0x7fffcc2e6a10, path=0x7fffcc263170 "/org/gnome/desktop/interface/") at dconf-engine.c:868
#9 0x00007fff51c7e900 in g_object_new_internal (class=class@entry=0x7fffcc2e3b20, params=params@entry=0x7fff5f3ec5b0, n_params=n_params@entry=3) at ../../../../gobject/gobject.c:1839
#10 0x00007fff51c805c0 in g_object_new_valist (object_type=<optimized out>, first_property_name=first_property_name@entry=0x7fff52009c84 "settings-schema", var_args=var_args@entry=0x7fff5f3ec700) at ../../../../gobject/gobject.c:2122
#11 0x00007fff51c80939 in g_object_new (object_type=<optimized out>, first_property_name=first_property_name@entry=0x7fff52009c84 "settings-schema") at ../../../../gobject/gobject.c:1642
#12 0x00007fff51fcf445 in g_settings_new_full (schema=0x7fffcc2e2800, backend=0x0, path=0x0) at ../../../../gio/gsettings.c:1127
#13 0x00007fff548a9055 in get_schema_value (name=0x7fff548b34c8 "org.gnome.desktop.interface", key=0x7fff548b34b4 "text-scaling-factor") at /home/ubuntu/sergeyjdk/jdk13/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c:127
#14 0x00007fff548a95a4 in getDesktopScale (output_name=0x7fffcc012670 "screen") at /home/ubuntu/sergeyjdk/jdk13/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c:179
#15 getNativeScaleFactor (output_name=0x7fffcc012670 "screen") at /home/ubuntu/sergeyjdk/jdk13/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c:216
#16 0x00007fff54892937 in Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor (env=0x7ffff2cd4b78, this=<optimized out>, screen=<optimized out>) at /home/ubuntu/sergeyjdk/jdk13/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c:2148
#17 0x00007fffe09e08eb in ?? ()
#18 0x00007fff525c9888 in ?? ()
#19 0x00007fffe09dfe7d in ?? ()
#20 0x00007fff5f3ec8f0 in ?? ()
#21 0x00007fff525c6bb8 in ?? ()
#22 0x00007fff5f3ec958 in ?? ()
#23 0x00007fff525c8738 in ?? ()
#24 0x0000000000000000 in ?? ()
Since the issue is related to AWT initialization in Java, the current workaround for us is to use -Djava.awt.headless=true
.
OS:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
Edited by Sergey Tselovalnikov