fowode / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

Pychess freezes after accepted rematch offer on FICS #869

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Pychess freezes after board was shown but before pieces rendered.

Original issue reported on code.google.com by gbtami on 11 May 2014 at 9:51

Attachments:

GoogleCodeExporter commented 9 years ago
Screenshot attached.

Original comment by gbtami on 11 May 2014 at 9:52

Attachments:

GoogleCodeExporter commented 9 years ago
"New issue #896, Pychess freezes after accepted rematch offer on FICS"
(cc to Matt)

Original comment by gbtami on 11 May 2014 at 9:53

GoogleCodeExporter commented 9 years ago
I'm having trouble figuring this one out. Issue 868 and issue 870 were more 
straight-forward deadlocks, but this one is interesting... The thread with the 
glock is the ionest.worker() thread:

has glock
Thread: work (-1608533184)
  File "/usr/lib/python2.7/threading.py", line 783, in __bootstrap
    self.__bootstrap_inner()
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/home/uhu/pychess/lib/pychess/System/GtkWorker.py", line 178, in run
    self.result = self.func(self)
  File "/home/uhu/pychess/lib/pychess/widgets/ionest.py", line 34, in work
    return workfunc(w, gamemodel, player0tup, player1tup, loaddata)
  File "/home/uhu/pychess/lib/pychess/widgets/ionest.py", line 98, in workfunc
    gamemodel.setPlayers(players)
  File "/home/uhu/pychess/lib/pychess/ic/ICGameModel.py", line 123, in setPlayers
    GameModel.setPlayers(self, players)
  File "/home/uhu/pychess/lib/pychess/Utils/GameModel.py", line 204, in setPlayers
    self.emit("players_changed")
  File "/home/uhu/pychess/lib/pychess/widgets/gamewidget.py", line 440, in players_changed
    self.name_changed(player)
  File "/home/uhu/pychess/lib/pychess/widgets/gamewidget.py", line 454, in name_changed
    self.emit('title_changed', self.display_text)
  File "/home/uhu/pychess/lib/pychess/widgets/gamenanny.py", line 79, in on_gmwidg_title_changed
    glock.acquire()
  File "/home/uhu/pychess/lib/pychess/System/glock.py", line 34, in acquire
    threads_enter()

But who has the gdk lock? Main thread is not doing anything apparently, but the 
interface was completely locked up right? (and if that is the case, then why is 
there nothing happening for MainThread in the log?)

Thread: MainThread (-1220802816)
  File "./pychess", line 138, in <module>
    chess_file, ics_host, ics_port)
  File "/home/uhu/pychess/lib/pychess/Main.py", line 492, in run
    gtk.main()

So I'm guessing the culprit holding the gdk lock is one of these two threads:

Thread: FICSConnection.run:288 (-1321362624)
  File "/usr/lib/python2.7/threading.py", line 783, in __bootstrap
    self.__bootstrap_inner()
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/home/uhu/pychess/lib/pychess/System/ThreadPool.py", line 91, in run
    self.func()
  File "/home/uhu/pychess/lib/pychess/System/ThreadPool.py", line 62, in <lambda>
    a.func = lambda: func(*args, **kw)
  File "/home/uhu/pychess/lib/pychess/ic/FICSConnection.py", line 294, in run
    self.client.parse()
  File "/home/uhu/pychess/lib/pychess/ic/VerboseTelnet.py", line 213, in parse
    answer = self.test_prediction(p, line)
  File "/home/uhu/pychess/lib/pychess/ic/VerboseTelnet.py", line 222, in test_prediction
    answer = prediction.handle(line.line)
  File "/home/uhu/pychess/lib/pychess/ic/VerboseTelnet.py", line 49, in handle
    self.callback(match)
  File "/home/uhu/pychess/lib/pychess/ic/managers/HelperManager.py", line 114, in on_game_remove
    wplayer.restore_previous_status() # no status update will be sent by
  File "/home/uhu/pychess/lib/pychess/ic/FICSObjects.py", line 109, in restore_previous_status
    self.status = self._previous_status
  File "/usr/lib/python2.7/site-packages/gobject/propertyhelper.py", line 172, in __set__
    instance.set_property(self.name, value)
  File "/home/uhu/pychess/lib/pychess/System/glock.py", line 84, in newFunction
    acquire()
  File "/home/uhu/pychess/lib/pychess/System/glock.py", line 29, in acquire
    _rlock.acquire()
  File "/usr/lib/python2.7/threading.py", line 173, in acquire
    rc = self.__block.acquire(blocking)

Thread: FICSConnection.run:288 (-1312969920)
  File "/usr/lib/python2.7/threading.py", line 783, in __bootstrap
    self.__bootstrap_inner()
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/home/uhu/pychess/lib/pychess/System/ThreadPool.py", line 91, in run
    self.func()
  File "/home/uhu/pychess/lib/pychess/System/ThreadPool.py", line 62, in <lambda>
    a.func = lambda: func(*args, **kw)
  File "/home/uhu/pychess/lib/pychess/ic/FICSConnection.py", line 294, in run
    self.client.parse()
  File "/home/uhu/pychess/lib/pychess/ic/VerboseTelnet.py", line 206, in parse
    line = self.lines.popleft()
  File "/home/uhu/pychess/lib/pychess/ic/VerboseTelnet.py", line 156, in popleft
    self.lines.extend(self._get_lines())
  File "/home/uhu/pychess/lib/pychess/ic/VerboseTelnet.py", line 193, in _get_lines
    self.consolehandler.handle(lines)
  File "/home/uhu/pychess/lib/pychess/ic/VerboseTelnet.py", line 13, in handle
    self.callback(line)
  File "/home/uhu/pychess/lib/pychess/ic/managers/ConsoleManager.py", line 18, in onConsoleMessage
    self.emit("consoleMessage", lines)
  File "/home/uhu/pychess/lib/pychess/System/glock.py", line 69, in handler
    acquire()
  File "/home/uhu/pychess/lib/pychess/System/glock.py", line 29, in acquire
    _rlock.acquire()
  File "/usr/lib/python2.7/threading.py", line 173, in acquire
    rc = self.__block.acquire(blocking)

I'm still trying to figure out whether gtk signal emissions 
("someobject.emit('foo-signal')" for example) and gobject property 
notifications (connecting to "notify::status" for example) are called 
automatically with the gdk lock when done in a non-MainThread. The 
documentation and other stuff I've read on the Internet seems to be unclear on 
this. If they are, then we need to make sure they get the glock right away on 
callbacks hooked to both types of cases, like this guy does in the GtkLocker 
code example at http://faq.pygtk.org/index.py?req=show&file=faq20.015.htp

Original comment by mattgatto on 19 May 2014 at 1:50

GoogleCodeExporter commented 9 years ago
This issue was closed by revision be28de3413ef.

Original comment by mattgatto on 7 Jun 2014 at 8:16