Sidnei da Silva | 8 Oct 19:12
Favicon

asyncore fixes in Python 2.6 broke Zope's version of medusa

I am working on getting Zope to run (or at least, start) with Python
2.6. It actually starts right now after applying some patches, which
is amazing on itself, but it dies right away due to changes in
asyncore that break Zope's internal version of medusa.

I've opened a bug against Zope on Launchpad, but someone suggested
that it might actually be a bug in python, in the sense that it
changed asyncore in a backwards-incompatible way. I wouldn't go that
far, since I think it's more likely that Zope's version of medusa is
poking into asyncore internals instead:

https://bugs.edge.launchpad.net/zope2/+bug/280020

I suspect a patch similar to this might be needed:

http://codereview.appspot.com/744/diff/1/23

Anyone cares to comment?

--

-- 
Sidnei da Silva
Enfold Systems                http://enfoldsystems.com
Fax +1 832 201 8856     Office +1 713 942 2377 Ext 214
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

(Continue reading)

Bill Janssen | 8 Oct 19:30
Favicon

Re: asyncore fixes in Python 2.6 broke Zope's version of medusa

Sidnei da Silva <sidnei <at> enfoldsystems.com> wrote:

> https://bugs.edge.launchpad.net/zope2/+bug/280020

I think there are real issues here with both asynchat and Medusa.
Asynchat has been heavily re-written, and the "ac_out_buffer" has
apparently disappeared.  But "ac_out_buffer_size" is still there.  That
strikes me as odd, and probably means that asynchat.py needs more
changes.  However, Medusa (basically just an application layer on top
of asyncore/asynchat) also needs to be re-written to take account of
the changes in asynchat.

Bill

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Josiah Carlson | 8 Oct 23:26

Re: asyncore fixes in Python 2.6 broke Zope's version of medusa

On Wed, Oct 8, 2008 at 10:30 AM, Bill Janssen <janssen <at> parc.com> wrote:
> Sidnei da Silva <sidnei <at> enfoldsystems.com> wrote:
>
>> https://bugs.edge.launchpad.net/zope2/+bug/280020
>
> I think there are real issues here with both asynchat and Medusa.
> Asynchat has been heavily re-written, and the "ac_out_buffer" has
> apparently disappeared.  But "ac_out_buffer_size" is still there.  That
> strikes me as odd, and probably means that asynchat.py needs more
> changes.  However, Medusa (basically just an application layer on top
> of asyncore/asynchat) also needs to be re-written to take account of
> the changes in asynchat.

ac_out_buffer was removed because it is unneeded (we have a deque; why
rely on an extra attribute?).
ac_out_buffer_size still remains as a blocksize in which to pre-split
outgoing data (if you have a 100k string you want to send, repeatedly
slicing it as you are able to send pieces is slow, but pre-slicing
chunks is fast, and generally results in being able to pass full chunk
to the underlying TCP/IP stack).

But yes, zope needs to be changed to reflect the updated
asyncore/asynchat semantics.  Trust me; it's faster, cleaner, and
easier to use now.

 - Josiah
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
(Continue reading)

Sidnei da Silva | 8 Oct 23:31
Favicon

Re: asyncore fixes in Python 2.6 broke Zope's version of medusa

On Wed, Oct 8, 2008 at 6:26 PM, Josiah Carlson <josiah.carlson <at> gmail.com> wrote:
> ac_out_buffer was removed because it is unneeded (we have a deque; why
> rely on an extra attribute?).
> ac_out_buffer_size still remains as a blocksize in which to pre-split
> outgoing data (if you have a 100k string you want to send, repeatedly
> slicing it as you are able to send pieces is slow, but pre-slicing
> chunks is fast, and generally results in being able to pass full chunk
> to the underlying TCP/IP stack).
>
> But yes, zope needs to be changed to reflect the updated
> asyncore/asynchat semantics.  Trust me; it's faster, cleaner, and
> easier to use now.

