{"action":"created","issue":{"url":"https://api.github.com/repos/chriskohlhoff/asio/issues/154","repository_url":"https://api.github.com/repos/chriskohlhoff/asio","labels_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/154/comments","events_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/154/events","html_url":"https://github.com/chriskohlhoff/asio/issues/154","id":187749234,"number":154,"title":"socket_.async_read_some: less data than expected returned when callback invoked","user":{"login":"paralleld","id":11344292,"avatar_url":"https://avatars.githubusercontent.com/u/11344292?v=3","gravatar_id":"","url":"https://api.github.com/users/paralleld","html_url":"https://github.com/paralleld","followers_url":"https://api.github.com/users/paralleld/followers","following_url":"https://api.github.com/users/paralleld/following{/other_user}","gists_url":"https://api.github.com/users/paralleld/gists{/gist_id}","starred_url":"https://api.github.com/users/paralleld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paralleld/subscriptions","organizations_url":"https://api.github.com/users/paralleld/orgs","repos_url":"https://api.github.com/users/paralleld/repos","events_url":"https://api.github.com/users/paralleld/events{/privacy}","received_events_url":"https://api.github.com/users/paralleld/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-07T15:56:56Z","updated_at":"2017-02-05T11:44:24Z","closed_at":"2016-12-09T02:33:16Z","body":"I meet a problem when using socket.async_read_some  in my application.  I use asio to build a proxy,  part of which converts a private protocol to redis protocol. Everything is OK with sending requests to remote redis server, but something went wrong when reading responses to these request from remote redis servers. \r\n\r\nThe responses of all requests are supposed to be \":1\\r\\n\".But when cpu usage of the proxy comes to 90%  , (meanwhile remote redis servers process ~7200 requests per second, and the size of each request is around ~2k bytes) the invoked callback of socket_.async_read_some (**socket_** connects to remote redis, and **aysnc_read_some** read responses)  returns \"1\\r\\n\" of size 3.  This invalid response does not occur very often , ~10 in 10m redis requests.   I use tcpdump to capture packets, but never see packet of size 3.  Actually , all packets of redis responses are of size 4. In other words, with tcpdump, I saw no reponse of size 4, but async_read_some returns an invalid response of size 3. \r\n\r\nI don't know why this happened.  I am wondering if it's related to the read buffer mechanism of asio, or it's a bug.  "},"comment":{"url":"https://api.github.com/repos/chriskohlhoff/asio/issues/comments/277514549","html_url":"https://github.com/chriskohlhoff/asio/issues/154#issuecomment-277514549","issue_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/154","id":277514549,"user":{"login":"paralleld","id":11344292,"avatar_url":"https://avatars.githubusercontent.com/u/11344292?v=3","gravatar_id":"","url":"https://api.github.com/users/paralleld","html_url":"https://github.com/paralleld","followers_url":"https://api.github.com/users/paralleld/followers","following_url":"https://api.github.com/users/paralleld/following{/other_user}","gists_url":"https://api.github.com/users/paralleld/gists{/gist_id}","starred_url":"https://api.github.com/users/paralleld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paralleld/subscriptions","organizations_url":"https://api.github.com/users/paralleld/orgs","repos_url":"https://api.github.com/users/paralleld/repos","events_url":"https://api.github.com/users/paralleld/events{/privacy}","received_events_url":"https://api.github.com/users/paralleld/received_events","type":"User","site_admin":false},"created_at":"2017-02-05T11:44:24Z","updated_at":"2017-02-05T11:44:24Z","body":"@arun11299  Implementation issue"}}
{"actor":{"display_login":"paralleld"}}