Fix black captures from servers announcing DesktopSize before pixel data (#90) - #343
Open
sibson wants to merge 1 commit into
Open
Fix black captures from servers announcing DesktopSize before pixel data (#90)#343sibson wants to merge 1 commit into
sibson wants to merge 1 commit into
Conversation
A framebuffer update whose only rectangle is the PSEUDO_DESKTOP_SIZE pseudo-encoding used to complete a pending refresh: updateDesktopSize replaces the screen with a black canvas and commitUpdate fired the deferred regardless, so captureScreen saved the black canvas and the CLI exited before the server's first pixel frame arrived. TightVNC on Windows answers the first non-incremental update request exactly this way, which is the black-screenshot report in #90 (2017-2025). The DesktopSize rectangle is now excluded from the update's content rectangles, matching the existing QEMU key-event pseudo-rect handling, and a pending refresh whose update carried no content re-requests the framebuffer instead of completing. Fixes #90. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 13, 2026
sibson
commented
Aug 14, 2026
|
|
||
| def commitUpdate(self, rectangles: list[rfb.Rect] | None = None) -> None: | ||
| if self.deferred: | ||
| if not rectangles: |
Owner
Author
There was a problem hiding this comment.
should commitUpdate even get called if we are properly deleting the pseudo rectangle
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.
Fixes #90 — black screenshots against TightVNC on Windows, reported 2017–2025.
Mechanism (full analysis in the issue comment): TightVNC answers the first non-incremental
FramebufferUpdateRequestwith an update containing only the DesktopSize pseudo-rectangle.updateDesktopSizereplacesself.screenwith a black canvas,_doConnectionfiredcommitUpdateunconditionally once the rectangle count hit zero, the pending capture completed, and the CLI saved the black canvas and exited — before the server's pixel frame (sent moments later) arrived.The fix, two small parts:
rfb.py: the DesktopSize rect is removed fromrectanglePosbefore decoding, exactly as the QEMU key-event pseudo-rect already is ("undo append as this is no real update") — pseudo-rectangles carrying no pixels no longer count as update content.client.py:commitUpdatewith a pending deferred and no content rectangles re-issues a non-incrementalframebufferUpdateRequestand keeps waiting, instead of completing the refresh with nothing on the canvas.A server that answered every non-incremental request with a content-free update could keep the client requesting until its timeout; real servers send content, and the per-client
timeoutstill bounds the wait either way.Regression tests live in their permanent home (
tests/unit/test_client.py): a desktop-size-only update must not complete a refresh (and must re-request), and the refresh completes normally once pixel data arrives. Full unit suite green, flake8 clean.End-to-end validation: the scripted server replaying TightVNC's logged behaviour (full repro kit in the issue thread) flips from a black capture (
extrema ((0,0),(0,0),(0,0)), server logscould not send pixel data: CLIENT ALREADY DISCONNECTED) to the correct test pattern — after the DesktopSize rect the client now re-requests and receives the RAW frame before completing:Supersedes #342 (the test-only repro PR): this PR carries that test in final form, renamed for the behaviour it checks per the repo convention. When this merges, close #342 unmerged — its
expectedFailuretest would report an unexpected success on a fixed tree.