{"action":"created","issue":{"url":"https://api.github.com/repos/espruino/Espruino/issues/809","repository_url":"https://api.github.com/repos/espruino/Espruino","labels_url":"https://api.github.com/repos/espruino/Espruino/issues/809/labels{/name}","comments_url":"https://api.github.com/repos/espruino/Espruino/issues/809/comments","events_url":"https://api.github.com/repos/espruino/Espruino/issues/809/events","html_url":"https://github.com/espruino/Espruino/issues/809","id":135657895,"number":809,"title":"http server runs out of sockets","user":{"login":"tve","id":39480,"avatar_url":"https://avatars.githubusercontent.com/u/39480?v=3","gravatar_id":"","url":"https://api.github.com/users/tve","html_url":"https://github.com/tve","followers_url":"https://api.github.com/users/tve/followers","following_url":"https://api.github.com/users/tve/following{/other_user}","gists_url":"https://api.github.com/users/tve/gists{/gist_id}","starred_url":"https://api.github.com/users/tve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tve/subscriptions","organizations_url":"https://api.github.com/users/tve/orgs","repos_url":"https://api.github.com/users/tve/repos","events_url":"https://api.github.com/users/tve/events{/privacy}","received_events_url":"https://api.github.com/users/tve/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/espruino/Espruino/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/espruino/Espruino/labels/ESP8266","name":"ESP8266","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-02-23T07:17:35Z","updated_at":"2016-06-25T02:04:16Z","closed_at":null,"body":"Reported by Wilberforce:\r\n\r\nWhen testing and debugging, after a while to http server code fails to start with an out of sockets error.\r\nThis happens after a number of uploads from the web ide.\r\nI believe it is due to the old http server sessions not shutting down properly.\r\nI have my board set up so it auto joins my local wifi.\r\nAt the moment I just hit the reset button on the board, and re upload, however it would be handy to shutdown the connections cleanly. Can this be down with an E.event on after a .reset?\r\nWifi.disconnect and wifi.connect() does do the job, however it would be great if an event could trigger."},"comment":{"url":"https://api.github.com/repos/espruino/Espruino/issues/comments/228501296","html_url":"https://github.com/espruino/Espruino/issues/809#issuecomment-228501296","issue_url":"https://api.github.com/repos/espruino/Espruino/issues/809","id":228501296,"user":{"login":"wilberforce","id":5050824,"avatar_url":"https://avatars.githubusercontent.com/u/5050824?v=3","gravatar_id":"","url":"https://api.github.com/users/wilberforce","html_url":"https://github.com/wilberforce","followers_url":"https://api.github.com/users/wilberforce/followers","following_url":"https://api.github.com/users/wilberforce/following{/other_user}","gists_url":"https://api.github.com/users/wilberforce/gists{/gist_id}","starred_url":"https://api.github.com/users/wilberforce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilberforce/subscriptions","organizations_url":"https://api.github.com/users/wilberforce/orgs","repos_url":"https://api.github.com/users/wilberforce/repos","events_url":"https://api.github.com/users/wilberforce/events{/privacy}","received_events_url":"https://api.github.com/users/wilberforce/received_events","type":"User","site_admin":false},"created_at":"2016-06-25T02:04:16Z","updated_at":"2016-06-25T02:04:16Z","body":"Ahh - worked out how to reproduce....\r\n\r\nIt's when you get an inbound connection, while the script is being up loaded. So this naturally when you are using web sockets -as  there is a regular heartbeat.\r\n\r\nSo start the ide upload and refresh the browser.... after a few iterations, the `socketArray` is full:\r\n\r\n```\r\n\r\nERROR: Unable to create socket\r\n179518> === socket 1 type=server, txBuf=0x00000000, state=idle, espconn=0x3fff9158, err=0, rx:\r\n179526> === socket 30 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=-5, rx: 416@0x3fffa9e8\r\n179536> === socket 31 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx:\r\n179545> === socket 46 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx: 416@0x3fffad48\r\n179555> === socket 47 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx:\r\n179563> === socket 50 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx: 416@0x3fffab98\r\n179573> === socket 52 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx: 416@0x3fffaef8\r\n179584> === socket 54 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx: 416@0x3fffb0a8\r\n179594> === socket 55 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx: 416@0x3fffb258\r\n179604> === socket 57 type=inbound, txBuf=0x00000000, state=closing, espconn=0x00000000, err=0, rx: 416@0x3fffb408\r\n```"}}
{"actor":{"display_login":"wilberforce"}}