{"action":"created","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/2097","repository_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/2097/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/2097/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/2097/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/pull/2097","id":256161346,"number":2097,"title":"Fix data loss in TCP streams.","user":{"login":"jmattsson","id":869607,"avatar_url":"https://avatars0.githubusercontent.com/u/869607?v=4","gravatar_id":"","url":"https://api.github.com/users/jmattsson","html_url":"https://github.com/jmattsson","followers_url":"https://api.github.com/users/jmattsson/followers","following_url":"https://api.github.com/users/jmattsson/following{/other_user}","gists_url":"https://api.github.com/users/jmattsson/gists{/gist_id}","starred_url":"https://api.github.com/users/jmattsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmattsson/subscriptions","organizations_url":"https://api.github.com/users/jmattsson/orgs","repos_url":"https://api.github.com/users/jmattsson/repos","events_url":"https://api.github.com/users/jmattsson/events{/privacy}","received_events_url":"https://api.github.com/users/jmattsson/received_events","type":"User","site_admin":false},"labels":[{"id":510509761,"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/labels/bugfix","name":"bugfix","color":"fc2929","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/milestones/8","html_url":"https://github.com/nodemcu/nodemcu-firmware/milestone/8","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/milestones/8/labels","id":2721697,"number":8,"title":"2.1 follow-up II","description":"","creator":{"login":"marcelstoer","id":624195,"avatar_url":"https://avatars0.githubusercontent.com/u/624195?v=4","gravatar_id":"","url":"https://api.github.com/users/marcelstoer","html_url":"https://github.com/marcelstoer","followers_url":"https://api.github.com/users/marcelstoer/followers","following_url":"https://api.github.com/users/marcelstoer/following{/other_user}","gists_url":"https://api.github.com/users/marcelstoer/gists{/gist_id}","starred_url":"https://api.github.com/users/marcelstoer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcelstoer/subscriptions","organizations_url":"https://api.github.com/users/marcelstoer/orgs","repos_url":"https://api.github.com/users/marcelstoer/repos","events_url":"https://api.github.com/users/marcelstoer/events{/privacy}","received_events_url":"https://api.github.com/users/marcelstoer/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":5,"state":"open","created_at":"2017-08-24T19:20:03Z","updated_at":"2017-10-05T22:31:42Z","due_on":"2017-10-31T07:00:00Z","closed_at":null},"comments":1,"created_at":"2017-09-08T07:12:09Z","updated_at":"2017-10-09T05:26:42Z","closed_at":"2017-09-28T20:41:22Z","author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/2097","html_url":"https://github.com/nodemcu/nodemcu-firmware/pull/2097","diff_url":"https://github.com/nodemcu/nodemcu-firmware/pull/2097.diff","patch_url":"https://github.com/nodemcu/nodemcu-firmware/pull/2097.patch"},"body":"- [x] This PR is for the `dev` branch rather than for `master`.\r\n- [x] This PR is compliant with the [other contributing guidelines](https://github.com/nodemcu/nodemcu-firmware/blob/dev/CONTRIBUTING.md) as well (if not, please describe why).\r\n- [x] I have thoroughly tested my contribution.\r\n- [n/a] The code changes are reflected in the documentation at `docs/en/*`.\r\n\r\nSo it turns out that very occasionally^ the lwip stack hands over chained `pbuf`s to the `tcp_recv()` callback. As only the first `pbuf` in the chain was passed into Lua, this meant that data went missing from the middle of the TCP stream (which one would certainly *not* expect). The fix here is to simply do multiple callbacks into Lua until the end of the chain is reached (though I've never seen more than two `pbuf`s in the chain so far).\r\n\r\nWith this patch I'm now always successfully getting the full TCP stream, whereas before I never did.\r\n\r\n^) During each 1meg transfer, I saw it happen 1-4 times."},"comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments/335068904","html_url":"https://github.com/nodemcu/nodemcu-firmware/pull/2097#issuecomment-335068904","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/2097","id":335068904,"user":{"login":"jmattsson","id":869607,"avatar_url":"https://avatars0.githubusercontent.com/u/869607?v=4","gravatar_id":"","url":"https://api.github.com/users/jmattsson","html_url":"https://github.com/jmattsson","followers_url":"https://api.github.com/users/jmattsson/followers","following_url":"https://api.github.com/users/jmattsson/following{/other_user}","gists_url":"https://api.github.com/users/jmattsson/gists{/gist_id}","starred_url":"https://api.github.com/users/jmattsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmattsson/subscriptions","organizations_url":"https://api.github.com/users/jmattsson/orgs","repos_url":"https://api.github.com/users/jmattsson/repos","events_url":"https://api.github.com/users/jmattsson/events{/privacy}","received_events_url":"https://api.github.com/users/jmattsson/received_events","type":"User","site_admin":false},"created_at":"2017-10-09T05:26:42Z","updated_at":"2017-10-09T05:26:42Z","author_association":"COLLABORATOR","body":"Afaiu mqtt uses espconn, so this shouldn't be applicable there. Someone is welcome to prove me wrong though :)"}}
{"actor":{"display_login":"jmattsson"}}