{"action":"closed","issue":{"url":"https://api.github.com/repos/mirage/mirage-tcpip/issues/105","labels_url":"https://api.github.com/repos/mirage/mirage-tcpip/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/mirage/mirage-tcpip/issues/105/comments","events_url":"https://api.github.com/repos/mirage/mirage-tcpip/issues/105/events","html_url":"https://github.com/mirage/mirage-tcpip/issues/105","id":56711314,"number":105,"title":"Missing error paths in `write`","user":{"login":"pqwy","id":325535,"avatar_url":"https://avatars.githubusercontent.com/u/325535?v=3","gravatar_id":"","url":"https://api.github.com/users/pqwy","html_url":"https://github.com/pqwy","followers_url":"https://api.github.com/users/pqwy/followers","following_url":"https://api.github.com/users/pqwy/following{/other_user}","gists_url":"https://api.github.com/users/pqwy/gists{/gist_id}","starred_url":"https://api.github.com/users/pqwy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pqwy/subscriptions","organizations_url":"https://api.github.com/users/pqwy/orgs","repos_url":"https://api.github.com/users/pqwy/repos","events_url":"https://api.github.com/users/pqwy/events{/privacy}","received_events_url":"https://api.github.com/users/pqwy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-05T18:44:47Z","updated_at":"2015-06-10T14:50:46Z","closed_at":"2015-06-10T14:50:46Z","body":"TCP, being a `FLOW`, has a write function whose [type](https://github.com/mirage/mirage/blob/master/types/V1.mli#L156) allows for signalling of errors.\r\n\r\nBut the actual [implementation](https://github.com/mirage/mirage-tcpip/blob/master/tcp/flow.ml#L54) of `write` doesn't seem to attempt to do so.\r\n\r\nTherefore, when a unikernel connects via TCP and starts writing, if the other end closes the connection, the `write` hangs indefinitely somewhere below [`Pcb.write_wait_for`](https://github.com/mirage/mirage-tcpip/blob/master/tcp/pcb.ml#L501), even after the lower level decides to [give up](https://github.com/mirage/mirage-tcpip/blob/master/tcp/segment.ml#L260).\r\n\r\nI also hit upon a memory leak with a unikernel that just keeps sending logs over TCP, but so far I failed to come up with a minimal case that reproduces this. I believe it's the hung writes keeping the buffer they've been given alive."}}