Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket poll 失败,errno 为11,后续进行断点续传errno一直为11 #224

Open
xzza52592 opened this issue Aug 29, 2023 · 1 comment

Comments

@xzza52592
Copy link

描述问题详情

将tbox库编译为arm版本在android上执行下载华为云OBS文件,偶发在socket_poll.c的函数tb_socket_wait_impl中, poll数据失败,此时打印errno为11,后续继续调用下载,errno一直报11,重置当前的网络(切换4G到5G或者开关网络)就可以继续下载。无法下载时,使用libcurl可以正常下载,libcurl下载结束后再调用tbox的下载又恢复正常。

###期望结果
偶发11失败是正常的,但是后续应该可以正常进行断点续传下载

###其他信息
在使用tbox的下载失败时,更换其他的文件(非华为云OBS文件)可以正常下载。libcurl下载也会失败,但是下载失败后继续调用libcurl的下载仍然能够正常下载。

###主要代码:
##下载代码
istream = tb_stream_init_from_url(url);
if (!tb_stream_ctrl(istream, TB_STREAM_CTRL_HTTP_SET_HEAD_FUNC, ota_mgr_stream_head_func)) {
tb_print("TB_STREAM_CTRL_HTTP_SET_HEAD_FUNC ctrl failed\n");
break;
}
if (!tb_stream_ctrl(istream, TB_STREAM_CTRL_HTTP_SET_HEAD, "Connection", "keep-alive")) {
tb_print("TB_STREAM_CTRL_HTTP_SET_HEAD ctrl failed\n");
break;
}
if (!tb_stream_ctrl(istream, TB_STREAM_CTRL_HTTP_SET_RANGE, break_point, -1)) {
tb_print("TB_STREAM_CTRL_HTTP_SET_RANGE ctrl failed\n");
break;
}
if (!tb_stream_ctrl(istream, TB_STREAM_CTRL_SET_TIMEOUT, timeout)) {
tb_print("TB_STREAM_CTRL_SET_TIMEOUT ctrl failed\n");
break;
}
if (!tb_stream_open(istream)) { ### 后续调用下载时的出错
tb_printf("[ota_sdk] open: %s\n", tb_state_cstr(tb_stream_state(istream)));
break;
}

###tb_socket_wait_impl()
// poll
tb_long_t r = poll(&pfd, 1, timeout);

// timeout or interrupted?
if (!r || (r == -1 && errno == EINTR)) {
    tb_printf("error is %d\n", errno);   ### errno 为11
    return 0;
}

希望能够提供一下排查问题的思路,是华为云OBS的问题还是可能是由于socket未完全释放,亦或者是tb_stream_ctrl配置的参数不够。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: socket poll failed, errno is 11, subsequent breakpoint resuming errno is always 11

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

No branches or pull requests

2 participants