is the socket failure issue CP's or OS X's fault or both?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

is the socket failure issue CP's or OS X's fault or both?

metaperl

I dont understand why this is being ignored. There is a very simple
test case that shows the problem:

    http://www.nabble.com/The-Devil%27s-Number-tf3291135.html#a9154129

And there is a long-standing bug in the system on this:

   http://www.cherrypy.org/ticket/598

And yet nothing is happening. Does Apple need to be contacted? Does
the CherryPy send algorithm need to be fixed?

It seems hard to believe that OS X cannot serve files larger than
66608 bytes.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Robert Brewer

metaperl wrote:

> I dont understand why this is being ignored. There is a very simple
> test case that shows the problem:
>
>     http://www.nabble.com/The-Devil%27s-Number-tf3291135.html#a9154129
>
> And there is a long-standing bug in the system on this:
>
>    http://www.cherrypy.org/ticket/598
>
> And yet nothing is happening. Does Apple need to be contacted? Does
> the CherryPy send algorithm need to be fixed?
>
> It seems hard to believe that OS X cannot serve files larger than
> 66608 bytes.

The core team is a small group with limited resources. If someone who
can reproduce the problem would contact Apple or fix the send algorithm,
that'd be most welcome.


Robert Brewer
System Architect
Amor Ministries
[hidden email]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Sylvain Hellegouarch

>
> metaperl wrote:
>> I dont understand why this is being ignored. There is a very simple
>> test case that shows the problem:
>>
>>     http://www.nabble.com/The-Devil%27s-Number-tf3291135.html#a9154129
>>
>> And there is a long-standing bug in the system on this:
>>
>>    http://www.cherrypy.org/ticket/598
>>
>> And yet nothing is happening. Does Apple need to be contacted? Does
>> the CherryPy send algorithm need to be fixed?
>>
>> It seems hard to believe that OS X cannot serve files larger than
>> 66608 bytes.
>
> The core team is a small group with limited resources. If someone who
> can reproduce the problem would contact Apple or fix the send algorithm,
> that'd be most welcome.


Indeed. And if I may add. None of us actually owns a MACOSX. So it's that
we don't want to but simply that we can't.

- Sylvain

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

metaperl



On Mar 15, 5:57 pm, "Sylvain Hellegouarch" <[hidden email]> wrote:


>
> Indeed. And if I may add. None of us actually owns a MACOSX. So it's that
> we don't want to but simply that we can't.
>
> - Sylvain

I will be living in Pennsylvania. I know Sylvain is out of the
question, but I would not mind renting/buying an os x machine and
lending it to a US developer and then having it shipped to me.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Erik Westra-2

Hi,

I've just been deploying my CherryPy-based app to a Mac OSX server,
and was stung by exactly the same problem.  I'm sure this isn't a
"proper" fix to the problem, but I was able to work around it by
following the suggestions found at:

    http://www.cherrypy.org/ticket/598

Specifically, I took a pristine copy of CherryPy 3.0.1, and edited the
cherrypy/wsgiserver/__init__.py file.  At line 419, in the
HTTPRequest.write() method, I replaced:

>        if self.chunked_write and chunk:
>            buf = [hex(len(chunk))[2:], "\r\n", chunk, "\r\n"]
>            self.sendall("".join(buf))
>        else:
>            self.sendall(chunk)

with:

>        if self.chunked_write and chunk:
>            buf = [hex(len(chunk))[2:], "\r\n", chunk, "\r\n"]
>            chunk = "".join(buf)
>
>        chunk_size = 1024 * 1000
>        total_sent = 0
>        while total_sent < len(chunk):
>            c = chunk[total_sent:total_sent + chunk_size]
>            if len(c) < 1: break
>            try:
>                amt_sent = self.connection.socket.send(c)
>            except socket.error,e:
>                amt_sent = 0
>            total_sent = total_sent + amt_sent

I then saved the changes, and uploaded the patched __init__.py file to
my remote Mac OSX server.  To my great surprise, the problem seems to
have gone away!

As I say, I'm sure this is no more than a kludgy workaround...but at
least it fixes the problem and makes my deployed application usable.
Since metaperl is obviously quite desperate to get his ode working, I
thought I'd post this in case it helps him as well.

 - Erik.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Terrence Brannon-15



On Mar 17, 6:07 am, "Erik Westra" <[hidden email]> wrote:


