Re: [Twisted-Python] Sending large files over network with perspective broker

2010-05-24 Thread Gabriele Lanaro
Thank you very much for your explanation! Now I've understood what's the
problem in iterate().

On these lines I've prepared a this little test case (in attach):

Test 1

$ python runner.py
click on the button
minimize/unminimize window to force a widget redraw, the window should be
blank.
you can click another time on the button, the event is catched but no
"button animation" is performed

Test2

$ python runner.py
open another console
$ python runner_other_process.py
click on the button of runner_other_process, this connects itself to the
server in the first process
each window should redraw correctly

2010/5/24 Glyph Lefkowitz 

>
> On May 23, 2010, at 6:36 PM, Gabriele Lanaro wrote:
>
> > In which sense it's invalid? I don't know how the gtk reactor works, I
> just guessed that the event loop never reaches the gui events. My idea was
> to force the processing of these events before spawning another deferred,
> it's just a workaround, the real problem is  the fact that the server and
> the client resides in  the same loop (for testing).
>
> It's invalid to run reactor.iterate() inside the reactor mainloop.  You
> can't force event-processing order in Twisted; if you want an event to not
> get processed, you need to delay its event source from getting invoked
> (producer.pauseProducing(), transport.stopReading(),
> transport.stopWriting(), Deferred.pause() are all ways to do this).
>
> It's invalid to use reactor.iterate() in this way because the reactor may
> invoke you reentrantly and there's no sane way to handle that.
>
> For example, your code is running because select() said your file
> descriptor was ready for reading, which then invoked dataReceived, which
> then invoked your method with buffered data, which then called iterate(),
> which then called dataReceived, which then called your method with buffered
> data, which then called iterate(), which then ...
> (and so on, forever, unless your application code conflicts with itself and
> running and starts blowing up and throwing incomprehensible tracebacks
> everywhere because of "impossible" recursion.
>
> > Which can be the reason of the mainloop "block"?
>
> Lots of reasons.  The example you gave wasn't syntactically valid Python,
> so it's hard to say.  Consider sending along an  and
> maybe we can tell you more :).
>
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>


twistsample.tar.gz
Description: GNU Zip compressed data
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] major changes, release engineering, and learning cost

2010-05-24 Thread Jonathan Lange
On Mon, May 24, 2010 at 3:35 AM,   wrote:
...
>>So: thoughts?  Does this make sense as a policy change for facilitating
>>the development of major new features or consolidating behavior-
>>changing fixes into easier-to-understand units?
>
> So, to summarize, we could stage our code using more than just two
> branches (trunk + feature branch) in order to make larger changes easier
> to understand for reviewers while still making each change to trunk a
> coherent unit.
>

FWIW, we've been doing this on Launchpad for some years and it works out well.

As a rule, we don't have the final "sanity check" review, since we
have robot minions that check for conflicts and that the tests pass.

> This sounds fine to me.  We need to work out some details (like, for
> example, I'm not sure trying to do this using subversion is such a good
> idea, and we want the process to be documented somewhere so we don't
> have a repeat of #886), but I think we should try it and see what
> happens.
>

Using a DVCS would make it much easier. For example, Bazaar has
plugins like loom and pipeline that are designed to manage a stack of
changes.

Also, +1 on the documentation.

jml

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Reactor Spinning?

2010-05-24 Thread exarkun
On 23 May, 03:42 pm, mo...@thoughtcrime.org wrote:
>
>Hey everyone, I've still been trying to track down this spin bug.  What
>I probably should have mentioned before is that these are SSL
>connections.  Looking through the 10.0 release code, I found the
>_sendCloseAlert method in tcp.py: http://pastebin.com/gZKxHtN5
>
>I feel like this is almost certainly the culprit.  Most suspiciously,
>there's an explicit empty write on pastebin-line 23:
>
>os.write(self.socket.fileno(), '')
>
>It looks to me like there's a code path where this write "succeeds," 
>the
>SSL socket reports that the connection is still not shut down, and then
>the transport is resumed via startWriting and startReading.  I assume
>that this then repeats for as long as that socket is up.
>This directly corresponds with the system calls I'm seeing (poll, empty
>write, poll, empty write...)
>
>I still don't have an entirely comprehensive grasp of whats' going on
>here, but while these efforts to "cleanly" shut down the SSL connection
>by exchanging alerts are heroic, I feel like it's much more common (and
>probably good enough) to just send an alert and immediately close the
>underlying socket.

It'd be great if you could attach a minimal example which demonstrates 
this behavior to a ticket in the issue tracker (threads on the mailing 
list usually lead to ignored issues).

It's probably also worth reporting your version of OpenSSL and 
pyOpenSSL, since that might be related.  I've not seen this kind of 
behavior before, which may just mean I'm running an older version of 
OpenSSL than you.

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Sending large files over network with perspective broker

2010-05-24 Thread exarkun
On 08:39 am, gabriele.lan...@gmail.com wrote:
>Thank you very much for your explanation! Now I've understood what's 
>the
>problem in iterate().
>
>On these lines I've prepared a this little test case (in attach):
>
>Test 1
>
>$ python runner.py
>click on the button
>minimize/unminimize window to force a widget redraw, the window should 
>be
>blank.
>you can click another time on the button, the event is catched but no
>"button animation" is performed
>
>Test2
>
>$ python runner.py
>open another console
>$ python runner_other_process.py
>click on the button of runner_other_process, this connects itself to 
>the
>server in the first process
>each window should redraw correctly

This may demonstrate a bug in gtk2reactor.  It seems to be servicing 
network events to the exclusion of GUI events, which it isn't supposed 
to do.

I don't see any obvious reason for this.  Unfortunately glib2 (or 
pygtk2, perhaps) is ultimately in charge of the ordering/priority of 
these event handlers.  gtk2reactor is just a thin layer on top of the 
glib2-supplied I/O notification APIs.  But perhaps there's a way we 
could be invoking these APIs differently so that the GUI gets more of a 
chance to run.

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] turning off chunked transfer-encoding

2010-05-24 Thread Michael P. Soulier
Hi,

I noticed that when using twisted.internet.http and returning a Content-type
of application/json, the server responds with chunked transfer encoding. 

I'm debugging a client problem and I'd like to turn chunked transfer encoding
off. Is this possible?

Thanks,
Mike
-- 
Michael P. Soulier 
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein


signature.asc
Description: Digital signature
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] turning off chunked transfer-encoding

2010-05-24 Thread Itamar Turner-Trauring
On Mon, 2010-05-24 at 22:07 -0400, Michael P. Soulier wrote:
> Hi,
> 
> I noticed that when using twisted.internet.http and returning a Content-type
> of application/json, the server responds with chunked transfer encoding. 

Chunked encoding has nothing to do with the content type. It is used if
you do not set a content-length header.

So, figure out your response's length (in bytes), and set the
content-length header to that.


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python