Brave prevents screen turn off

Description of the issue: hi, brave browser prevents screen turning off without any particular reason (manjaro, xfce, other apps are not affected)
How can this issue be reproduced?

  1. I don’t know, it just happens
  2. use brave browser
  3. close it
  4. wait a minute for good measure
  5. click the battery icon in the bottom right of your screen
  6. verify that screensaver is inhibited by brave browser despite it being closed

Expected result: screensaver not being inhibited by brave after it being closed

Brave Version( check About Brave): v1.84.141 official build

Additional Information:

sometimes it happens thrice a day (xfce power manager needs to be restarted as a workaround to make it go back to normal), sometimes it happens once a day

Thank you for reporting. Kind of a tough one to diagnose given how sporadic you’re saying the actual behavior is. Can you try closing Brave and then opening the system monitor/task manager and check to see what specific Brave processes are still running once the browser is closeed?

ps uxa|grep -iF brave gives no results

brave still sends an inhibition request if a muted tab tries to play music/sound. that’s clearly a bug

I just want to report that I am having the same issue. Running LinuxMint.

$ dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.GetInhibitors
method return time=1764300214.137643 sender=:1.10 -> destination=:1.1190 serial=14083 reply_serial=2

array [
      object path "/org/gnome/SessionManager/Inhibitor803"
      ...
      ...
      ...
   ]

$ dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager/Inhibitor803 org.gnome.SessionManager.Inhibitor.GetAppId

method return time=1764300254.210438 sender=:1.10 -> destination=:1.1192 serial=14085 reply_serial=2
   string "/opt/brave.com/brave/brave"

System information:

OS: Linux Mint 22.2 Cinnamon

Kernel: 6.8.0-88-generic

Brave: 1.84.141 (Official Build) (64-bit)

if we consider what @SentientClanker said, the next step would be to reproduce the issue (preferably with chromium), provide as-concise-as-posible steps to reproduce, and report it to chromium. Do you agree? do you have any clues how to trigger the bug?

I have not tried it with chromium yet, however, it might be an issue in Gnome.

https://gitlab.gnome.org/GNOME/gnome-session/-/issues/174

There is also an easier way to check:

$ gnome-session-inhibit --list
/opt/brave.com/brave/brave: WebRTC has active PeerConnections (suspend)
/opt/brave.com/brave/brave: Video Wake Lock (suspend, idle)
/opt/brave.com/brave/brave: Download in progress (suspend)
/opt/brave.com/brave/brave: Video Wake Lock (suspend, idle)
/opt/brave.com/brave/brave: Video Wake Lock (suspend, idle)
/opt/brave.com/brave/brave: Video Wake Lock (suspend, idle)
/opt/brave.com/brave/brave: Download in progress (suspend)
/opt/brave.com/brave/brave: Video Wake Lock (suspend, idle)
/opt/brave.com/brave/brave: Download in progress (suspend)
/opt/brave.com/brave/brave: Video Wake Lock (suspend, idle)

I restarted my brave. It seems that things are working properly at this point.

To understand better of this issue, I have tried playing a video from YouTube, the Wake Lock becomes active (gnome-session-inhibit -l) and the Wake Lock goes away when I pause. This looks normal so far.

I’ll report back when I run into this issue again.

does any of you use mpv? can it be an interference between two apps? (e.g. mpv and brave)

FWIW, it happened to me with the latest MX Linux 25 with XFCE while I was trying to solve a Power Manager/Screensaver issue!

I’ve been bitten by the same problem. I am running xfce, and evidently the the gnome-listing ‘gnome-session-inhibit --list’ doesn’t work (it actually dumps core). However, by letting Power Manager have a tray icon, I could see that when a youtube is playing, there’s two entries of /opt/brave.com/brave/brave is currently inhibiting power management

After some heavy AI’ing, we came up with a way to see a difference by using systemd-inhibit --list: I can see that there’s one line extra when Brave is playing a video:
libxfce4ui 1000 endre 3648 xfce4-screensav idle Inhibit requested block

(Notice how this doesn’t reference Brave, but xfce4-screensaver)

And we came up with this command to “tail” the different calls to dbus:

dbus-monitor --session “type=‘method_call’,interface=‘org.freedesktop.PowerManagement.Inhibit’” | grep -E “brave|Inhibit|UnInhibit”

.. yielding the following lines when starting to play, and then pausing, a youtube (notice the two lines per action):
method call time=1765370522.394644 sender=:1.116 → destination=org.freedesktop.PowerManagement serial=1046 path=/org/freedesktop/PowerManagement/Inhibit; interface=org.freedesktop.PowerManagement.Inhibit; member=Inhibit
string “/opt/brave.com/brave/brave”
method call time=1765370522.503690 sender=:1.116 → destination=org.freedesktop.PowerManagement serial=1052 path=/org/freedesktop/PowerManagement/Inhibit; interface=org.freedesktop.PowerManagement.Inhibit; member=Inhibit
string “/opt/brave.com/brave/brave”

method call time=1765370523.554456 sender=:1.116 → destination=org.freedesktop.PowerManagement serial=1056 path=/org/freedesktop/PowerManagement/Inhibit; interface=org.freedesktop.PowerManagement.Inhibit; member=UnInhibit
method call time=1765370525.818230 sender=:1.116 → destination=org.freedesktop.PowerManagement serial=1057 path=/org/freedesktop/PowerManagement/Inhibit; interface=org.freedesktop.PowerManagement.Inhibit; member=UnInhibit

(On pause, it takes a little while before the second “UnInhibit” line comes.)

My current understanding is that somehow this can become “stuck”; Brave not de-registering its inhibition. Maybe when it crashes? At least, in these situations, I can close, or kill, Brave, and those two entries seen via the tray icon doesn’t go away - and the screen will never turn off.

