Confusing "Resource temporarily unavailable" error on timeout with OpenSSL backend
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- c, git
- 领域
- backend, networking
调研方向
首先复现服务器一秒超时的示例,并跟踪 socket_read 经过 BIO 和 stream 抽象层的过程。当超时得到保留,并且被报告为超时而不是 "Resource temporarily unavailable" 时,工作就完成了。
由索引模型根据 Issue 内容生成。
描述
Consider this example:
#include <git2.h>
#include <assert.h>
#include <stdio.h>
int
main ()
{
int err;
err = git_libgit2_init ();
assert (err == 1);
git_clone_options opts;
err = git_clone_init_options (&opts, GIT_CLONE_OPTIONS_VERSION);
assert (err == 0);
err = git_libgit2_opts (GIT_OPT_SET_SERVER_TIMEOUT, 1);
assert (err == 0);
git_repository *repo;
err = git_clone (&repo, "https://git.guix.gnu.org/guix.git", "/tmp/example",
&opts);
assert (err != 0);
const git_error *gerr;
gerr = giterr_last ();
fprintf (stderr, "last error: %s\n", gerr->message);
return 0;
}
When running it (using libgit2 1.9.2 on Linux, with the OpenSSL backend), I get:
last error: SSL error: syscall failure: Resource temporarily unavailable
... which is somewhat confusing.
Here's what we see from strace:
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("46.224.9.33")}, 16) = 0
fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
...
sendto(3, "\26\3\1\6\4\1\0\6\0\3\3m\205\362N]I5|\3452\341b\v\316`9'*/\225?"..., 1545, 0, NULL, 0) = 1545
recvfrom(3, 0x19d1853, 5, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}], 1, 1) = 0 (Timeout)
close(3) = 0
This corresponds to socket_read, calling recv then poll.
The issue here is that the error reported ("Resource temporarily available") is the wrong one; it should say "Timeout" (or similar). socket_read does try to convey that error but it gets lost in the abstraction layers (BIO, streams, etc.).
- 主要语言
- C
- 星标
- 10.6k
- 派生
- 2.7k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
libgit2/libgit2 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 62/100
-
难度 2/5 1-3 小时 新手友好度 74/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 90/100
kovidgoyal/kitty#10516 ·
-
难度 1/5 1 小时以内 新手友好度 80/100
-
难度 2/5 1-3 小时 新手友好度 78/100
zephyrproject-rtos/zephyr#120011 ·