Skip to content

Fix WebSocket crash from oversized client messages#156

Open
MisterGC wants to merge 3 commits intomainfrom
fix/ws-oversized-message-crash
Open

Fix WebSocket crash from oversized client messages#156
MisterGC wants to merge 3 commits intomainfrom
fix/ws-oversized-message-crash

Conversation

@MisterGC
Copy link
Copy Markdown
Contributor

@MisterGC MisterGC commented Apr 9, 2026

Fixes #155

Drogon's default 128 KB WebSocket client message size limit caused std::terminate when clients sent large tile requests.

  • Raise Drogon's client WS message size limit from 128 KB to 10 MB
  • Add try-catch around sendControlMessage() to handle send failures on dying connections
  • Add try-catch around onTileLayer() to catch exceptions from tile serialization/streaming
  • Add try-catch around handleNewMessage() since Drogon calls it with no exception protection

TODO

  • Decide whether to also limit request size at the protocol level to avoid depending on Drogon's frame-size limit. Options include: capping tile count per request, chunking large requests into multiple messages, or moving bulk request payloads to HTTP POST and keeping the WebSocket as a small control channel only. This would also require client-side changes in erdblick.

@MisterGC MisterGC requested a review from josephbirkner April 9, 2026 09:07
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
16.3% Duplication on New Code (required ≀ 3%)

See analysis details on SonarQube Cloud

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Package Line Rate Branch Rate Health
libs.geojsonsource.include.geojsonsource 100% 50% βœ”
libs.geojsonsource.src 67% 34% βž–
libs.gridsource.include.gridsource 0% 0% ❌
libs.gridsource.src 0% 0% ❌
libs.http-datasource.src 57% 31% βž–
libs.http-service.include.mapget.http-service 100% 100% βœ”
libs.http-service.src 61% 25% βž–
libs.logging.include.mapget 7% 3% ❌
libs.model.include.mapget.model 51% 29% βž–
libs.model.src 68% 38% βž–
libs.service.include.mapget.service 58% 50% βž–
libs.service.src 71% 35% βž–
Summary 60% (6770 / 11205) 31% (6875 / 22261) βž–

Minimum allowed line rate is 50%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket: oversized client messages cause std::terminate crash

2 participants