develooper Front page | perl.perl6.users | Postings from March 2021

RE: too many file handles

Thread Previous | Thread Next
From:
Mark Devine
Date:
March 17, 2021 18:06
Subject:
RE: too many file handles
Message ID:
BL0PR02MB473803990DD9FB1913CE9333A06A9@BL0PR02MB4738.namprd02.prod.outlook.com
Richard,

If a quick workaround is fitting, the problem can be dodged at the system level.  I'll pick 8192 open files on Linux for example:

/etc/security/limits.conf

	myuser	hard nofile 8192
	myuser	soft nofile 8192

This doesn't address the open file count within Raku, but sometimes people just want to get by the snag and keep flowing.

Mark

-----Original Message-----
From: Richard Hainsworth <rnhainsworth@gmail.com> 
Sent: Wednesday, March 17, 2021 13:46
To: perl6-users <perl6-users@perl.org>
Subject: too many file handles

I have been running into this error: "Too many open files"

Sorry for the lack of detail. The problem is that the error comes up in odd places, so I have found it difficult to golf down into Raku program that always fails with this error.

When I separate out the code that leads to the error, and create another program, Raku handles it without difficulty. It seems to occur when there are a lot of moving parts, so to speak.

I am not explicitly opening file handles, but the software I have written is using the idiom

"some-filename.html".IO.spurt( $an-accumulated-string );

Obviously, filehandles are being opened under the hood. Having written a file, there is no need to reference it again, so I could close the filehandle.

I have been told that because of the way garbage handling is implemented, there is a problem with file handles. If so, what is a safer idiom to use in place of and IO on a string, so that the handle can be closed immediately after use?

Appreciate some help on this.

Richard


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About