> Specifically, I took a pristine copy of CherryPy 3.0.1, and edited the
> cherrypy/wsgiserver/__init__.py file.  At line 419, in the
> HTTPRequest.write() method, I replaced:
>
> >        if self.chunked_write and chunk:
> >            buf = [hex(len(chunk))[2:], "\r\n", chunk, "\r\n"]
> >            self.sendall("".join(buf))
> >        else:
> >            self.sendall(chunk)

that block of code starts at line 423 in the 3.0.1 I just downloaded:
http://download.cherrypy.org/cherrypy/3.0.1/CherryPy-3.0.1.tar.gz




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Terrence Brannon-15
Hey, it works. Thank you Erik.

On 3/18/07, [hidden email] <[hidden email]> wrote:



On Mar 17, 6:07 am, "Erik Westra" < [hidden email]> wrote:


> Specifically, I took a pristine copy of CherryPy 3.0.1, and edited the
> cherrypy/wsgiserver/__init__.py file.  At line 419, in the
> HTTPRequest.write() method, I replaced:
>
> >        if self.chunked_write and chunk:
> >            buf = [hex(len(chunk))[2:], "\r\n", chunk, "\r\n"]
> >             self.sendall("".join(buf))
> >        else:
> >            self.sendall(chunk)

that block of code starts at line 423 in the 3.0.1 I just downloaded:
http://download.cherrypy.org/cherrypy/3.0.1/CherryPy-3.0.1.tar.gz








--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Erik Westra-2
In reply to this post by Terrence Brannon-15

Hi Metaperl,

> that block of code starts at line 423 in the 3.0.1 I just downloaded:http://download.cherrypy.org/cherrypy/3.0.1/CherryPy-3.0.1.tar.gz

Oops, sorry, I got the line number wrong.  Still, just replace the
first chunk of text with the second -- hopefully that'll work for you.

 - Erik


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Lida Tang
In reply to this post by Terrence Brannon-15
The patch works but will cause an infinite loop if the socket was closed, so I copied how tick() handled socket errors.

        chunk_size = 1024 * 64
        total_sent = 0
        while total_sent < len(chunk):
            c = chunk[total_sent:total_sent + chunk_size]
            if len(c) < 1: break
            try:
                amt_sent = self.connection.socket.send(c)
            except socket.error,e:
                msg = e.args[1]
                if msg in ("Bad file descriptor", "Socket operation on non-socket"):
                    # Our socket was closed.
                    return
                if msg == "Resource temporarily unavailable":
                    amt_sent = 0
                else:
                    raise
            total_sent = total_sent + amt_sent


metaperl.etc@gmail.com wrote
Hey, it works. Thank you Erik.

On 3/18/07, metaperl.etc@gmail.com <metaperl.etc@gmail.com> wrote:
>
>
>
>
> On Mar 17, 6:07 am, "Erik Westra" <ewes...@gmail.com> wrote:
>
>
> > Specifically, I took a pristine copy of CherryPy 3.0.1, and edited the
> > cherrypy/wsgiserver/__init__.py file.  At line 419, in the
> > HTTPRequest.write() method, I replaced:
> >
> > >        if self.chunked_write and chunk:
> > >            buf = [hex(len(chunk))[2:], "\r\n", chunk, "\r\n"]
> > >            self.sendall("".join(buf))
> > >        else:
> > >            self.sendall(chunk)
>
> that block of code starts at line 423 in the 3.0.1 I just downloaded:
> http://download.cherrypy.org/cherrypy/3.0.1/CherryPy-3.0.1.tar.gz
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to cherrypy-devel@googlegroups.com
To unsubscribe from this group, send email to cherrypy-devel-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---
Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Erik Westra-2

Hi Lida,

> The patch works but will cause an infinite loop if the socket was closed, so
> I copied how tick() handled socket errors.

Thanks!  Your change fixes the socket closing problem nicely...

 - Erik.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: is the socket failure issue CP's or OS X's fault or both?

Robert Brewer

Erik Westra wrote:
> Hi Lida,
>
> > The patch works but will cause an infinite loop if the
> socket was closed, so
> > I copied how tick() handled socket errors.
>
> Thanks!  Your change fixes the socket closing problem nicely...

Could either of you distill all that and make a ticket? I don't have
time to dig into it at the moment, but I don't want to lose the work
you've done so far.


Robert Brewer
System Architect
Amor Ministries
[hidden email]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---