{"action":"created","issue":{"url":"https://api.github.com/repos/shazow/urllib3/issues/541","labels_url":"https://api.github.com/repos/shazow/urllib3/issues/541/labels{/name}","comments_url":"https://api.github.com/repos/shazow/urllib3/issues/541/comments","events_url":"https://api.github.com/repos/shazow/urllib3/issues/541/events","html_url":"https://github.com/shazow/urllib3/issues/541","id":56243513,"number":541,"title":"When using urllib3 with gevent and checking if a socket is closed an exception is raised","user":{"login":"thedrow","id":48936,"avatar_url":"https://avatars.githubusercontent.com/u/48936?v=3","gravatar_id":"","url":"https://api.github.com/users/thedrow","html_url":"https://github.com/thedrow","followers_url":"https://api.github.com/users/thedrow/followers","following_url":"https://api.github.com/users/thedrow/following{/other_user}","gists_url":"https://api.github.com/users/thedrow/gists{/gist_id}","starred_url":"https://api.github.com/users/thedrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thedrow/subscriptions","organizations_url":"https://api.github.com/users/thedrow/orgs","repos_url":"https://api.github.com/users/thedrow/repos","events_url":"https://api.github.com/users/thedrow/events{/privacy}","received_events_url":"https://api.github.com/users/thedrow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-02T14:34:26Z","updated_at":"2015-02-02T17:09:03Z","closed_at":null,"body":"```\r\nTraceback (most recent call last):\r\n  File \"***\", line 285, in request\r\n    return HTTPConnectionPool.request(self, method, url, fields, headers, **urlopen_kw)\r\n  File \"***/lib/python2.7/site-packages/urllib3/request.py\", line 75, in request\r\n    **urlopen_kw)\r\n  File \"***/lib/python2.7/site-packages/urllib3/request.py\", line 88, in request_encode_url\r\n    return self.urlopen(method, url, **urlopen_kw)\r\n  File \"***/lib/python2.7/site-packages/urllib3/connectionpool.py\", line 536, in urlopen\r\n    conn = self._get_conn(timeout=pool_timeout)\r\n  File \"***/lib/python2.7/site-packages/urllib3/connectionpool.py\", line 294, in _get_conn\r\n    if conn and is_connection_dropped(conn):\r\n  File \"***/lib/python2.7/site-packages/urllib3/util.py\", line 490, in is_connection_dropped\r\n    return select([sock], [], [], 0.0)[0]\r\n  File \"***/lib/python2.7/site-packages/gevent/select.py\", line 67, in select\r\n    raise error(*ex.args)\r\nerror: (9, 'Bad file descriptor')\r\n```\r\n\r\nThis is because gevent raises ```gevent.select.error``` instead of ```socket.error```.\r\nIs there a way to gracefully handle this?\r\n\r\n<bountysource-plugin>\r\n\r\n---\r\nWant to back this issue? **[Place a bounty on it!](https://www.bountysource.com/issues/8221541-when-using-urllib3-with-gevent-and-checking-if-a-socket-is-closed-an-exception-is-raised?utm_campaign=plugin&utm_content=tracker%2F192525&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F192525&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/shazow/urllib3/issues/comments/72495041","html_url":"https://github.com/shazow/urllib3/issues/541#issuecomment-72495041","issue_url":"https://api.github.com/repos/shazow/urllib3/issues/541","id":72495041,"user":{"login":"sigmavirus24","id":240830,"avatar_url":"https://avatars.githubusercontent.com/u/240830?v=3","gravatar_id":"","url":"https://api.github.com/users/sigmavirus24","html_url":"https://github.com/sigmavirus24","followers_url":"https://api.github.com/users/sigmavirus24/followers","following_url":"https://api.github.com/users/sigmavirus24/following{/other_user}","gists_url":"https://api.github.com/users/sigmavirus24/gists{/gist_id}","starred_url":"https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigmavirus24/subscriptions","organizations_url":"https://api.github.com/users/sigmavirus24/orgs","repos_url":"https://api.github.com/users/sigmavirus24/repos","events_url":"https://api.github.com/users/sigmavirus24/events{/privacy}","received_events_url":"https://api.github.com/users/sigmavirus24/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T17:09:03Z","updated_at":"2015-02-02T17:09:03Z","body":"> I don't see why gevent then shouldn't deserve it's own exception there.\r\n\r\nAppEngine is something trending towards \"real\" Python. OSX is only an exception in that the default openssl does some ill-considered things but otherwise just works. gevent is something we support but which we shouldn't have to put so much effort into supporting (Note, the amount of effort to support the other two platforms is minimal). gevent needs to fix itself essentially.\r\n\r\nBesides that, the above are all well-known ways that things can fail. I was addressing the suggestion to catch `Exception` and be done with it, because that's perhaps the worst potential solution to this problem.\r\n\r\nIn case it's still not obvious to you, gevent should be doing something, isn't, and we shouldn't have to handle or work around gevent's negligence. Gevent should fix its bug."}}