Repository navigation
fix(DailyNoteSearcher): resolve Windows WSAEWOULDBLOCK 10035 and ECONNRESET on HTTP search - #488
Merged
lioensky merged 1 commit intoOct 6, 2026
Conversation
…NRESET on HTTP search
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.
动机与背景 (Motivation)
在 Windows 平台下,当高并发或密集触发
{{...日记本::BM25}}/DirectDiaryTextProcessor纯文本检索时,终端偶发打印以下异常并导致日记召回劣化回退到 recent window:[DailyNoteSearcher Service] HTTP request failed: 无法立即完成一个非阻止性套接字操作。 (os error 10035)[DirectDiaryTextProcessor] BM25 OR prefilter failed, falling back to recent window: read ECONNRESET根因分析:
TcpListener(用于配合循环优雅退出)accept()出的子TcpStream会默认继承非阻塞状态。工作线程执行同步stream.read()时,若数据未完全进入内核缓冲区,会抛出WSAEWOULDBLOCK (10035)错误。handle_http_connection遭遇 10035 后函数退出导致连接被服务端 Drop,而此时 Node.js 客户端正等待响应或发送剩余分包,撞上服务端 RST 报文引发read ECONNRESET。解决方案 (Solution)
Plugin/DailyNoteSearcher/src/src/main.rs:handle_http_connection顶部,显式对子连接调用stream.set_nonblocking(false)恢复阻塞语义,抹平 Windows 平台差异。set_read_timeout/set_write_timeout),并在响应完毕后调用stream.flush()确保报文完整送达。Plugin/RAGDiaryPlugin/DirectDiaryTextProcessor.js的postDailyNoteSearcherHttp与Plugin/DailyNoteSearcher/DailyNoteSearcher.js的postJson中增加瞬时网络错误识别(ECONNRESET/10035/socket hang up/EPIPE)。测试与验证 (Verification)