Skip to content

libuv adapter: install hooks only once attach can no longer fail - #1405

Merged
uglide merged 1 commit into
release/v1.5.Xfrom
backport-libuv-attach-1.5.x
Nov 19, 2026
Merged

uglide merged 1 commit into
release/v1.5.Xfrom
backport-libuv-attach-1.5.x

Conversation

@uglide

@uglide uglide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #1400 (original commit dc60712 by @uglide) to the 1.5.x line for the 1.5.1 patch release.

Cherry-picked cleanly onto release/v1.5.X. Verified locally with a -Werror USE_SSL=1 build and the full hiredis-test suite (0 skipped, including Unix socket and DEBUG SLEEP timeout tests).

🤖 Generated with Claude Code


Note

Low Risk
Small ordering fix in the libuv adapter attach path; no change on the success path and aligned with upstream hiredis #1400.

Overview
Moves registration of the libuv event callbacks (addRead, delRead, addWrite, delWrite, cleanup, scheduleTimer) in redisLibuvAttach to after redisLibuvEvents is allocated and uv_poll_init_socket succeeds.

Previously those hooks were installed first, so a failed attach (malloc or poll init) could leave a redisAsyncContext with callback pointers set but no valid ev.data, making a retry or teardown unsafe. Successful attach behavior is unchanged.

Reviewed by Cursor Bugbot for commit e043164. Bugbot is set up for automated code reviews on this repo. Configure here.

redisLibuvAttach() set ac->ev.cleanup before allocating ev.data. When
hi_malloc() or uv_poll_init_socket() then failed it returned REDIS_ERR
with the cleanup hook still installed and ev.data NULL, so the
redisAsyncFree() the caller must follow with called
redisLibuvCleanup(NULL) and dereferenced NULL.

Install the hooks after the last failure point, so a failed attach
leaves the context untouched.

Fixes #1399

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@uglide uglide added the bug label Nov 19, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T17:04:42.925037Z e043164 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

ABI compatibility check

✅ libhiredis — compatible

No ABI changes detected.

✅ libhiredis_ssl — compatible

No ABI changes detected.

Baseline 9f97a40912e1a1fffe9b308a8e86a30915b4d621 vs head e0431644bd76fc5facaa19d23843d6148d0d3d0b. Apply the ignore-abi-check label to skip this check for an intentional, SONAME-bumped ABI break.

@uglide
uglide merged commit 9429a46 into release/v1.5.X Nov 19, 2026
21 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant