From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rixed@happyleptic.org Newsgroups: gmane.lisp.guile.user Subject: Guile hangs for minutes when many files are opened (1.8.7) Date: Tue, 14 Jun 2011 09:21:27 +0200 Message-ID: <20110614072126.GA15414@ccellier.rd.happyleptic.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1308036126 27637 80.91.229.12 (14 Jun 2011 07:22:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Jun 2011 07:22:06 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jun 14 09:22:02 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QWNwo-0000DH-Gw for guile-user@m.gmane.org; Tue, 14 Jun 2011 09:22:02 +0200 Original-Received: from localhost ([::1]:37812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWNwm-0000qp-Pw for guile-user@m.gmane.org; Tue, 14 Jun 2011 03:22:00 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWNwV-0000qH-9c for guile-user@gnu.org; Tue, 14 Jun 2011 03:21:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWNwS-0000zu-6k for guile-user@gnu.org; Tue, 14 Jun 2011 03:21:42 -0400 Original-Received: from dangi.happyleptic.org ([92.243.13.193]:37501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWNwR-0000ut-Qc for guile-user@gnu.org; Tue, 14 Jun 2011 03:21:39 -0400 Original-Received: from extranet.securactive.org ([82.234.213.170] helo=ccellier.rd.securactive.lan) by dangi.happyleptic.org with esmtp (Exim 4.72) (envelope-from ) id 1QWNyn-0003OY-51 for guile-user@gnu.org; Tue, 14 Jun 2011 09:24:05 +0200 Original-Received: from rixed by ccellier.rd.securactive.lan with local (Exim 4.72) (envelope-from ) id 1QWNwF-00041G-0V for guile-user@gnu.org; Tue, 14 Jun 2011 09:21:27 +0200 Mail-Followup-To: rixed@happyleptic.org, guile-user@gnu.org Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 92.243.13.193 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8639 Archived-At: 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 once). 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?