Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Let gonsole bound an answer nobody reads

未关闭
#94 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
backend

调研方向

Start with Timeouts and Env.Timeouts in gonsole, then NewServer in gonsole/serve.go (around lines 56-60), where WriteTimeout is never set. Read inflight.wrap (serve.go lines 198-204) and the open-request count in gonsole/idle.go (lines 40-46) to see why an unread answer keeps the server busy. Done means a test with an unread large answer lets the idle exit fire within 500 ms, and a zero Timeouts.Write leaves existing behaviour unchanged.

由索引模型根据 Issue 内容生成。

描述

enhancement help wanted

Downstream applications that exit when idle must not be held up by a visitor who stops reading.

Current state: gonsole.Timeouts has no write field and NewServer never sets WriteTimeout (gonsole/serve.go:56-60), so gonsole bounds no write. A test on gonsole 0.8.0 asked for a large answer and never read it. The handler's writes stalled once the system's buffer filled. The request still counted as open (gonsole/idle.go:40-46), so a 100 ms idle exit had not come 2 seconds later. On a cancel, as on SIGTERM, ServeListening waited for Grace and CancelGrace and returned ErrStillServing.

Proposal: one of two bounds. First, a Timeouts.Write field that Env.Timeouts reads from HTTP_WRITE_TIMEOUT with AllowZero(), and NewServer copies into WriteTimeout. In the test, 500 ms let the idle exit come. It also cuts a long answer to a visitor who still reads. Second, inflight.wrap (gonsole/serve.go:198-204) hands the handler a writer that calls http.ResponseController.SetWriteDeadline before each write. In the test, even 1 s cut a visitor still reading, but 2 s did not. That writer must keep Flush, and its ReadFrom must move the deadline as it copies, or http.ServeContent gets one deadline for the whole file. Start from Timeouts.Write, because it is one field and zero changes nothing. Test it with an answer nobody reads.

Trigger: a downstream application serves downloads with IDLE_EXIT set.

主要语言
Go
星标
69
派生
3
平均合并
9 小时 11 分钟
30 天内合并 PR
38

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

gopherium/framework 的其他 Issue

查看 gopherium/framework 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。