{"action":"created","issue":{"url":"https://api.github.com/repos/warmcat/libwebsockets/issues/1449","repository_url":"https://api.github.com/repos/warmcat/libwebsockets","labels_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/1449/labels{/name}","comments_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/1449/comments","events_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/1449/events","html_url":"https://github.com/warmcat/libwebsockets/issues/1449","id":380578026,"node_id":"MDU6SXNzdWUzODA1NzgwMjY=","number":1449,"title":"close for timeout when request, use foreign loops","user":{"login":"zw-git","id":14001308,"node_id":"MDQ6VXNlcjE0MDAxMzA4","avatar_url":"https://avatars3.githubusercontent.com/u/14001308?v=4","gravatar_id":"","url":"https://api.github.com/users/zw-git","html_url":"https://github.com/zw-git","followers_url":"https://api.github.com/users/zw-git/followers","following_url":"https://api.github.com/users/zw-git/following{/other_user}","gists_url":"https://api.github.com/users/zw-git/gists{/gist_id}","starred_url":"https://api.github.com/users/zw-git/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zw-git/subscriptions","organizations_url":"https://api.github.com/users/zw-git/orgs","repos_url":"https://api.github.com/users/zw-git/repos","events_url":"https://api.github.com/users/zw-git/events{/privacy}","received_events_url":"https://api.github.com/users/zw-git/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-14T08:01:25Z","updated_at":"2018-11-14T08:10:39Z","closed_at":null,"author_association":"NONE","body":"## Libwebsockets close the connection when a http request comes after 5 seconds from the previous request, and i use the foreign loops.\r\n* backtrack:\r\n```\r\n#0  __lws_service_timeout_check (sec=1541729096, wsi=0x2a252e0) at /source/libwebsockets/lib/core/service.c:231\r\n#1  lws_service_periodic_checks (context=context@entry=0x2a46950, pollfd=pollfd@entry=0x7ffe4b8230d0, tsi=tsi@entry=0) at /source/libwebsockets/lib/core/service.c:643\r\n#2  0x00007f27da5d326f in lws_service_fd_tsi (context=context@entry=0x2a46950, pollfd=pollfd@entry=0x7ffe4b8230d0, tsi=tsi@entry=0) at /source/libwebsockets/lib/core/service.c:829\r\n#3  0x00007f27da5ef293 in lws_accept_cb (loop=<optimized out>, watcher=<optimized out>, revents=<optimized out>) at /source/libwebsockets/lib/event-libs/libev/libev.c:104\r\n#4  0x00000000006cc044 in ev_invoke_pending (loop=0xb13400 <default_loop_struct>) at /source/tarantool/third_party/libev/ev.c:3347\r\n#5  0x00000000006ccf33 in ev_run (loop=0xb13400 <default_loop_struct>, flags=0) at /source/tarantool/third_party/libev/ev.c:3750\r\n#6  0x000000000040fee9 in main (argc=3, argv=0x29efcd8) at /source/tarantool/src/main.cc:769\r\n```\r\n* log：\r\n```\r\n[2018/11/08 16:54:53:6792] INFO: lws_http_transaction_completed: 0x251f3f0: keep-alive await new transaction\r\n[2018/11/08 16:54:53:6792] DEBUG: _lws_change_pollfd: wsi 0x251f3f0: fd 31 events 1 -> 5\r\n[2018/11/08 16:54:53:6793] DEBUG: rops_handle_POLLIN_h1: 0x251f3f0: wsistate 0x2000010f\r\n[2018/11/08 16:54:53:6793] DEBUG: _lws_change_pollfd: wsi 0x251f3f0: fd 31 events 5 -> 1\r\n[2018/11/08 16:54:53:6793] DEBUG: lws_h1_server_socket_service: LRS_DEFERRING_ACTION now writable\r\n[2018/11/08 16:54:53:6793] DEBUG: lwsi_set_state(0x251f3f0, 0x20000117)\r\n[2018/11/08 16:54:53:6793] DEBUG: _lws_change_pollfd: wsi 0x251f3f0: fd 31 events 1 -> 1\r\n[2018/11/08 16:55:08:5417] INFO: __lws_close_free_wsi: 0x251f3f0: caller: timeout\r\n[2018/11/08 16:55:08:5417] DEBUG: __lws_close_free_wsi: real just_kill_connection: 0x251f3f0 (sockfd 31)\r\n[2018/11/08 16:55:08:5417] INFO: lws_same_vh_protocol_remove: removing same prot wsi 0x251f3f0\r\n[2018/11/08 16:55:08:5417] INFO: have prev 0x251eae0, setting him to our next (nil)\r\n[2018/11/08 16:55:08:5417] DEBUG: __remove_wsi_socket_from_fds: wsi=0x251f3f0, sock=31, fds pos=2, end guy pos=3, endfd=33\r\n[2018/11/08 16:55:08:5417] DEBUG: _lws_change_pollfd: wsi 0x26b6930: fd 26 events 1 -> 1\r\n[2018/11/08 16:55:08:5418] DEBUG: lwsi_set_state(0x251f3f0, 0x2000001e)\r\n[2018/11/08 16:55:08:5418] INFO: rops_destroy_role_h1: ah det due to close\r\n[2018/11/08 16:55:08:5418] DEBUG: __lws_free_wsi: 0x251f3f0, remaining wsi 2\r\n[2018/11/08 16:56:00:8820] DEBUG: accepted new conn port 64294 on fd=31\r\n```\r\n* strace log\r\n```\r\nepoll_wait(6, [], 64, 468) = 0 <0.468520>\r\nepoll_wait(6, [], 64, 1) = 0 <0.004863>\r\nepoll_wait(6, [{EPOLLIN, {u32=32, u64=682899800096}}], 64, 526) = 1 <0.391351>\r\nclose(32)               = 0 <0.000105>\r\nepoll_wait(6, [], 64, 0) = 0 <0.000009>\r\nepoll_wait(6, [], 64, 134) = 0 <0.134171>\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/warmcat/libwebsockets/issues/comments/438574114","html_url":"https://github.com/warmcat/libwebsockets/issues/1449#issuecomment-438574114","issue_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/1449","id":438574114,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODU3NDExNA==","user":{"login":"zw-git","id":14001308,"node_id":"MDQ6VXNlcjE0MDAxMzA4","avatar_url":"https://avatars3.githubusercontent.com/u/14001308?v=4","gravatar_id":"","url":"https://api.github.com/users/zw-git","html_url":"https://github.com/zw-git","followers_url":"https://api.github.com/users/zw-git/followers","following_url":"https://api.github.com/users/zw-git/following{/other_user}","gists_url":"https://api.github.com/users/zw-git/gists{/gist_id}","starred_url":"https://api.github.com/users/zw-git/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zw-git/subscriptions","organizations_url":"https://api.github.com/users/zw-git/orgs","repos_url":"https://api.github.com/users/zw-git/repos","events_url":"https://api.github.com/users/zw-git/events{/privacy}","received_events_url":"https://api.github.com/users/zw-git/received_events","type":"User","site_admin":false},"created_at":"2018-11-14T08:10:39Z","updated_at":"2018-11-14T08:10:39Z","author_association":"NONE","body":"@lws-team \r\nNeed I check and close those timeout connections? And How?\r\nOr call __lws_set_timeout  before lws_service_periodic_checks ?\r\nOr something else?"}}
{"actor":{"display_login":"zw-git"}}