Fix captureScreen hang when server responds with only pseudo-encodings#315
Merged
sibson merged 1 commit intosibson:mainfrom Apr 11, 2026
Merged
Conversation
When a VNC server (e.g. TigerVNC, WayVNC) responds to a FramebufferUpdateRequest with only pseudo-encoding rectangles (such as PSEUDO_QEMU_EXTENDED_KEY_EVENT and PSEUDO_LAST_RECT), the capture command hangs indefinitely. Root cause: In _doConnection(), commitUpdate() is only called when rectanglePos is non-empty. However, pseudo-encoding handlers remove their entries from rectanglePos, so when a FramebufferUpdate contains only pseudo-encodings, rectanglePos ends up empty and commitUpdate() is never called. This leaves the Deferred unresolved forever. Fix: Always call commitUpdate() when all rectangles in a FramebufferUpdate have been processed, regardless of whether rectanglePos is empty. Fixes sibson#267 Made-with: Cursor
c6f406c to
5848414
Compare
Owner
|
thanks, ✨ 🍰 ✨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
captureScreen(and the CLIcapturecommand) hangs indefinitely when the VNC server responds to aFramebufferUpdateRequestwith only pseudo-encoding rectangles and no actual pixel data.This has been reported in #267 and affects multiple VNC servers including TigerVNC and WayVNC.
Reproduction
$ vncdo -s ::5900 -p capture screenshot.png
Debug log shows the server returns only pseudo-encodings:
DEBUG:vncdotool.client:captureScreen screenshot.png INFO:twisted:x=0 y=0 w=0 h=0 <Encoding.PSEUDO_QEMU_EXTENDED_KEY_EVENT: -258> INFO:twisted:x=0 y=0 w=0 h=0 <Encoding.PSEUDO_LAST_RECT: -224>
hangs forever here
Root Cause
In
rfb.py,_doConnection()only callscommitUpdate()whenrectanglePosis non-empty: