{"action":"created","issue":{"url":"https://api.github.com/repos/spark/firmware/issues/740","labels_url":"https://api.github.com/repos/spark/firmware/issues/740/labels{/name}","comments_url":"https://api.github.com/repos/spark/firmware/issues/740/comments","events_url":"https://api.github.com/repos/spark/firmware/issues/740/events","html_url":"https://github.com/spark/firmware/pull/740","id":117442009,"number":740,"title":"Ensure socket exists before removing it when closing in socket_hal","user":{"login":"kierangraham","id":32330,"avatar_url":"https://avatars.githubusercontent.com/u/32330?v=3","gravatar_id":"","url":"https://api.github.com/users/kierangraham","html_url":"https://github.com/kierangraham","followers_url":"https://api.github.com/users/kierangraham/followers","following_url":"https://api.github.com/users/kierangraham/following{/other_user}","gists_url":"https://api.github.com/users/kierangraham/gists{/gist_id}","starred_url":"https://api.github.com/users/kierangraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kierangraham/subscriptions","organizations_url":"https://api.github.com/users/kierangraham/orgs","repos_url":"https://api.github.com/users/kierangraham/repos","events_url":"https://api.github.com/users/kierangraham/events{/privacy}","received_events_url":"https://api.github.com/users/kierangraham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/spark/firmware/milestones/14","html_url":"https://github.com/spark/firmware/milestones/0.4.8","labels_url":"https://api.github.com/repos/spark/firmware/milestones/14/labels","id":1365530,"number":14,"title":"0.4.8","description":"","creator":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":1,"state":"open","created_at":"2015-10-20T06:04:41Z","updated_at":"2015-12-02T09:44:42Z","due_on":"2016-10-03T22:00:00Z","closed_at":null},"comments":8,"created_at":"2015-11-17T20:22:26Z","updated_at":"2015-12-02T09:52:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/spark/firmware/pulls/740","html_url":"https://github.com/spark/firmware/pull/740","diff_url":"https://github.com/spark/firmware/pull/740.diff","patch_url":"https://github.com/spark/firmware/pull/740.patch"},"body":"We've have had an ongoing issue where once our Photon reconnects to WiFi it immediately hangs whilst breathing cyan.\r\n\r\nInside our application we make use of a UDP socket which once the WiFi connection comes up seems to be a stale resource no longer within `this->items` and once execution enters the following `while` block, hangs forever.\r\n\r\nOur Lead Firmware Engineer (@mhazley) has [documented this on the forum](https://community.particle.io/t/photon-v0-4-7-hanging-in-udp-stop/17553) and managed to catch this in the debugger and it's looking very likely that the root of our issue is from recycling the socket every 30s (internal detail of our application) _after_ a WiFi disconnect / reconnect has happened.\r\n\r\n**Work Done**\r\n\r\n* [x] Check that a `socket_t` exists before attempting to remove it, otherwise `return false`"},"comment":{"url":"https://api.github.com/repos/spark/firmware/issues/comments/161242222","html_url":"https://github.com/spark/firmware/pull/740#issuecomment-161242222","issue_url":"https://api.github.com/repos/spark/firmware/issues/740","id":161242222,"user":{"login":"mhazley","id":6282802,"avatar_url":"https://avatars.githubusercontent.com/u/6282802?v=3","gravatar_id":"","url":"https://api.github.com/users/mhazley","html_url":"https://github.com/mhazley","followers_url":"https://api.github.com/users/mhazley/followers","following_url":"https://api.github.com/users/mhazley/following{/other_user}","gists_url":"https://api.github.com/users/mhazley/gists{/gist_id}","starred_url":"https://api.github.com/users/mhazley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhazley/subscriptions","organizations_url":"https://api.github.com/users/mhazley/orgs","repos_url":"https://api.github.com/users/mhazley/repos","events_url":"https://api.github.com/users/mhazley/events{/privacy}","received_events_url":"https://api.github.com/users/mhazley/received_events","type":"User","site_admin":false},"created_at":"2015-12-02T09:52:19Z","updated_at":"2015-12-02T09:52:19Z","body":"Thanks @m-mcgowan - I'm going to try and get a look at them today actually so will add to this PR either myself or via @kierangraham "}}