diff options
author | Yashwardhan Singh <yashnitkkr7@gmail.com> | 2016-07-07 05:40:34 -0700 |
---|---|---|
committer | Sergey Shepelev <temotor@gmail.com> | 2016-07-07 17:40:34 +0500 |
commit | 2ea3ad9c22444f3d071412ea49449a787f243793 (patch) | |
tree | 52c03069a42e32bc0d5a719b6b41ab33fb71dc29 | |
parent | 6de8d478ca2ee152e1c28d37b1c91b15a6717faf (diff) | |
download | eventlet-2ea3ad9c22444f3d071412ea49449a787f243793.tar.gz |
greenio: makefile related pypy socket ref counting
On PyPy `[Errno 9] Bad file descriptor` because `makefile dup/_drop` dance leaves socket with PyPy special reference counter zero, so it may be garbage collected.
https://github.com/eventlet/eventlet/issues/318
(@temoto) maybe proper fix is to remove `dup` in `makefile()`.
-rw-r--r-- | eventlet/greenio/base.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/eventlet/greenio/base.py b/eventlet/greenio/base.py index 5ed2593..847498d 100644 --- a/eventlet/greenio/base.py +++ b/eventlet/greenio/base.py @@ -299,6 +299,11 @@ class GreenSocket(object): res = _python2_fileobject(dupped, *args, **kwargs) if hasattr(dupped, "_drop"): dupped._drop() + # Making the close function of dupped None so that when garbage collector + # kicks in and tries to call del, which will ultimately call close, _drop + # doesn't get called on dupped twice as it has been already explicitly called in + # previous line + dupped.close = None return res def makeGreenFile(self, *args, **kw): |