unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* A guile story
@ 2006-11-05  8:51 Neil Jerram
  2006-11-05 13:20 ` Andy Wingo
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Neil Jerram @ 2006-11-05  8:51 UTC (permalink / raw)


You know that song about the gasman coming to call?  Here's a
guile-hacking story in similar vein.  Hopefully someone will find it
amusing, and there are details that you may like to comment on.

I was working on guile bindings for the Nokia 770's "hildon" API,
using guile-gnome.  These are more or less done, so I started
wondering about the best way to test them, and write applications
using them.  Writing code directly on the 770 is a bit sub-optimal, so
the best option IMO is to use Emacs on my laptop, with ange-ftp to
edit files on the 770.

That requires an FTP server on the 770.  I looked at a couple of
Debian packages, but for reasons I forget these turned out to be
tricky to port.  Then I found the "Scheme Untergrund" FTP server (in a
package called SUnet), and decided to port that to Guile.  150 lines
of compatibility code later - because SUnet is quite old and was
written for PLT - I think it's getting close to working.

The process was incremental: mostly just trying to run the code, get
an XXX undefined error, write the necessary compatibility code for
XXX, then try again.  But when I got as far as trying an "ls", the
server appeared to hang.  So then I thought, "I know, I'll use
guile-debugging to break at the start of the handle-list procedure and
then single step through the code, to see where it hangs."

I added the appropriate incantation to the FTP server's start up code
and set it going.  It ran like treacle, but eventually hit the
breakpoint and popped up the stack in Emacs - hooray!  Except that
when I then pressed space to single step... nothing happened.

I eventually narrowed this down to the interaction between calling
accept on the main FTP server thread at the same time as read on the
FTP data connection thread (which is where the breakpoint was hit).
At least, the problem was apparently fixed by inserting a select
before the accept, so that the accept never blocked.  I'm aware that
this problem has been reported before, and that someone prepared a
patch to fix it, but (i) I thought we had applied that patch, and (ii)
I thought the problem affected coop threads only, not pthreads.

What next?  Single stepping was now working, but the program keeps
going unbelievably slowly - e.g. a minute to execute a single
evaluation step.  From "top" I noticed that the program's memory usage
was 52M, and still steadily rising.

That's the latest position.  My guess is that the long periods where
nothing happens except CPU burning are huge GCs, and that some GC bug
affecting multiple threads means that these GCs never actually free
anything (or not as much as they should, anyway).  Any ideas or other
datapoints would be much appreciated.  Does the Boehm GC handle
multiple threads?  If it does, perhaps I should try out Ludovic's
BGC-Guile.

All in all, I feel like I've got quite a few problems to work through
first, in order to get back to testing those hildon bindings.

Thanks for reading!

     Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-11-30 15:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-05  8:51 A guile story Neil Jerram
2006-11-05 13:20 ` Andy Wingo
2006-11-05 21:42   ` Neil Jerram
2006-11-06  9:12     ` Ludovic Courtès
2006-11-07 10:24       ` Neil Jerram
2006-11-07 13:01         ` Ludovic Courtès
2006-11-05 23:22   ` Neil Jerram
2006-11-06  9:24 ` Serious GC problem in HEAD Ludovic Courtès
2006-11-07 10:19   ` Neil Jerram
2006-11-07 12:51     ` Ludovic Courtès
2006-11-08 10:00   ` Ludovic Courtès
2006-11-19 15:02     ` Neil Jerram
2006-11-20 13:09       ` Ludovic Courtès
2006-11-29 23:34     ` Kevin Ryde
2006-11-30 15:11       ` Ludovic Courtès
2006-11-28 20:09 ` A guile story Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).