[ts-gen] child processes IO.popen
Bill Pippin
pippin at owlriver.net
Thu Jul 23 19:01:04 EDT 2009
Mac,
Your original message to the list appears to have been deleted from
our mail archives because it was an html attachment only, so first
I'll quote with the html elided for the benefit of other readers:
> Any script I run which has IO.popen ... Only allows 4 child process
> to be opened. Obviously this is a problem.
> i.e. exs/risk.rb calls IO.popen 8 times. It crashes after 4 and closes
> with:
> 'write': Broken pipe (Errno::EPIPE)
> The programs work fine if this IO call is ... 4
> Anybody else experience this issue?
The text below indicates that the pipe broke, most often because the
shim finished. You might want to look at the shim's log file to see
how far it got, if it started at all.
> 'write': Broken pipe (Errno::EPIPE)
Probably more to the point: what platform and OS version are you
working on?
Otherwise, I'm surprised that you say popen is called multiple
times, and I'm not sure why this would occur. The script exs/risk.rb
is mostly straight line code, and there's exactly one popen call:
...
Shim = IO.popen("./shim --risk file save diff join", "w");
Shim.sync = true;
...
The shim might have trouble starting, in which case there should be
some kind of error; but I don't see that leading to multiple opens.
Are you sure the popen's are all from the ruby script? The pipe
to the shim is clearly broken, but maybe something else is calling
popen as well?
By the way, you should know that the shim itself used to be able
to make up to eight connection attempts to the IB tws; but those
are socket opens, not popen calls, and in any case that code is
broken right now, so that for now the shim fails after the first
connection attempt. Also, the shim calls fork once if you use
the "pane" option, so you probably want to avoid that.
Does the exs/test.rb script work properly? If so, maybe there is
indeed some kind of connection problem between the shim and the
IB tws; the shim will start trying client_id 1 for test.rb, and
client_id 8 for risk.rb .
You might want to experiment with the plain shim scripts in the
exs directory, and with modifying the ruby scripts. Popen should
only be called once for each of test.rb and risk.rb .
Thanks,
Bill
More information about the ts-general
mailing list