From 34cd7af0911547d0d58b76f0309e744f6184da78 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 9 Sep 2010 20:49:50 -0700 Subject: Bug #336644 - Make EbuildIpcDaemon use AbstractPollTask._read_buf(), for better handling of errors like "IOError: [Errno 11] Resource temporarily unavailable". TODO: Apply a similar fix to ebuild-ipc.py. --- pym/_emerge/EbuildIpcDaemon.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'pym/_emerge/EbuildIpcDaemon.py') diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py index 93333a6b1..f6bfecfbe 100644 --- a/pym/_emerge/EbuildIpcDaemon.py +++ b/pym/_emerge/EbuildIpcDaemon.py @@ -29,26 +29,13 @@ class EbuildIpcDaemon(FifoIpcDaemon): __slots__ = ('commands',) def _input_handler(self, fd, event): + # Read the whole pickle in a single atomic read() call. + buf = self._read_buf(self._files.pipe_in, event) - if event & PollConstants.POLLIN: - - # Read the whole pickle in a single read() call since - # this stream is in non-blocking mode and pickle.load() - # has been known to raise the following exception when - # reading from a non-blocking stream: - # - # File "/usr/lib64/python2.6/pickle.py", line 1370, in load - # return Unpickler(file).load() - # File "/usr/lib64/python2.6/pickle.py", line 858, in load - # dispatch[key](self) - # File "/usr/lib64/python2.6/pickle.py", line 1195, in load_setitem - # value = stack.pop() - # IndexError: pop from empty list - - pickle_str = self._files.pipe_in.read() + if buf: try: - obj = pickle.loads(pickle_str) + obj = pickle.loads(buf.tostring()) except (EnvironmentError, EOFError, ValueError, pickle.UnpicklingError): pass -- cgit v1.2.3-1-g7c22