shajianrui <shajian...@126.com> added the comment:

Yes I reproduce this problem with a slight modification to your demo. 

Using your origianl version I fail to reproduce, maybe 2*65536 bytes size is 
too small.

I just change the size of data (in test_cgi_client.py ) to 8*65536, 16*65536 
and 32*65536, and the result is shown on the image I attach.

>From the image you can see
    - From 1 to 7 the length received doesn't change: always
      195540 bytes.And the process of sending are really slow.
    - At 8th test the server receive complete data. And the 
      sending is finished in a flash.(Maybe the socket suddenly
      enlarge the buffer?)
    - From 9 to 10 seems the "buffer" become smaller and smaller.

However, in my demo(Post in my last message), the data can be up to 65536*1024 
bytes and 【seldom】 produce this problem.

I use "seldom" because I now confirm: If too many (more than 10) testclient.py 
are executed at the same time, the testserver.py will produce the problem too. 
Like this:

    testserver.py output:
                Connection closed.
                67108864
                0
                Connection closed.
                67108864
                0
                Connection closed.
                67108864
                0
                Connection closed.
                195640               # From here the problem show up.
                42440740
                2035240
                9327940
                13074300
                35004
                0
                Connection closed.
                67108864
                0
                Connection closed.

Seems this is a normal behavior of rfile.read() that it may not return as many 
bytes as we tell it to read.

Now I have a problem: Why the bytes returned from "rfile.read()" is so few when 
the rfile is in CGIHTTPRequestHandler?

----------
Added file: https://bugs.python.org/file48428/image.PNG

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37301>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to