[Twisted-Python] interaction problems with wxreactor and conch under linux

I have a large program that is built using wxpython and twisted in which the client sends commands through ssh (using conch) to the server. Under linux I have found some very strange results. If the user is not doing anything (i.e. not moving the mouse or doing anything to cause the window to redraw), then conch seems to stop processing and hang the whole twisted loop. As soon as the user moves the mouse, clicks a button, or does something to cause the window to refresh, then conch immediately starts processing again and the twisted loop begins calling callbacks again. I can't seem to reproduce this under windows or osx, and it doesn't seem to always happen under linux with wxgtk2. I have written a dumb little test program (attached), that hopefully shows this behavior. After connecting to a remote machine, through the gui you can specify a command, hit run command and the stdout will be displayed. The console prints out the time from two timers. One is setup using a reactor.callLater and another is setup using a wx.Timer. If a command that takes a while is run (cat a large file) and you don't move the mouse or do anything to cause the window to refresh, then you will see that the callLater callback stops being called (although the wx.Timer callback continues to be called). As soon as you move the mouse, the callLater callback begins firing again, and you'll eventually see the output of your command. This is really frustrating since we are using conch to send large commands or to download/upload large files, and it is common for the user to want to minimize the program and let it run in the background, but with this bug, twisted stops responding and the file stops sending until the user does something to cause the window to redraw. I'm not that familiar with conch, so maybe i'm doing something completely wrong in my connection code. Any critique on it would be nice. Thank you in advance, /Mark

On Tue, 27 May 2008 13:45:26 -0500, Mark Dillavou <mlists@line72.net> wrote:
Hi Mark, I tried your attached program and didn't see the bad behavior you described. I tried it with Twisted trunk@HEAD, Python 2.5.1, and wxPython 2.6.3.2.1.5ubuntu12. How does this compare to the versions you're using? Differing behavior on different platforms doesn't surprise me at all, since wx itself has a lot of subtle differences on different platforms. Jean-Paul

On Tue, May 27, 2008 at 3:13 PM, Jean-Paul Calderone <exarkun@divmod.com> wrote: <snip>
I've tried this on ubuntu hardy running: twisted-2.5.0 python-2.5.1 wxpython-2.8.4.0 And I've also tried on a redhat 4 machine with a custom built version of: twisted-2.5.0 and twisted-8.0.1 python-2.5.1 wxpython-2.8.6.0 I don't remember having this issue until several months ago. It's possibly that we we upgrade from wx-2.6 to wx-2.8 this problem showed up. Let me test out an older version of wx and see if I can reproduce this. /Mark

On Wed, May 28, 2008 at 10:09 AM, Mark Dillavou <mlists@line72.net> wrote:
I've seen reports of this from other people, although I can't recreate it either. It seems to be related to the idle handler that wx installs in gtk not being serviced, and I think it's related to the gtk version. As a workaround, try calling wx.WakeUpIdle() in your wx.Timer function.

Chris, On Wed, May 28, 2008 at 3:10 PM, Chris Mellon <arkanes@gmail.com> wrote:
<snip>
I've seen reports of this from other people, although I can't recreate
Setting a wx.Timer to call wx.WakeUpIdle() does fix this problem! Do you have a recommendation on how often the timer should fire? Not firing often enough (> 500 ms) causes all the network communication to be slow, but what are the ramifications of setting the timer value really low (1 ms)? /Mark

On Tue, 27 May 2008 13:45:26 -0500, Mark Dillavou <mlists@line72.net> wrote:
Hi Mark, I tried your attached program and didn't see the bad behavior you described. I tried it with Twisted trunk@HEAD, Python 2.5.1, and wxPython 2.6.3.2.1.5ubuntu12. How does this compare to the versions you're using? Differing behavior on different platforms doesn't surprise me at all, since wx itself has a lot of subtle differences on different platforms. Jean-Paul

On Tue, May 27, 2008 at 3:13 PM, Jean-Paul Calderone <exarkun@divmod.com> wrote: <snip>
I've tried this on ubuntu hardy running: twisted-2.5.0 python-2.5.1 wxpython-2.8.4.0 And I've also tried on a redhat 4 machine with a custom built version of: twisted-2.5.0 and twisted-8.0.1 python-2.5.1 wxpython-2.8.6.0 I don't remember having this issue until several months ago. It's possibly that we we upgrade from wx-2.6 to wx-2.8 this problem showed up. Let me test out an older version of wx and see if I can reproduce this. /Mark

On Wed, May 28, 2008 at 10:09 AM, Mark Dillavou <mlists@line72.net> wrote:
I've seen reports of this from other people, although I can't recreate it either. It seems to be related to the idle handler that wx installs in gtk not being serviced, and I think it's related to the gtk version. As a workaround, try calling wx.WakeUpIdle() in your wx.Timer function.

Chris, On Wed, May 28, 2008 at 3:10 PM, Chris Mellon <arkanes@gmail.com> wrote:
<snip>
I've seen reports of this from other people, although I can't recreate
Setting a wx.Timer to call wx.WakeUpIdle() does fix this problem! Do you have a recommendation on how often the timer should fire? Not firing often enough (> 500 ms) causes all the network communication to be slow, but what are the ramifications of setting the timer value really low (1 ms)? /Mark
participants (3)
-
Chris Mellon
-
Jean-Paul Calderone
-
Mark Dillavou