PYTHON-728 - Fix signal handling in gevent / eventlet.
PYTHON-728 - Fix signal handling in gevent / eventlet.

In this change:

https://github.com/mongodb/mongo-python-driver/commit/f737ec0#diff-01419ea067833899fda0f45f93ea1ce0L169

I updated SocketInfo to close itself on socket.error, instead of on *all*
exceptions. This makes no difference in regular python: a signal raised during
socket.recv() is expressed as an EINTR error from poll:

https://hg.python.org/cpython/file/1c45047c5102/Modules/socketmodule.c#l708

All error codes from poll become socket.error. Eventually in PyEval_EvalFrameEx
the interpreter checks for signals and throws KeyboardInterrupt into the
current frame on the main thread.

But in Gevent and Eventlet, the polling mechanism (epoll, kqueue, ...) is
called in Python code, which experiences the signal as a KeyboardInterrupt from
the start, rather than as an initial socket.error. So my new code in SocketInfo
does *not* catch the error, the socket remains open, and it is reused for the
next operation. As in PYTHON-294 the next operation throws "AssertionError: ids
don't match", because the previous server response is still pending.

inspectlabs/mongo-python-driver,ramnes/mongo-python-driver,bq-xiao/mongo-python-driver,mongodb/mongo-python-driver,brianwrf/mongo-python-driver,pigate/mongo-python-driver,rychipman/mongo-python-driver,ultrabug/mongo-python-driver,ameily/mongo-python-driver,brianwrf/mongo-python-driver,llvtt/mongo-python-driver,llvtt/mongo-python-driver,aherlihy/mongo-python-driver,develf/mongo-python-driver,ramnes/mongo-python-driver,felixonmars/mongo-python-driver,felixonmars/mongo-python-driver,gormanb/mongo-python-driver,ShaneHarvey/mongo-python-driver,rychipman/mongo-python-driver,macdiesel/mongo-python-driver,mongodb/mongo-python-driver,WingGao/mongo-python-driver,mongodb/mongo-python-driver,pigate/mongo-python-driver,WingGao/mongo-python-driver,aherlihy/mongo-python-driver,aherlihy/mongo-python-driver,ShaneHarvey/mongo-python-driver,macdiesel/mongo-python-driver,gormanb/mongo-python-driver,ultrabug/mongo-python-driver,ShaneHarvey/mongo-python-driver,inspectlabs/mongo-python-driver,jameslittle/mongo-python-driver,ramnes/mongo-python-driver,bq-xiao/mongo-python-driver,ameily/mongo-python-driver,jameslittle/mongo-python-driver,develf/mongo-python-driver