bug in pipes on windows #4

Closed
tomerfiliba opened this Issue Mar 2, 2011 · 1 comment

Projects

None yet

1 participant

@tomerfiliba
Owner

Thomas Higdon Show activity 9/23/10
Yep, we agree that pipes on windows suck, but thanks for attempting to
support it!

I ran into the following problem on python 2.4, windows server 2008:


  File "/tmp/tmpt9WdVU", line 28, in ? 
  File "c:\tmp\tmp9v5tb5\rpyc\utils\classic.py", line 28, in connect_pipes 
  File "c:\tmp\tmp9v5tb5\rpyc\utils\factory.py", line 38, in connect_pipes 
  File "c:\tmp\tmp9v5tb5\rpyc\utils\factory.py", line 30, in connect_stream 
  File "c:\tmp\tmp9v5tb5\rpyc\utils\factory.py", line 23, in connect_channel 
  File "c:\tmp\tmp9v5tb5\rpyc\core\protocol.py", line 87, in __init__ 
  File "c:\tmp\tmp9v5tb5\rpyc\core\protocol.py", line 90, in _init_service 
  File "c:\tmp\tmp9v5tb5\rpyc\core\service.py", line 106, in on_connect 
  File "c:\tmp\tmp9v5tb5\rpyc\core\protocol.py", line 365, in root 
  File "c:\tmp\tmp9v5tb5\rpyc\core\protocol.py", line 339, in sync_request 
  File "c:\tmp\tmp9v5tb5\rpyc\core\protocol.py", line 301, in serve 
  File "c:\tmp\tmp9v5tb5\rpyc\core\protocol.py", line 261, in _recv 
  File "c:\tmp\tmp9v5tb5\rpyc\core\channel.py", line 38, in recv 
  File "c:\tmp\tmp9v5tb5\rpyc\core\stream.py", line 215, in read 
TypeError: Second param must be an integer or a buffer object 

It turns out there is a very simple fix, although I'm not completely
certain why it seems no one else has run into this.


--- stream.py.bak       2010-09-22 12:33:19.218556542 -0400 
+++ stream.py   2010-09-22 16:57:29.108371675 -0400 
@@ -211,7 +211,7 @@ 
         try: 
             data = [] 
             while count > 0: 
-                dummy, buf = win32file.ReadFile(self.incoming, min(self.MAX_IO_CHUNK, count)) 
+                dummy, buf = win32file.ReadFile(self.incoming, int(min(self.MAX_IO_CHUNK, count))) 
                 count -= len(buf) 
                 data.append(buf) 
         except TypeError, ex: 

It looks like the result of the 'min' function is not something that
the C layer of win32file interprets as an integer. count comes from
the FRAME_HEADER struct in channel.py, which is using the 'L', or
unsigned long format, which I guess doesn't count as an integer.

Anyways, the maintainer may put this into the next release, but I hope
this can help someone else in the meantime.

@tomerfiliba
Owner

fixes a28b882; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4;

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment