rpc.py:SocketIO - Large modules were generating large pickles when downloaded
to the execution server. The return of the OK response from the subprocess initialization was interfering and causing the sending socket to be not ready. Add an IO ready test to fix this. Moved the polling IO ready test into pollpacket(). M NEWS.txt M rpc.py Backport candidate.
This commit is contained in:
parent
af3eb87802
commit
d6ab77d27d
|
@ -3,6 +3,14 @@ What's New in IDLE 1.1a0?
|
||||||
|
|
||||||
*Release date: XX-XXX-2004*
|
*Release date: XX-XXX-2004*
|
||||||
|
|
||||||
|
- rpc.py:SocketIO - Large modules were generating large pickles when downloaded
|
||||||
|
to the execution server. The return of the OK response from the subprocess
|
||||||
|
initialization was interfering and causing the sending socket to be not
|
||||||
|
ready. Add an IO ready test to fix this. Moved the polling IO ready test
|
||||||
|
into pollpacket().
|
||||||
|
|
||||||
|
- Fix typo in rpc.py, s/b "pickle.PicklingError" not "pickle.UnpicklingError".
|
||||||
|
|
||||||
- Added a Tk error dialog to run.py inform the user if the subprocess can't
|
- Added a Tk error dialog to run.py inform the user if the subprocess can't
|
||||||
connect to the user GUI process. Added a timeout to the GUI's listening
|
connect to the user GUI process. Added a timeout to the GUI's listening
|
||||||
socket. Added Tk error dialogs to PyShell.py to announce a failure to bind
|
socket. Added Tk error dialogs to PyShell.py to announce a failure to bind
|
||||||
|
|
|
@ -320,23 +320,20 @@ class SocketIO:
|
||||||
self.debug("putmessage:%d:" % message[0])
|
self.debug("putmessage:%d:" % message[0])
|
||||||
try:
|
try:
|
||||||
s = pickle.dumps(message)
|
s = pickle.dumps(message)
|
||||||
except pickle.UnpicklingError:
|
except pickle.PicklingError:
|
||||||
print >>sys.__stderr__, "Cannot pickle:", `message`
|
print >>sys.__stderr__, "Cannot pickle:", `message`
|
||||||
raise
|
raise
|
||||||
s = struct.pack("<i", len(s)) + s
|
s = struct.pack("<i", len(s)) + s
|
||||||
while len(s) > 0:
|
while len(s) > 0:
|
||||||
try:
|
try:
|
||||||
n = self.sock.send(s)
|
r, w, x = select.select([], [self.sock], [])
|
||||||
|
n = self.sock.send(s[:BUFSIZE])
|
||||||
except (AttributeError, socket.error):
|
except (AttributeError, socket.error):
|
||||||
# socket was closed
|
# socket was closed
|
||||||
raise IOError
|
raise IOError
|
||||||
else:
|
else:
|
||||||
s = s[n:]
|
s = s[n:]
|
||||||
|
|
||||||
def ioready(self, wait):
|
|
||||||
r, w, x = select.select([self.sock.fileno()], [], [], wait)
|
|
||||||
return len(r)
|
|
||||||
|
|
||||||
buffer = ""
|
buffer = ""
|
||||||
bufneed = 4
|
bufneed = 4
|
||||||
bufstate = 0 # meaning: 0 => reading count; 1 => reading data
|
bufstate = 0 # meaning: 0 => reading count; 1 => reading data
|
||||||
|
@ -344,7 +341,8 @@ class SocketIO:
|
||||||
def pollpacket(self, wait):
|
def pollpacket(self, wait):
|
||||||
self._stage0()
|
self._stage0()
|
||||||
if len(self.buffer) < self.bufneed:
|
if len(self.buffer) < self.bufneed:
|
||||||
if not self.ioready(wait):
|
r, w, x = select.select([self.sock.fileno()], [], [], wait)
|
||||||
|
if len(r) == 0:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
s = self.sock.recv(BUFSIZE)
|
s = self.sock.recv(BUFSIZE)
|
||||||
|
@ -377,7 +375,7 @@ class SocketIO:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
message = pickle.loads(packet)
|
message = pickle.loads(packet)
|
||||||
except:
|
except pickle.UnpicklingError:
|
||||||
print >>sys.__stderr__, "-----------------------"
|
print >>sys.__stderr__, "-----------------------"
|
||||||
print >>sys.__stderr__, "cannot unpickle packet:", `packet`
|
print >>sys.__stderr__, "cannot unpickle packet:", `packet`
|
||||||
traceback.print_stack(file=sys.__stderr__)
|
traceback.print_stack(file=sys.__stderr__)
|
||||||
|
|
Loading…
Reference in New Issue