{"action":"created","issue":{"url":"https://api.github.com/repos/18F/tock/issues/179","labels_url":"https://api.github.com/repos/18F/tock/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/18F/tock/issues/179/comments","events_url":"https://api.github.com/repos/18F/tock/issues/179/events","html_url":"https://github.com/18F/tock/issues/179","id":87413169,"number":179,"title":"Streaming CSV API frequently fails","user":{"login":"shawnbot","id":113896,"avatar_url":"https://avatars.githubusercontent.com/u/113896?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnbot","html_url":"https://github.com/shawnbot","followers_url":"https://api.github.com/users/shawnbot/followers","following_url":"https://api.github.com/users/shawnbot/following{/other_user}","gists_url":"https://api.github.com/users/shawnbot/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnbot/subscriptions","organizations_url":"https://api.github.com/users/shawnbot/orgs","repos_url":"https://api.github.com/users/shawnbot/repos","events_url":"https://api.github.com/users/shawnbot/events{/privacy}","received_events_url":"https://api.github.com/users/shawnbot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/18F/tock/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-11T16:54:57Z","updated_at":"2015-06-24T23:16:08Z","closed_at":"2015-06-24T23:16:08Z","body":"The `/api/timecards_bulk.csv` API endpoint that @batemapf needs works locally (when served directly through Django), but frequently—not always—fails. I've traced the error back to [waitress](http://waitress.readthedocs.org/en/latest/), which raises the exception:\r\n\r\n```\r\nValueError: I/O operation on closed file.\r\n```\r\n\r\nI *think* what's happening here is that waitress is buffering the response internally (in this case, a CSV response body that may take a while to send) and timing out after 30 seconds, then closing the response before it can finish. [This waitress issue](https://github.com/Pylons/waitress/issues/67) suggests a similar problem.\r\n\r\nMy friendly colleagues in the #django Slack channel have suggested ditching waitress in favor of Gunicorn. SGTM, but I defer to somebody more familiar with that part of the stack."},"comment":{"url":"https://api.github.com/repos/18F/tock/issues/comments/115043072","html_url":"https://github.com/18F/tock/issues/179#issuecomment-115043072","issue_url":"https://api.github.com/repos/18F/tock/issues/179","id":115043072,"user":{"login":"batemapf","id":7645362,"avatar_url":"https://avatars.githubusercontent.com/u/7645362?v=3","gravatar_id":"","url":"https://api.github.com/users/batemapf","html_url":"https://github.com/batemapf","followers_url":"https://api.github.com/users/batemapf/followers","following_url":"https://api.github.com/users/batemapf/following{/other_user}","gists_url":"https://api.github.com/users/batemapf/gists{/gist_id}","starred_url":"https://api.github.com/users/batemapf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/batemapf/subscriptions","organizations_url":"https://api.github.com/users/batemapf/orgs","repos_url":"https://api.github.com/users/batemapf/repos","events_url":"https://api.github.com/users/batemapf/events{/privacy}","received_events_url":"https://api.github.com/users/batemapf/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T23:16:08Z","updated_at":"2015-06-24T23:16:08Z","body":"good to close.  getting very quick downloads too.  when we get the point of slowdowns again, we can reopen.  many thanks to @shawnbot and @jmcarp for your good work on this."}}