Opening new window and modifying with xdotool causes crash
Description
- When I login to Gnome, a gnome-terminal session is autostarted.
- I've written a simple shell script named
c
to replace this initial terminal with a larger one, containing two tabs, located in the top-right corner of the screen.
- The new terminal typically flashes on the screen briefly but then gnome-terminal-server immediately crashes with a coredump.
- If I try to trace the script by running
sh -x c >foo 2>&1
then everything works fine.
Script File
$ cat c
#! /bin/sh
# c - Replace current terminal with a "standard" one.
self=$(xdotool getactivewindow)
gnome-terminal -q --geometry=120x100-0+0 --window --tab
while [[ $self = $(xdotool getactivewindow) ]]; do sleep 0.1; done
xdotool windowclose $self >/dev/null 2>&1
Journalctl Output
gnome-terminal-[1475]: The program 'gnome-terminal-server' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 2714 error_code 3 request_code 18 (core protocol) minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
systemd-coredump[1559]: Process 1475 (gnome-terminal-) of user 1000 dumped core.s
Stack trace of thread 1475:
#0 0x00007fbd83f16f46 n/a (libglib-2.0.so.0 + 0x62f46)
#1 0x00007fbd83f18704 g_log_writer_default (libglib-2.0.so.0 + 0x64704)
#2 0x00007fbd83f17039 g_log_structured_array (libglib-2.0.so.0 + 0x63039)
#3 0x00007fbd83f172ff g_log_structured_standard (libglib-2.0.so.0 + 0x632ff)
#4 0x00007fbd842b533f n/a (libgdk-3.so.0 + 0x3e33f)
#5 0x00007fbd82e825db _XError (libX11.so.6 + 0x435db)
#6 0x00007fbd82e7f388 n/a (libX11.so.6 + 0x40388)
#7 0x00007fbd82e7f425 n/a (libX11.so.6 + 0x40425)
#8 0x00007fbd82e7fd8a _XEventsQueued (libX11.so.6 + 0x40d8a)
#9 0x00007fbd82e71782 XPending (libX11.so.6 + 0x32782)
#10 0x00007fbd842b8d9e n/a (libgdk-3.so.0 + 0x41d9e)
#11 0x00007fbd8430e53b gdk_display_get_event (libgdk-3.so.0 + 0x9753b)
#12 0x00007fbd842b8c24 n/a (libgdk-3.so.0 + 0x41c24)
#13 0x00007fbd83f1f9be g_main_context_dispatch (libglib-2.0.so.0 + 0x6b9be)
#14 0x00007fbd83f21831 n/a (libglib-2.0.so.0 + 0x6d831)
#15 0x00007fbd83f21871 g_main_context_iteration (libglib-2.0.so.0 + 0x6d871)
#16 0x00007fbd840d82de g_application_run (libgio-2.0.so.0 + 0x9d2de)
#17 0x00005636a888b1f5 n/a (gnome-terminal-server + 0x141f5)
#18 0x00007fbd83cea023 __libc_start_main (libc.so.6 + 0x27023)
#19 0x00005636a888b35e n/a (gnome-terminal-server + 0x1435e)
Stack trace of thread 1499:
#0 0x00007fbd83dbcf8d syscall (libc.so.6 + 0xf9f8d)
#1 0x00007fbd83ed113b g_cond_wait_until (libglib-2.0.so.0 + 0x1d13b)
#2 0x00007fbd83f507e3 n/a (libglib-2.0.so.0 + 0x9c7e3)
#3 0x00007fbd83ef663b n/a (libglib-2.0.so.0 + 0x4263b)
#4 0x00007fbd83ef8e71 n/a (libglib-2.0.so.0 + 0x44e71)
#5 0x00007fbd83e9246f start_thread (libpthread.so.0 + 0x946f)
#6 0x00007fbd83dc23d3 __clone (libc.so.6 + 0xff3d3)
Stack trace of thread 1491:
#0 0x00007fbd83db7abf __poll (libc.so.6 + 0xf4abf)
#1 0x00007fbd83f217a0 n/a (libglib-2.0.so.0 + 0x6d7a0)
#2 0x00007fbd83f21871 g_main_context_iteration (libglib-2.0.so.0 + 0x6d871)
#3 0x00007fbd84b8be5e n/a (libdconfsettings.so + 0x4e5e)
#4 0x00007fbd83ef8e71 n/a (libglib-2.0.so.0 + 0x44e71)
#5 0x00007fbd83e9246f start_thread (libpthread.so.0 + 0x946f)
#6 0x00007fbd83dc23d3 __clone (libc.so.6 + 0xff3d3)
Stack trace of thread 1477:
#0 0x00007fbd83db7abf __poll (libc.so.6 + 0xf4abf)
#1 0x00007fbd83f217a0 n/a (libglib-2.0.so.0 + 0x6d7a0)
#2 0x00007fbd83f21871 g_main_context_iteration (libglib-2.0.so.0 + 0x6d871)
#3 0x00007fbd83f218c2 n/a (libglib-2.0.so.0 + 0x6d8c2)
#4 0x00007fbd83ef8e71 n/a (libglib-2.0.so.0 + 0x44e71)
#5 0x00007fbd83e9246f start_thread (libpthread.so.0 + 0x946f)
#6 0x00007fbd83dc23d3 __clone (libc.so.6 + 0xff3d3)
Stack trace of thread 1490:
#0 0x00007fbd83db7abf __poll (libc.so.6 + 0xf4abf)
#1 0x00007fbd83f217a0 n/a (libglib-2.0.so.0 + 0x6d7a0)
#2 0x00007fbd83f22843 g_main_loop_run (libglib-2.0.so.0 + 0x6e843)
#3 0x00007fbd84094df8 n/a (libgio-2.0.so.0 + 0x59df8)
#4 0x00007fbd83ef8e71 n/a (libglib-2.0.so.0 + 0x44e71)
#5 0x00007fbd83e9246f start_thread (libpthread.so.0 + 0x946f)
#6 0x00007fbd83dc23d3 __clone (libc.so.6 + 0xff3d3)
Stack trace of thread 1545:
#0 0x00007fbd83dbcf8d syscall (libc.so.6 + 0xf9f8d)
#1 0x00007fbd83ed113b g_cond_wait_until (libglib-2.0.so.0 + 0x1d13b)
#2 0x00007fbd83f507e3 n/a (libglib-2.0.so.0 + 0x9c7e3)
#3 0x00007fbd83ef663b n/a (libglib-2.0.so.0 + 0x4263b)
#4 0x00007fbd83ef8e71 n/a (libglib-2.0.so.0 + 0x44e71)
#5 0x00007fbd83e9246f start_thread (libpthread.so.0 + 0x946f)
#6 0x00007fbd83dc23d3 __clone (libc.so.6 + 0xff3d3)
Program Versions
- Distro: Manjaro 19.0.2
- Kernel: 5.6.2-1-MANJARO
- gnome-terminal: 3.36.1.1-1
- xorg-server: 1.20.8-1
- xdotool: 3.20160805.1-2
System Info
$ inxi -Faxxxz
System: Host: gshl Kernel: 5.6.2-1-MANJARO x86_64 bits: 64 compiler: gcc v: 9.3.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-5.6-x86_64 root=/dev/nvme0n1p1 rw rootflags=subvol=@ break=postmount
Desktop: Gnome 3.36.1 wm: gnome-shell dm: GDM 3.34.1 Distro: Manjaro Linux
Machine: Type: Laptop System: Purism product: Librem 13 v4 v: 1.0 serial: <filter> Chassis: type: 9 serial: N/A
Mobo: Purism model: Librem 13 v4 v: 1.0 serial: <filter> BIOS: coreboot v: 4.11-Purism-1 date: 11/26/2019
Battery: ID-1: BAT charge: 40.4 Wh condition: 43.7/44.7 Wh (98%) volts: 8.1/7.4 model: TPS S10 type: Li-ion serial: N/A
status: Discharging
CPU: Topology: Dual Core model: Intel Core i7-7500U bits: 64 type: MT MCP arch: Amber Lake family: 6 model-id: 8E (142)
stepping: 9 microcode: CA L1 cache: 64 KiB L2 cache: 4096 KiB L3 cache: 4096 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 23209
Speed: 700 MHz min/max: 400/3500 MHz Core speeds (MHz): 1: 700 2: 700 3: 700 4: 701
Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages
Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
Type: mds mitigation: Clear CPU buffers; SMT vulnerable
Type: meltdown mitigation: PTI
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling
Type: tsx_async_abort status: Not affected
Graphics: Device-1: Intel HD Graphics 620 driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:5916
Display: server: X.org 1.20.8 driver: i915 compositor: gnome-shell resolution: <xdpyinfo missing>
OpenGL: renderer: Mesa Intel HD Graphics 620 (KBL GT2) v: 4.6 Mesa 20.0.4 direct render: Yes
Audio: Device-1: Intel Sunrise Point-LP HD Audio driver: snd_hda_intel v: kernel bus ID: 00:1f.3 chip ID: 8086:9d71
Sound Server: ALSA v: k5.6.2-1-MANJARO
Network: Device-1: Intel Wireless-AC 9260 driver: iwlwifi v: kernel port: efa0 bus ID: 02:00.0 chip ID: 8086:2526
IF: wlp2s0 state: up mac: <filter>
Drives: Local Storage: total: 476.94 GiB used: 17.26 GiB (3.6%)
ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 PRO 512GB size: 476.94 GiB block size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: 1B2QEXP7 scheme: MBR
Partition: ID-1: / raw size: 476.94 GiB size: 476.94 GiB (100.00%) used: 17.26 GiB (3.6%) fs: btrfs block size: 4096 B
dev: /dev/nvme0n1p1
ID-2: /home raw size: 476.94 GiB size: 476.94 GiB (100.00%) used: 17.26 GiB (3.6%) fs: btrfs block size: 4096 B
dev: /dev/nvme0n1p1
Sensors: System Temperatures: cpu: 34.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info: Processes: 197 Uptime: 41m Memory: 15.56 GiB used: 1.09 GiB (7.0%) Init: systemd v: 245 target: graphical.target
Compilers: gcc: 9.3.0 Shell: bash (sudo) v: 5.0.16 running in: gnome-terminal inxi: 3.0.37