Bug 502591 - Infinite Loop in KScreen When Changing Display
Summary: Infinite Loop in KScreen When Changing Display
Status: REPORTED
Alias: None
Product: KScreen
Classification: Plasma
Component: common (other bugs)
Version First Reported In: 6.3.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: X11-only
Depends on:
Blocks:
 
Reported: 2025-04-09 06:12 UTC by notify
Modified: 2025-04-09 17:26 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description notify 2025-04-09 06:12:44 UTC
---

### Bug Report: Infinite Loop in KScreen When Changing Display Configuration via X11 Forwarding

#### System Configuration:
1. **Windows Host** with two monitors in extended mode (`Win + P -> Extend`)
2. X11 server running on Windows via [X410](https://x410.dev/download/) with TCP X11 service enabled
3. Arch Linux guest accessed via SSH with X11 forwarding

#### Steps to Reproduce:
1. On Windows host, set up dual monitors in extended mode
2. Install and run X410 with TCP X11 service
3. From Linux terminal:
   ```bash
   export DISPLAY=windowshostip:0.0
   kstart5 startplasma-x11
   ```
4. Wait for KDE to display on Windows machine
5. Open two SSH terminals to Arch Linux:

**Terminal 1:**
```bash
kscreen-console monitor
```
*Observed behavior:* Infinite spam of identical output (see full output below)

**Terminal 2:**
```bash
journalctl -n 100 -f
```
*Observed behavior:* Infinite spam of identical error logs (see full output below)

#### Trigger Condition:
When changing display mode via `Win + P -> "Only one screen"` (disabling one monitor)

#### Current Workaround:
```bash
pkill -f kscreen_backend_launcher
```
(Process automatically restarts but bug reoccurs when changing display modes again)





you can get very very very large same error log in tab 1 and tab2



```bash
❯ kscreen-console monitor                                                                                                                                                                                                                                        
START: Requesting Config
Received config. Took 37 milliseconds
Remember to enable KSRandR or KSRandR11 in kdebugdialog
Screen:
        maxSize: QSize(32768, 32768)
        minSize: QSize(0, 0)
        currentSize: QSize(5120, 1452)

-----------------------------------------------------

Id:  62
Name:  "default"
Type:  "Unknown"
Connected:  true
Enabled:  true
Priority:  1
Rotation:  KScreen::Output::None
Pos:  QPoint(0,0)
MMSize:  QSize(1355, 384)
FollowPreferredMode:  false
Size:  QSize(5120, 1452)
Scale:  1
Clones:  None
Mode:  "63"
Preferred Mode:  "63"
Preferred modes:  QList()
Modes: 
         "63"    ""   QSize(5120, 1452)   0
EDID Info: 
        Unavailable

Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))
Priorities changed: QMap((62, KScreen::Output(62, "default", connected enabled priority 1, pos: QPoint(0,0), res: QSize(5120, 1452), modeId: "63", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)))

..... Excessive repeated output of identical content  
..... Generates thousands of identical lines per second
```



new ssh tab 2 and run

```
❯ journalctl -n 100 -f

Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: XRandR::setConfig
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Requested screen size is QSize(2560, 1380)
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Needed CRTCs:  1
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Actions to perform:
                                                                   Priorities: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Change Screen Size: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Disable outputs: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Change outputs: true
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:                  QList(62)
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Enable outputs: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Error on logical size transformation!
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: RRSetCrtcConfig (change output) 
                                                                   Output: 62 ( "default" ) 
                                                                   CRTC: 61 
                                                                   Pos: QPoint(0,0) 
                                                                   Mode: KScreen::Mode(Id: "362" , Size: QSize(2560, 1380) @ 0 ) Preferred: "362" 
                                                                   Rotation: KScreen::Output::None
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Result:  0  timestamp:  50696718
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: XRandROutput 62 update 
                                                                   m_connected: 0 
                                                                   m_crtc XRandRCrtc(0x5c1035e84380) 
                                                                   CRTC: 61 
                                                                   MODE: 362 
                                                                   Connection: 0
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: RRSetOutputPrimary 
                                                                   New priority: 1
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: XRandR::setConfig done!

Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: XRandR::setConfig
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Requested screen size is QSize(2560, 1380)
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Needed CRTCs:  1
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Actions to perform:
                                                                   Priorities: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Change Screen Size: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Disable outputs: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Change outputs: true
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:                  QList(62)
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Enable outputs: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Error on logical size transformation!
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: RRSetCrtcConfig (change output) 
                                                                   Output: 62 ( "default" ) 
                                                                   CRTC: 61 
                                                                   Pos: QPoint(0,0) 
                                                                   Mode: KScreen::Mode(Id: "362" , Size: QSize(2560, 1380) @ 0 ) Preferred: "362" 
                                                                   Rotation: KScreen::Output::None
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Result:  0  timestamp:  50696718
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: XRandROutput 62 update 
                                                                   m_connected: 0 
                                                                   m_crtc XRandRCrtc(0x5c1035e84380) 
                                                                   CRTC: 61 
                                                                   MODE: 362 
                                                                   Connection: 0
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: RRSetOutputPrimary 
                                                                   New priority: 1
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: XRandR::setConfig done!

Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: XRandR::setConfig
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Requested screen size is QSize(2560, 1380)
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Needed CRTCs:  1
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Actions to perform:
                                                                   Priorities: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Change Screen Size: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Disable outputs: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Change outputs: true
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:                  QList(62)
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr:         Enable outputs: false
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: Error on logical size transformation!
Apr 09 13:53:22 archlinux kscreen_backend_launcher[4076]: kscreen.xrandr: RRSetCrtcConfig (change output) 
                                                                   Output: 62 ( "default" ) 
                                                                   CRTC: 61 
                                                                   Pos: QPoint(0,0) 
                                                                   Mode: KScreen::Mode(Id: "362" , Size: QSize(2560, 1380) @ 0 ) Preferred: "362" 
                                                                   Rotation: KScreen::Output::None
                                                                   
                                                                   

..... Excessive repeated output of identical content  
..... Generates thousands of identical lines per second
```





#### Error Analysis:
1. The `kscreen_backend_launcher` enters an infinite loop when display configuration changes
2. Relevant code locations:
   - [xrandr.cpp#L179](https://github.com/KDE/libkscreen/blob/9dad2a26069644d4c42d280d830d42aba66390ef/backends/xrandr/xrandr.cpp#L179)
   - [xrandroutput.cpp#L451](https://github.com/KDE/libkscreen/blob/9dad2a26069644d4c42d280d830d42aba66390ef/backends/xrandr/xrandroutput.cpp#L451)

#### Additional Notes:
-  (`sudo pacman -Syu`) do not resolve the issue

---





```bash
❯ kscreen-console json
START: Requesting Config
Received config. Took 4 milliseconds
{
    "features": 11,
    "outputs": [
        {
            "clones": [
            ],
            "connected": true,
            "currentModeId": "63",
            "enabled": true,
            "followPreferredMode": false,
            "icon": "",
            "id": 62,
            "modes": [
                {
                    "id": "63",
                    "name": "",
                    "refreshRate": 0,
                    "size": {
                        "height": 1452,
                        "width": 5120
                    }
                }
            ],
            "name": "default",
            "pos": {
                "x": 0,
                "y": 0
            },
            "preferredModes": [
            ],
            "priority": 1,
            "replicationSource": 0,
            "rotation": 1,
            "scale": 1,
            "size": {
                "height": 1452,
                "width": 5120
            },
            "sizeMM": {
                "height": 384,
                "width": 1355
            },
            "type": 0
        }
    ],
    "screen": {
        "currentSize": {
            "height": 1380,
            "width": 2560
        },
        "id": 0,
        "maxActiveOutputsCount": 1,
        "maxSize": {
            "height": 32768,
            "width": 32768
        },
        "minSize": {
            "height": 0,
            "width": 0
        }
    },
    "tabletModeAvailable": false,
    "tabletModeEngaged": false
}

```










OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: win11
macOS: no
(available in the Info Center app, or by running `kinfo` in a terminal window)
❯ kinfo                                                                                                                                                                                                                                                          ─╯
Operating System: Arch Linux 
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.6-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 14 × Intel® Core™ i7-14700K
Memory: 6.1 GiB of RAM
Graphics Processor: llvmpipe