When I have the problem on my Linux Mint XFCE 22.2 laptop with latest Brave update:-

If you do a:-

dbus-send --print-reply --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.GetInhibitors

You get:-

method return time=1766140932.750127 sender=:1.532 → destination=:1.782 serial=236 reply_serial=2
array [
string “/opt/brave.com/brave/brave”
]

If you look at brave and are say, playing a youtube video, you get a “sound icon” in the tab and string “/opt/brave.com/brave/brave” is shown in the above command. Stop playing the video and the string “/opt/brave.com/brave/brave” disappears.

If you have outlook.live.com as a tab (checking email) you will sometimes see a dot saying new mail. This also seams to sometimes create the string “/opt/brave.com/brave/brave”.

This is how you can replicate the problem:-

If you open a .pdf in brave (with brave as your default pdf viewer) and press the download button you can get the string “/opt/brave.com/brave/brave”

If you want to clear the Inhibitors without logging out or rebooting you can do the following:-

xfce4-power-manager --restart

If you the press the download button multiple times you should get the string “/opt/brave.com/brave/brave” multiple times showing in the inhibitors again.

If you close the pdf tab you could still have string “/opt/brave.com/brave/brave” multiple times showing in the inhibitors again.

If you close the browser you could still have string “/opt/brave.com/brave/brave” multiple times showing in the inhibitors again.

THIS IS THE PROBLEM.

but to clear the problem without having to log out or reboot :-

xfce4-power-manager --restart

This does not fix the problem. If you have not noticed it and thus clear, you laptop will not go to sleep because of the inhibitors.

this is huge. we have a clean distilled way to reproduce the issue.

  1. open your brave browser
  2. make sure you only have a single tab open, not playing audio/video (e.g. home tab)
  3. verify that it does not currently inhibit screensaver
  4. go to duckduckgo.com type: filetype:pdf
  5. open a pdf
  6. download the pdf
  7. verify that your screensaver is now inhibited
  8. close your only brave tab (if you’ve done everything right you still should have a single tab)
  9. verify that your brave browser have been terminated (ps uxa|grep brave)
  10. verify that your screensaver is still inhibited by the already closed brave browser (expected behaviour: it shouldn’t)

I’ve reproduced the issue on the first try

does any of us have chromium? can this issue be reproduced the same way on chromium?

UPDATE: I wasn’t able to reproduce it since then :’( most probably it’s nondeterministic

UPDATE2: I have a workaround, which is using this script to start brave:

#!/bin/bash

unset DBUS_SESSION_BUS_ADDRESS
unset DBUS_SESSION_BUS_PID
exec /usr/bin/brave --no-default-browser-check "$@"

when you do this, brave won’t be able to inhibit your screensaver at all (and brave notifications won’t be sent using system capabilities, brave will be using a built in workaround to send you notifications). so if you’re trying to reproduce the bug make sure you don’t use this script

I can replicate the issue over and over again:

  1. close Brave

  2. check there are no inhibitors by opening a terminal window and type (copy/paste)

    dbus-send --print-reply --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.GetInhibitors

  3. if needed clear the inhibitors with the below and check with (2) that the inhibitors have gone (in the terminal window).

    xfce4-power-manager --restart

  4. open Brave

  5. open Nemo or Thunar and open a pdf in brave by dragging the pdf to the brave window.

  6. now download the pdf using the download arrow (top right) in the Brave pdf viewer window. Do this 5 times as quickly as possible.

  7. check inhibitors (in terminal window)- you should find you have multiple brave inhibitors.

    dbus-send --print-reply --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.GetInhibitors

  8. close the browse and check again, you should still have the inhibitors.

  9. you can clear the inhibitors with (in the terminal window)

    xfce4-power-manager --restart

I’ve tried it only once, works for me

When you say “it works for me”, does that mean you can replicate the problem or does it mean that it did not replicate the problem and Brave worked fine for you?

Hi Mattches,

I’m not sure if you are following the thread, so I am replying direct to you.

When I have the problem and close the Brave browser, if I go a ps -ef | grep brave, there are no brave processes running.

I can replicate the issue over and over again:

  1. close Brave

  2. check there are no inhibitors by opening a terminal window and type (copy/paste)

    dbus-send --print-reply --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.GetInhibitors

  3. if needed clear the inhibitors with the below and check with (2) that the inhibitors have gone (in the terminal window).

    xfce4-power-manager --restart

  4. open Brave

  5. open Nemo or Thunar and open a pdf in brave by dragging the pdf to the brave window.

  6. now download the pdf using the download arrow (top right) in the Brave pdf viewer window. Do this 5 times as quickly as possible.

  7. check inhibitors (in terminal window)- you should find you have multiple brave inhibitors.

    dbus-send --print-reply --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.GetInhibitors

  8. close the browse and check again, you should still have the inhibitors.

  9. you can clear the inhibitors with (in the terminal window)

    xfce4-power-manager --restart

Hope this helps you to try to resolve the issue.

I have had the same problem randomly with downloads of things like jpegs, once I think with viewing a document in outlook.live.com and once when I was using youtube. I suspect that Brave is inhibiting sleep when it does a download/stream and that it is not closing the inhibit correctly either due to not seeing it finish, or getting multiple downloads/streams in the wrong order when closing the inhibit or something like that - I’m sure you will have a better idea than me, I’m guessing.

Thanks for looking at this and I hope you can replicate the problem too.

Forgot to say. I am running a 10 year old laptop Lenovo B570e.

Linux Mint XFCE 22.2 with 6.8 Kernel.

yeah sorry that was ambiguous. I was able to replicate the issue with the given steps to reproduce

I’ve tried to reproduce it with chrome, but I couldn’t