Bug 473555

Summary: Monitor brightness unresponsive when USB drive connected
Product: [Plasma] plasmashell Reporter: Frederik Schwarzer <schwarzer>
Component: Power management & brightnessAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: natalie_clarius, nate, nicolas.fella
Priority: NOR    
Version First Reported In: 6.2.4   
Target Milestone: 1.0   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Hotspot Screenshot Timeline
Flamegraph
Flamegraph
Stack info
Here is one flamegraph where no freeze occurred

Description Frederik Schwarzer 2023-08-20 08:56:58 UTC
SUMMARY
When I connect a USB drive to my laptop, the screen brightness setting via the Fn keys becomes unresponsive until the USB drive is detected and ready to use (meaning: the notification with the mount options is shown).
For some reason this is taking around 10 seconds for some of my USB drives.
Then I change the screen brightness settings a lot during that time, all those changes are then "replayed" when the system is responsive again.


STEPS TO REPRODUCE
1. connect USB drive (and hope it takes some time to be ready)
2. in the meantime, change the screen brightness using the Fn keys
3. wonder

OBSERVED RESULT
The screen brightness does not change (or changes later)

EXPECTED RESULT
Screen brightness should be responsive regardless of any other Plasma thing waiting for something.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10
Kernel Version: 6.4.0-3-amd64 (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Pentium® Silver N6000 @ 1.10GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: Acer
Product Name: Swift SF114-34
System Version: V1.03

ADDITIONAL INFORMATION
Comment 1 Nicolas Fella 2023-08-20 10:01:30 UTC
Does changing the brightness from the applet work?

Do any other shortcuts (e.g. volume up/down) also not work?
Comment 2 Frederik Schwarzer 2023-08-20 13:12:03 UTC
During the unresponsive time, clicking the battery or speaker symbol does not open the applet.
Audio volume is also affected.
Comment 3 ratijas 2023-08-20 15:36:29 UTC
So is it safe to say, Plasma freezes as whole, and it has something to do with Monitor brightness specifically?
Comment 4 ratijas 2023-08-20 15:39:08 UTC
Sorry, mistyped. I meant…

So is it safe to say, Plasma freezes as whole, and it has **nothing** to do with Monitor brightness specifically?

Is there anything interesting showing up in `dmesg` log during this time?  (`dmesg -w` to keep it printing real-time)
Comment 5 Frederik Schwarzer 2023-08-20 15:47:02 UTC
Nothing printed at all during the freezing.

It's:
[25535.653323] usb 1-2: new high-speed USB device number 14 using xhci_hcd
[25535.815217] usb 1-2: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.00
[25535.815240] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[25535.815246] usb 1-2: Product: Intenso Mobile Line
[25535.815251] usb 1-2: Manufacturer: 6989
[25535.815255] usb 1-2: SerialNumber: 7033DF76
[25535.818888] usb-storage 1-2:1.0: USB Mass Storage device detected
[25535.819439] scsi host0: usb-storage 1-2:1.0
[25536.842035] scsi 0:0:0:0: Direct-Access     Intenso  Mobile Line      8.07 PQ: 0 ANSI: 4
[25536.842856] sd 0:0:0:0: Attached scsi generic sg0 type 0
[25536.843923] sd 0:0:0:0: [sda] 61747200 512-byte logical blocks: (31.6 GB/29.4 GiB)
[25536.844663] sd 0:0:0:0: [sda] Write Protect is off
[25536.844671] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[25536.845425] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[25536.850746]  sda: sda1
[25536.851156] sd 0:0:0:0: [sda] Attached SCSI removable disk

And the non-responsiveness starts right after the last line.
Comment 6 Frederik Schwarzer 2023-08-20 15:48:49 UTC
Weird thing is, it happened reproducibly with one USB thumb drive yesterday ... Today that thumb drive is alright (is detected after 1 sec) but another thumb drive reproducibly triggers this.
Comment 7 ratijas 2023-08-20 16:01:32 UTC
I *guess* it might be not a long busy process, but just one blocking call somewhere.

You could try Hotspot and see in which functions plasmashell spends most of its time.
Comment 8 Frederik Schwarzer 2023-08-20 18:04:12 UTC
Created attachment 161076 [details]
Hotspot Screenshot Timeline

- at around 1s, I plug in the drive
- at around 4s the freeze starts to happen but I continue to send screen brightness chages twisce per second
- at around 12s it unfreezes.
Comment 9 Frederik Schwarzer 2023-08-20 18:09:14 UTC
Created attachment 161077 [details]
Flamegraph
Comment 10 Frederik Schwarzer 2023-08-20 18:14:27 UTC
Created attachment 161078 [details]
Flamegraph
Comment 11 Frederik Schwarzer 2023-08-20 18:16:04 UTC
Created attachment 161079 [details]
Stack info
Comment 12 Frederik Schwarzer 2023-08-20 19:07:00 UTC
Created attachment 161080 [details]
Here is one flamegraph where no freeze occurred
Comment 13 Nate Graham 2025-05-28 19:14:55 UTC
Hi Frederik, sorry we weren't able to analyze those logs you took! :( I apologize for wasting your time. Any chance you can mention whether you're still able to reproduce this issue in Plasma 6.3.5 — or even better, in the Plasma 6.4 beta?

If so, I'll try to find someone who can analyze those logs.

Thanks a lot!
Comment 14 Bug Janitor Service 2025-06-12 03:47:57 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 15 Bug Janitor Service 2025-06-27 03:48:04 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.