[squeak-dev] Unix OSProcess error

David T. Lewis lewis at mail.msen.com
Thu Aug 6 19:34:21 UTC 2009


On Thu, Aug 06, 2009 at 11:29:25AM -0700, Andreas Raab wrote:
> Hi -
> 
> This morning I was greeted with a sequence of "Error: cannot create OS 
> pipe" from one of our servers (running RHEL 5.3) and I am trying to 
> understand what might be causing this. The call stack is included below; 
> it appears that #makePipeHandles returns nil and I am not sure what 
> might be causing this. Is there a possibility that there is some limit 
> on the number of handles that we might be exceeding? Some missing cleanup?
> 
> Thanks for any help,
>   - Andreas

Most likely you are hitting the limit for open file handles (a per-process
limit on unix, probably set to 1024 unless you have changed it). Find the
pid of the Squeak VM process in question ('pgrep -l squeak' from unix command
line, or 'OSProcess thisOSProcess pid' in the image). Then, assuming pid is
12345, look at the information in the proc file system, "ls -l /proc/12345/fd/*".
This will probably show you about a thousand open file handles on pipes.

Assuming that is the case, the problem is failure to cleanly close all pipe
handles. Not all of the examples that you find in OSProcess will necessarily
do this (and it's usually best to go ahead and load CommandShell to get
access to some higher-level tools). In particular some of the examples will
e.g. run an external command but leave the output pipes open on the assumption
that you will want to want to read them. In cases like that, the pipes need
to be explicitly closed to avoid a file handle leak.

Note also that the normal finalization of FileStreams is disabled for streams
on OS pipes (due to performance issues with weak registries, which gets
disasterously bad if you do a lot of pipe creation). That means that pipe
handles that you do not explicitly close will linger forever in the unix
process.

The unit tests for CommandShell will include lots of examples of running
command pipelines and testing to ensure that all open files have been closed.
You may want to borrow some ideas from that.

If you can send me an example of something that you are doing, I'll try to
suggest something more specific to address the problem. I'm away from Squeak
at the moment, so it may take me a while to respond.

Dave




More information about the Squeak-dev mailing list