Skip to content

dasHV: libhv bump and loop-thread fixes for the dasHV tsan races - #4157

Merged
borisbat merged 4 commits into
masterfrom
aleksisch/hv-bump
Sep 28, 2026
Merged

borisbat merged 4 commits into
masterfrom
aleksisch/hv-bump

Conversation

@aleksisch

@aleksisch aleksisch commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Bumps libhv and fixes the dasHV-side tsan races, so four of the libhv tsan suppressions go.

  • libhv at 303f50c, whose logger and date header use localtime_r/gmtime_r. The tarball now extracts with fresh timestamps: kept archive dates are older than the previous pin's objects, so an incremental build left part of libhv.a stale and linked a mixed library (heap corruption in tests/dasHV).
  • is_connected / is_writer_connected read an atomic the loop thread keeps from the open/close callbacks, and a client close runs on its loop.
  • A deferred (HTTP_STATUS_UNFINISHED) handler fills its own response copy; the posted send assigns it back.

Suppressions removed: logger_create, hv::WebSocketClient::close, the writer's hio_is_opened peek, HttpHandler::onMessageComplete. hloop_stop, hio_write4 and hio_is_opened (send path) are libhv's own races, fixed upstream in ithewei/libhv#888; they go with the next pin bump.

Known gap: a client that pipelines a second request behind a deferred response still races on the request object libhv reuses.

Verified locally: tests/dasHV 143/143 (Release), tsan clean on tests/dasHV, tests/live_host, tests/stddlg/test_tray.das, tests/watchdog/test_watchdog.das.

@aleksisch
aleksisch force-pushed the aleksisch/hv-bump branch 3 times, most recently from 98c9f24 to 9bfcebb Compare September 28, 2026 09:17
@aleksisch aleksisch changed the title dasHV: libhv bump and loop-thread fixes for the dasHV tsan races [skip ci] dasHV: libhv bump and loop-thread fixes for the dasHV tsan races Sep 28, 2026
…/gmtime_r

The logger_create tsan suppression goes with the race it covered. The tarball now
extracts with fresh timestamps: kept archive dates are older than the previous pin's
objects, so libhv's sub-build left 14 of 64 objects stale and linked a mixed libhv.a.
is_connected and is_writer_connected read an atomic the loop thread keeps from the
open/close callbacks instead of libhv's io flags, and a client close runs on its loop,
where libhv's own close callback writes the same state. The tsan suppressions for
hv::WebSocketClient::close and the writer's hio_is_opened peek go; hio_is_opened stays
for the send path, the same libhv write-without-lock as hio_write4.
…with the send

The tick thread wrote ctx->response while libhv's loop thread still read it for the
access log after the handler returned HTTP_STATUS_UNFINISHED. The handler now fills a
copy taken on the loop thread, and the posted send assigns it back first, so the
HttpHandler::onMessageComplete tsan suppression goes.
Two sweeps running tests/ at once (the serialize and daslang_static lanes of extended
checks) opened the same tests/stbimage/_test_output* file, and one parsed it while the
other truncated it.
@borisbat
borisbat merged commit c3ac1d2 into master Sep 28, 2026
45 checks passed
@borisbat
borisbat deleted the aleksisch/hv-bump branch September 28, 2026 15:14
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.

2 participants