{"action":"created","issue":{"url":"https://api.github.com/repos/criticalstack/libevhtp/issues/100","repository_url":"https://api.github.com/repos/criticalstack/libevhtp","labels_url":"https://api.github.com/repos/criticalstack/libevhtp/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/criticalstack/libevhtp/issues/100/comments","events_url":"https://api.github.com/repos/criticalstack/libevhtp/issues/100/events","html_url":"https://github.com/criticalstack/libevhtp/issues/100","id":339129845,"node_id":"MDU6SXNzdWUzMzkxMjk4NDU=","number":100,"title":"How to increase and decrease number of threads in thread pool","user":{"login":"tanyifeng","id":28038581,"node_id":"MDQ6VXNlcjI4MDM4NTgx","avatar_url":"https://avatars0.githubusercontent.com/u/28038581?v=4","gravatar_id":"","url":"https://api.github.com/users/tanyifeng","html_url":"https://github.com/tanyifeng","followers_url":"https://api.github.com/users/tanyifeng/followers","following_url":"https://api.github.com/users/tanyifeng/following{/other_user}","gists_url":"https://api.github.com/users/tanyifeng/gists{/gist_id}","starred_url":"https://api.github.com/users/tanyifeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanyifeng/subscriptions","organizations_url":"https://api.github.com/users/tanyifeng/orgs","repos_url":"https://api.github.com/users/tanyifeng/repos","events_url":"https://api.github.com/users/tanyifeng/events{/privacy}","received_events_url":"https://api.github.com/users/tanyifeng/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-07-07T08:50:25Z","updated_at":"2018-07-09T03:53:14Z","closed_at":null,"author_association":"NONE","body":"# Details\r\nI'm trying to manage threads pool according to number of http requests. Intend to assign a thread for every reqeust, and the thread can exit when it finished handle the request. \r\n\r\n# Steps or code to reproduce the problem.\r\nUsing current libevhtp version, we will hang in such case:\r\n## Use EVTHR_SHARED_PIPE mode.\r\nWhen the number of concurrent requests is more than the thread numbers we set, It will block the rest reqeust if no callback in all thread is returned.\r\n\r\n## Not use EVTHR_SHARED_PIPE mode.\r\nAccording to  code in [thread.c](https://github.com/criticalstack/libevhtp/blob/6cb403a74866c4cfd0b8fbe00e02851d3019a9fa/thread.c#L349), we always distribute reqeust `(n % num_threads)` to the same thread, if one callback is blocked, the following reqeusts will all been blocked.\r\n\r\n# Version\r\nLatest version\r\n\r\nCan you give me some advice for such purpose. Since [event_base_loop](https://github.com/criticalstack/libevhtp/blob/6cb403a74866c4cfd0b8fbe00e02851d3019a9fa/thread.c#L121) will not exit if it has finished one request, and also I can not find a way to check if event base is finished one request or not."},"comment":{"url":"https://api.github.com/repos/criticalstack/libevhtp/issues/comments/403352563","html_url":"https://github.com/criticalstack/libevhtp/issues/100#issuecomment-403352563","issue_url":"https://api.github.com/repos/criticalstack/libevhtp/issues/100","id":403352563,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzM1MjU2Mw==","user":{"login":"NathanFrench","id":28454863,"node_id":"MDQ6VXNlcjI4NDU0ODYz","avatar_url":"https://avatars3.githubusercontent.com/u/28454863?v=4","gravatar_id":"","url":"https://api.github.com/users/NathanFrench","html_url":"https://github.com/NathanFrench","followers_url":"https://api.github.com/users/NathanFrench/followers","following_url":"https://api.github.com/users/NathanFrench/following{/other_user}","gists_url":"https://api.github.com/users/NathanFrench/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanFrench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanFrench/subscriptions","organizations_url":"https://api.github.com/users/NathanFrench/orgs","repos_url":"https://api.github.com/users/NathanFrench/repos","events_url":"https://api.github.com/users/NathanFrench/events{/privacy}","received_events_url":"https://api.github.com/users/NathanFrench/received_events","type":"User","site_admin":false},"created_at":"2018-07-09T03:53:14Z","updated_at":"2018-07-09T03:53:14Z","author_association":"MEMBER","body":"Auto-scaling threads sound like a great idea. I will start working on it in the morning."}}
{"actor":{"display_login":"NathanFrench"}}