{"action":"created","issue":{"url":"https://api.github.com/repos/tornadoweb/tornado/issues/1667","repository_url":"https://api.github.com/repos/tornadoweb/tornado","labels_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1667/labels{/name}","comments_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1667/comments","events_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1667/events","html_url":"https://github.com/tornadoweb/tornado/issues/1667","id":141903608,"number":1667,"title":"Error when yielding from concurrent.futures.Future ","user":{"login":"mrocklin","id":306380,"avatar_url":"https://avatars.githubusercontent.com/u/306380?v=3","gravatar_id":"","url":"https://api.github.com/users/mrocklin","html_url":"https://github.com/mrocklin","followers_url":"https://api.github.com/users/mrocklin/followers","following_url":"https://api.github.com/users/mrocklin/following{/other_user}","gists_url":"https://api.github.com/users/mrocklin/gists{/gist_id}","starred_url":"https://api.github.com/users/mrocklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrocklin/subscriptions","organizations_url":"https://api.github.com/users/mrocklin/orgs","repos_url":"https://api.github.com/users/mrocklin/repos","events_url":"https://api.github.com/users/mrocklin/events{/privacy}","received_events_url":"https://api.github.com/users/mrocklin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-18T15:46:25Z","updated_at":"2016-03-22T15:28:54Z","closed_at":null,"body":"When yielding from a `concurrent.futures.Future` I get this exception:\r\n\r\n```python\r\nyield thread_pool_executor.submit(func, *args)\r\n```\r\n\r\n```\r\n  File \"/home/mrocklin/Software/anaconda/lib/python3.4/site-packages/tornado/gen.py\", line 294, in wrapper\r\n    Runner(result, future, yielded)\r\n  File \"/home/mrocklin/Software/anaconda/lib/python3.4/site-packages/tornado/gen.py\", line 955, in __init__\r\n    if self.handle_yield(first_yielded):\r\n  File \"/home/mrocklin/Software/anaconda/lib/python3.4/site-packages/tornado/gen.py\", line 1097, in handle_yield\r\n    self.future, lambda f: self.run())\r\n  File \"/home/mrocklin/Software/anaconda/lib/python3.4/site-packages/tornado/ioloop.py\", line 592, in add_future\r\n    lambda future: self.add_callback(callback, future))\r\n  File \"/home/mrocklin/Software/anaconda/lib/python3.4/site-packages/tornado/concurrent.py\", line 262, in add_done_callback\r\n    self._callbacks.append(fn)\r\nAttributeError: 'NoneType' object has no attribute 'append'\r\ndistributed.utils - ERROR - 'NoneType' object has no attribute 'append'\r\n```\r\n\r\nAfter some effort I've been unable to reproduce this error locally (my apologies.)  My first thought was that I was operating in a thread unsafe manner but I'm not yet able to find anything like this.  Any suggestions on either what I might be doing incorrectly or if this is a proper bug in Tornado?\r\n\r\nLooking briefly at the code it seems like there might be an issue if the future were to finish before adding the callback to return to the yield point.  Is this a reasonable concern?"},"comment":{"url":"https://api.github.com/repos/tornadoweb/tornado/issues/comments/199866008","html_url":"https://github.com/tornadoweb/tornado/issues/1667#issuecomment-199866008","issue_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1667","id":199866008,"user":{"login":"mrocklin","id":306380,"avatar_url":"https://avatars.githubusercontent.com/u/306380?v=3","gravatar_id":"","url":"https://api.github.com/users/mrocklin","html_url":"https://github.com/mrocklin","followers_url":"https://api.github.com/users/mrocklin/followers","following_url":"https://api.github.com/users/mrocklin/following{/other_user}","gists_url":"https://api.github.com/users/mrocklin/gists{/gist_id}","starred_url":"https://api.github.com/users/mrocklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrocklin/subscriptions","organizations_url":"https://api.github.com/users/mrocklin/orgs","repos_url":"https://api.github.com/users/mrocklin/repos","events_url":"https://api.github.com/users/mrocklin/events{/privacy}","received_events_url":"https://api.github.com/users/mrocklin/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T15:28:54Z","updated_at":"2016-03-22T15:28:54Z","body":"I am, indeed, using `with_timeout`.\r\n\r\nOK, will work around for now.  I might take a look at the proposed fix in the moderate future."}}