You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2026/10/23 09:17:00 UTC
[jira] [Resolved] (THRIFT-6444) TSocket on the Haxe js target never receives a reply
[ https://issues.apache.org/jira/browse/THRIFT-6444?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jens Geyer resolved THRIFT-6444.
--------------------------------
Fix Version/s: 0.26.0
Assignee: Jens Geyer
Resolution: Fixed
> TSocket on the Haxe js target never receives a reply
> ----------------------------------------------------
>
> Key: THRIFT-6444
> URL: https://issues.apache.org/jira/browse/THRIFT-6444
> Project: Thrift
> Issue Type: Bug
> Components: Haxe - Library
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Priority: Minor
> Fix For: 0.26.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {{TSocket}} has a WebSocket arm for the Haxe js target. It sends requests, but it has never delivered a reply to its caller:
> * {{read()}} starts its copy loop at {{nr = len}}, so the loop body never runs: it returns {{len}} without appending a byte.
> * It reads every value from the start of the received message instead of from where the previous read stopped.
> * The received data is {{event.data}}, a {{Blob}} by default; before any message arrives, {{input}} is the {{WebSocket}} itself. Neither has {{get()}}, so fixing the loop bound alone gives {{TypeError: this.input.get is not a function}}.
> * {{flush()}} calls back right after {{send()}}, before the reply has arrived, so a generated client reads nothing.
> * A call made right after {{open()}} fails with {{InvalidStateError: Sent before connected}}, as the WebSocket connects asynchronously; {{isOpen()}} offers no way to wait.
> Seen with Node's built-in {{WebSocket}} against a WebSocket echo server, and with a generated client against a server that answers {{add(40, 2)}} correctly:
> {noformat}
> read(buf, 0, 4) returned 4, buffer holds 0 bytes []
> add: onError ... Bad IO error : InvalidStateError: Sent before connected.
> add: onError ... Bad IO error : OutsideBounds (after waiting for the connection)
> {noformat}
> Nothing in the repository exercises this code: CI runs the Haxe library tests on neko only, the js builds in {{test/haxe}} and {{lib/haxe/test}} are commented out, and the code has not changed since the initial Haxe support (THRIFT-2644).
> Fix: request {{ArrayBuffer}} messages, read them in order from where the last read stopped, call the flush callback when the message with the reply arrives, send a flush made before the connection is up once it is, and fail waiting callbacks when the connection closes. A new test in {{lib/haxe/test}} runs a generated {{ThriftTest}} client under Node against a minimal WebSocket server; the lib-haxe-codegen job runs it.
> _Drafted with AI assistance (Claude Opus 5.5)._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)