[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guile hangs for minutes when many files are opened (1.8.7)

From: rixed
Subject: Guile hangs for minutes when many files are opened (1.8.7)
Date: Tue, 14 Jun 2011 09:21:27 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hello happy hackers!

I'm using guile (1.8.7) to extend an application (written in C) that
writes on many opened file descriptors (usually 5000 files opened at

Amongst other things, guile is listening on a socket to serve user'
commands (kind of embedded REPL).

When many files are opened, guile can be very slow (ie. up to 2 minutes)
to answer connects and/or commands sent to this REPL ; but if I disable
the part of the application that opens and writes into the many files,
then everything goes smooth.

strace revealed me that when pausing, guile is waiting for a lock. There
are some few other guile threads that performs minor activity that may
also use a port (for instance to write a few lines into stdout), but
apart from that guile should be mostly sleeping.

So I've checked libguile/ports.c, looking for what could be affected by
the huge number of opened files, and stumbled upon the port table copy
into a temp port vector in scm_c_port_for_each(), which may hold
scm_i_port_table_mutex for some time if there are as many ports as
opened files descriptor ; but I wonder whether there is an associated
port for a file descriptor that's never used nor even communicated to
guile? Also, I do not call this function myself.

Also, scm_flush_all_ports() is iterating over all ports, but the same
remarks as above apply (I don't call this - although I've found that
really_cleanup_for_exit() does call it - and yet, the 5k file descr
should be unknown of guile).

Do you have any idea of what could cause these pauses?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]