8000 运行教程中的parallel_wget遇到错误`ERROR! state = 1, error = 11` · Issue #135 · sogou/workflow · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

运行教程中的parallel_wget遇到错误ERROR! state = 1, error = 11 #135

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

Closed
duyixian1234 opened this issue Nov 2, 2020 · 6 comments
Closed

Comments

@duyixian1234
Copy link

背景

修改了一下tutorial-06-parallel_wget.cc的源码,同时发起1000个http请求(每个请求等待5秒后简单的返回hello world),前面的请求正常返回,后面的请求遇到了ERROR! state = 1, error = 11的错误。

在http服务里记录了请求数量,发现实际只有200个请求,似乎在哪里有请求数量限制。

问题

想知道这个错误的意义是什么,这个200个请求的限制是http client带来的还是并行任务处理器带来的。

@Barenboim
Copy link
Contributor

这个简单。state == SYS_ERROR, error = EAGAIN。说明没有连接可以用了。改一下global settings,把max_connections改到1000以上。这个值默认为200

@Barenboim
Copy link
Contributor
Barenboim commented Nov 2, 2020

struct WFGlobalSettings settings = GLOBAL_SETTINGS_DEFAULT;
settings.endpoint_params.max_connections = 1024;
WORKFLOW_library_init(&settings);

@Barenboim
Copy link
Contributor

这个参数指的是对单个ip:port的最大并发连接数,所以其实很少需要太大。

@Barenboim
Copy link
Contributor

补充一点,http server端模拟慢请求,不要在process里调用sleep函数,最好使用定时器任务:

void process(WFHttpTask *server_task)
{
    server_task->get_resp()->append_output_body(“Hello World!”);
    series_of(server_task)->push_back(WFTaskFactory::create_timer_task(5*1000*1000, nullptr));
}

以上代码实现一个延迟5秒返回的http server。等待时间不占用线程。

@duyixian1234
Copy link
Author

十分感谢。解决了问题。 @Barenboim

@chanchann
Copy link
Contributor

Experiment code here: https://github.com/chanchann/workflow_annotation/tree/main/demos/08_max_con

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

3 participants
0