Great to know. So medusa should be changed similarly to the changes
made to asynchat? Your suggestion on the bugtracker is even better: to
subclass asynchat as much as possible.

--

-- 
Sidnei da Silva
Enfold Systems                http://enfoldsystems.com
Fax +1 832 201 8856     Office +1 713 942 2377 Ext 214
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Bill Janssen | 8 Oct 23:49
Favicon

Re: asyncore fixes in Python 2.6 broke Zope's version of medusa

Sidnei da Silva <sidnei <at> enfoldsystems.com> wrote:

> Great to know. So medusa should be changed similarly to the changes
> made to asynchat?

Hmmm.  Been a long time since a Medusa release, but I need a working
Medusa, too.

> Your suggestion on the bugtracker is even better: to
> subclass asynchat as much as possible.

That's basically what Medusa is, a set of subclasses.

Bill
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Bill Janssen | 9 Oct 03:39
Favicon

Re: asyncore fixes in Python 2.6 broke Zope's version of medusa

Josiah Carlson <josiah.carlson <at> gmail.com> wrote:

> But yes, zope needs to be changed to reflect the updated
> asyncore/asynchat semantics.  Trust me; it's faster, cleaner, and
> easier to use now.

Just for completeness, I built a fresh 2.6, installed Medusa (from
http://www.amk.ca/python/code/medusa.html), and it runs just fine (well,
as well as it does on 2.5, anyway).  I think this is a Zope issue.

Bill
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Guido van Rossum | 9 Oct 04:18
Favicon

Re: asyncore fixes in Python 2.6 broke Zope's version of medusa

On Wed, Oct 8, 2008 at 6:39 PM, Bill Janssen <janssen <at> parc.com> wrote:
> Josiah Carlson <josiah.carlson <at> gmail.com> wrote:
>
>> But yes, zope needs to be changed to reflect the updated
>> asyncore/asynchat semantics.  Trust me; it's faster, cleaner, and
>> easier to use now.
>
> Just for completeness, I built a fresh 2.6, installed Medusa (from
> http://www.amk.ca/python/code/medusa.html), and it runs just fine (well,
> as well as it does on 2.5, anyway).  I think this is a Zope issue.

Way back in the day, Zope monkeypatched whole parts of asyncore,
replacing them with some of its own code. If that's still the case,
this breakage should be no surprise.

--

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Tres Seaver | 9 Oct 18:08

Re: asyncore fixes in Python 2.6 broke Zope's version of medusa


Guido van Rossum wrote:
> On Wed, Oct 8, 2008 at 6:39 PM, Bill Janssen <janssen <at> parc.com> wrote:
>> Josiah Carlson <josiah.carlson <at> gmail.com> wrote:
>>
>>> But yes, zope needs to be changed to reflect the updated
>>> asyncore/asynchat semantics.  Trust me; it's faster, cleaner, and
>>> easier to use now.
>> Just for completeness, I built a fresh 2.6, installed Medusa (from
>> http://www.amk.ca/python/code/medusa.html), and it runs just fine (well,
>> as well as it does on 2.5, anyway).  I think this is a Zope issue.
> 
> Way back in the day, Zope monkeypatched whole parts of asyncore,
> replacing them with some of its own code. If that's still the case,
> this breakage should be no surprise.

Zope has been hooking the 'asyncore.loop' function (wrapping it in order
to add a "clean shutdown' flog) since 2001 at least (the 2.5 branch is
the earliest checkout I have, and it was branched in early January 2002).

Zope also began patched asyncore's logging functions in 2.7, and later
updated that patch to make the logger use the stdlib 'logging' module.

I think the change we need to make (in ZServer/medusa/http_server.py) is
to emulate the new 'writeable' implementation in asynchat, at least when
running under 2.6.

Zope's 'ZServer.medusa.http_server.http_request.writable()'
implementation is::

(Continue reading)


Gmane