Hi !

I have some troubles with the process starting.
Conretely, I have tested the following simple code:

String[] hosts = new String [] { "node-38-02", "node-38-03", "node-38-04", "node-38-05" , "node-38-06", "node-38-07", "node-38-08", "node-63-04", "node-63-05", "node-63-06", "node-63-08", "node-63-09" };

  String arg = "hostname";
  foreach ( String host in hosts ) {

   Process ssh_process = new Process();
   ssh_process.StartInfo.UseShellExecute  = false;
ssh_process.StartInfo.FileName = "ssh";
   ssh_process.StartInfo.Arguments = " " + host + " " + arg;

Console.WriteLine ( ssh_process.StartInfo.FileName + ssh_process.StartInfo.Arguments );

   ssh_process.Start ();

   if ( ssh_process.HasExited )
Console.WriteLine ( "Has Exited with code = " + ssh_process.ExitCode );

  }

Often, the result was:

$ mono ssh_test.exe
ssh node-38-02 hostname
ssh node-38-03 hostname
ssh node-38-04 hostname
ssh node-38-05 hostname
ssh node-38-06 hostname
ssh node-38-07 hostname
ssh node-38-08 hostname
ssh node-63-04 hostname
ssh node-63-05 hostname
ssh node-63-06 hostname
ssh node-63-08 hostname
ssh node-63-09 hostname
Has Exited with code = 0

_wapi_handle_unref: Attempting to unref unused handle 0x1d0000001c

or even

$ mono ssh_test.exe
ssh node-38-02 hostname
ssh node-38-03 hostname
ssh node-38-04 hostname
ssh node-38-05 hostname
ssh node-38-06 hostname
Has Exited with code = 0
ssh node-38-07 hostname
ssh node-38-08 hostname
ssh node-63-04 hostname
Has Exited with code = 0
ssh node-63-05 hostname
ssh node-63-06 hostname
ssh node-63-08 hostname
ssh node-63-09 hostname
Start done ...
Wait done ...
_wapi_handle_unref: Attempting to unref unused handle 0xe
_wapi_handle_unref: Attempting to unref unused handle 0x1500000014


I found the following message about Mono bug
http://lists.ximian.com/pipermail/mono-bugs/2009-January/084380.html
with the supplement that

--- Comment #2 from Zoltan Varga <vargaz at gmail.com 
<http://lists.ximian.com/mailman/listinfo/mono-bugs>>  2009-01-18 09:01:37 MST ---
Fixed in SVN HEAD. This process refcounting stuff is tricky, so I didn't
backport it to 2.2/2.0.
Then I  run a heavy application on the machine and repeated the test.
The result was

$ mono ssh_test.exe
ssh node-38-02 hostname

Unhandled Exception: System.InvalidOperationException: Process has not been started. at System.Diagnostics.Process.get_HasExited () [0x00000] in <filename unknown>:0 at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:get_HasExited () at ssh_test.Main (System.String[] args) [0x00000] in <filename unknown>:0

I have tested the program under Mono 2.10.1.
So how is it possible to fix this problem ?

Thanks.

Yury
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to