{"action":"created","issue":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/2854","repository_url":"https://api.github.com/repos/syncthing/syncthing","labels_url":"https://api.github.com/repos/syncthing/syncthing/issues/2854/labels{/name}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/2854/comments","events_url":"https://api.github.com/repos/syncthing/syncthing/issues/2854/events","html_url":"https://github.com/syncthing/syncthing/issues/2854","id":142109422,"number":2854,"title":"/rest/system/status returns empty response during startup","user":{"login":"canton7","id":568104,"avatar_url":"https://avatars.githubusercontent.com/u/568104?v=3","gravatar_id":"","url":"https://api.github.com/users/canton7","html_url":"https://github.com/canton7","followers_url":"https://api.github.com/users/canton7/followers","following_url":"https://api.github.com/users/canton7/following{/other_user}","gists_url":"https://api.github.com/users/canton7/gists{/gist_id}","starred_url":"https://api.github.com/users/canton7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/canton7/subscriptions","organizations_url":"https://api.github.com/users/canton7/orgs","repos_url":"https://api.github.com/users/canton7/repos","events_url":"https://api.github.com/users/canton7/events{/privacy}","received_events_url":"https://api.github.com/users/canton7/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":78,"created_at":"2016-03-19T22:58:29Z","updated_at":"2016-04-05T14:30:09Z","closed_at":"2016-04-05T05:12:20Z","body":"Syncthing version 0.12.20 (although it's been around since at least the beginning of February).\r\n\r\nDuring startup, the `/rest/system/status` endpoint can return an empty response (seems to happen more on some devices than others).\r\n\r\nThe headers returned are:\r\n\r\n```\r\n  Access-Control-Allow-Origin: *\r\n  Pragma: no-cache\r\n  X-Syncthing-Id: IDIDIID-IDIDID-IDIDID-IDIDID-IDIDID-IDIDID-IDIDID-IDIDID\r\n  X-Syncthing-Version: v0.12.20\r\n  Cache-Control: no-store, no-cache, max-age=0\r\n  Date: Sat, 19 Mar 2016 22:40:58 GMT\r\n  Content-Length: 0\r\n  Content-Type: application/json; charset=utf-8\r\n  Expires: Sat, 19 Mar 2016 22:40:58 GMT\r\n```\r\n\r\nOf particular interest is the `Content-Length: 0`. I had a quick look through the code but couldn't see why it might be doing this. I fetch the `/rest/system/version` resource milliseconds afterwards and that returns the correct data.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/comments/205833860","html_url":"https://github.com/syncthing/syncthing/issues/2854#issuecomment-205833860","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/2854","id":205833860,"user":{"login":"dinosore","id":11523591,"avatar_url":"https://avatars.githubusercontent.com/u/11523591?v=3","gravatar_id":"","url":"https://api.github.com/users/dinosore","html_url":"https://github.com/dinosore","followers_url":"https://api.github.com/users/dinosore/followers","following_url":"https://api.github.com/users/dinosore/following{/other_user}","gists_url":"https://api.github.com/users/dinosore/gists{/gist_id}","starred_url":"https://api.github.com/users/dinosore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinosore/subscriptions","organizations_url":"https://api.github.com/users/dinosore/orgs","repos_url":"https://api.github.com/users/dinosore/repos","events_url":"https://api.github.com/users/dinosore/events{/privacy}","received_events_url":"https://api.github.com/users/dinosore/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T14:30:09Z","updated_at":"2016-04-05T14:30:09Z","body":"Perhaps it is.  But that's not the point.  Basic defensive programming techniques should be employed where practicable.\r\n\r\nIn my opinion, in this case, defensive programming trumps \"if it ain't broke, don't fix it\".\r\n\r\nThe changes are minimal with no ill effect.  It is impossible to prove via testing that they are not needed as timer resolution is likely to be hardware dependent.\r\n\r\nI can't see the case for not making the changes as we are not yet in a production release (1.0).\r\n"}}