Browser doesn’t close gracefully on SIGTERM

Description of the issue:
Browser doesn’t close gracefully on SIGTERM.
This causes issues, because my session is not restored properly after a system restart.
How can this issue be reproduced?

  1. Open terminal.
  2. pkill -TERM brave
  3. The browser freezes, but won’t close.
  4. pkill -TERM brave again.
  5. Brave closes.
  6. Open Brave again.
  7. Get the Brave didn't shut down properly. Restore? popup.

Expected result:
Brave closes gracefully. Opening it again restores the session.

Brave Version( check About Brave):
Version 1.63.169 Chromium: 122.0.6261.111 (Official Build)

Linux Version:
Linux Mint 21.3

Additional Information:
pkill -INT brave works. It closes the browser and when I open it up again, my session restarts as it should. I guess I could write a custom script to use that instead, but that doesn’t really solve the problem.


Running pgrep -xa brave after breaking results in 4 processes:

20813 /app/brave/brave --disable-features=WebAssemblyTrapHandler,DesktopPWAsRunOnOsLogin --component-updater=url-source=https://go-updater.brave.com/extensions,url-source=https://go-updater.brave.com/extensions,url-source=https://go-updater.brave.com/extensions,url-source=https://go-updater.brave.com/extensions --disable-domain-reliability --enable-distillability-service --enable-dom-distiller --lso-url=https://no-thanks.invalid --no-default-browser-check --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --restart --sync-url=https://sync-v2.brave.com/v2 --variations-insecure-server-url=https://variations.brave.com/seed --variations-server-url=https://variations.brave.com/seed --restart --no-default-browser-check
20835 brave
20881 brave
21231 brave

I have tried:

  • Disabling/removing extenstions
  • Enabling/disabling hardware acceleration
  • Enabling/disabling the Continue running background app when Brave is closed setting
  • Enabling/disabling memory saver mode

Can you help me investigating the issue further?

I had some time today, so I was experimenting a bit.
I attached strace to the process, issued pkill and this is what I’ve got:

$ strace -p $(pgrep brave) -e trace=signal
strace: Process 3842 attached

--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=0, si_uid=1000} ---
rt_sigaction(SIGTERM, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f5d68b17e80}, NULL, 8) = 0
rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
rt_sigprocmask(SIG_BLOCK, ~[], [], 8)   = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0

It hangs here, so I issued the next pkill:

--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=0, si_uid=1000} ---
+++ killed by SIGTERM +++

I cannot be the only one having this issue.
Bump.