[philiptellis] /bb|[^b]{2}/
Never stop Grokking

Wednesday, February 07, 2007

Ayttm screen freeze

If you use the jabber service on ayttm, you may notice the main window appears to freeze up at times turning completely white. You can still chat, and clicking on the main window makes contacts visible, but it just doesn't refresh on its own.

This happens because of a problem with the jabber module and I haven't had a chance to figure it out yet. What I do know, is that you can unlock the application without restarting it, but you need to resort to a teeny weeny bit of geekery.

First, find out the pid of the running ayttm process:
   ayttm_pid=`ps -u philip | grep a[y]ttm | cut -f2 -d' '`
(I use [y] instead of y in ayttm so that the grep process doesn't show up in the list).

Once you have your pid, start gdb telling it to attach to this pid. Different versions of gdb have different ways to do this, so check the man page, but two common ways are:
   gdb ayttm $ayttm_pid
   gdb ayttm -p $ayttm_pid
Ok, so pretty much anyone could have told you how to get this far, it's going forward that needs a wee bit of knowledge of the source.

I'll save you the trouble and tell you that you need to look into jab_recv. File descriptor for the jabber socket (stored in j->fd) has closed, but the code is stuck on an infinite read. You need to set a breakpoint on jab_recv, and close the ayttm end of the fd:
   bt jab_recv
p close(j->fd)
That's about it. You'll get an alert telling you that the jabber server closed the connection. Click Ok, and proceed as if nothing happened.

Finally, there's really no reason for you to do all that. Here's the one liner shell script (broken for readability) to do it for you:
   echo -e '\n\n\nb jab_recv\ncont\nn\nn\np close(j->fd)\ndeta\n' | \
gdb ayttm `ps -waux | grep a[y]ttm | cut -f2 -d' '` &>/dev/null