Re: [Mono-dev] Mono - CreateProcess error

2006-09-28 Thread Hubert FONGARNAND




Le mardi 26 septembre 2006  20:03 +0200, Robert Jordan a crit:


Honey, Steve wrote:
 A search of google says this was a bug which was supposed to be
 corrected in 1.1.16.  I was running 1.1.13 so I upgraded to 1.1.17 but
 still have the problem.  I also tried adding Process.Dispose() to the
 code but that hasn't help either (don't know if it should have, but I'm
 desperate).  

Try calling proc.WaitForExit() if you don't already.

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


I've written a little program that could help people that having problems with Handles...

It display all process handles, with their associated threads...

I hope it could help!
___Ce message et les éventuels documents joints peuvent contenir des informations confidentielles.Au cas où il ne vous serait pas destiné, nous vous remercions de bien vouloir le supprimer et en aviser immédiatement l'expéditeur. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou publication, totale ou partielle et quel qu'en soit le moyen est formellement interdite.Les communications sur internet n'étant pas sécurisées, l'intégrité de ce message n'est pas assurée et la société émettrice ne peut être tenue pour responsable de son contenu.

// project created on 27/09/2006 at 12:05
using System;
using System.Diagnostics;
using System.Collections;
using System.Text;
using Mono.Posix;
using Mono.Unix;
using System.IO;
using System.Text.RegularExpressions;

namespace wapi_analyser
{
	class MainClass
	{
		
		Hashtable process=new Hashtable();
		Hashtable threads=new Hashtable();
		
		public static void Main(string[] args)
		{
			MainClass main=new MainClass();
			main.Analyse(main.GetData());
			main.Display();
		}
		
		public void Display()
		{
			foreach (int pid in process.Keys)
			{
// Récupération de la ligne de commande:
	string filename=/proc/+pid+/cmdline;
string cmdline=;
try
{
	StreamReader re = File.OpenText(filename);
	cmdline=re.ReadToEnd();
}catch {}
Console.WriteLine(Pid : +pid+ Nom :+process[pid]+ cmd : +cmdline+ Nb threads :+GetNbThread(pid));

			}
			
		}
		
		public int GetNbThread(int pid)
		{
			int counter=0;
			foreach (string id in threads.Keys)
			{
if (((int)threads[id])==pid)
	counter++;
			}
			return counter;
			
		}
		
		
		
		public void Analyse(string stringdata)
		{
			string[] rawtable=stringdata.Split('\n');
			Console.WriteLine(rawtable.Length+ Handle);
			ArrayList sortedtable=new ArrayList();
			bool record=false;
			foreach (String line in rawtable)
			{
if (line.StartsWith(collection))
	record=true;
if (line.Trim().StartsWith(Fileshare))
{
	record=false;
}
if (record)
	sortedtable.Add(line);
// Check if this is a process
if (line.IndexOf([Process])!=-1)
{
	//Console.WriteLine(Process);
	// Extraction du nom du process
	string pattern=@\[\s+.*];
	Match match= Regex.Match(line,pattern);
	
	string processname=match.ToString();
	processname=processname.Trim(new char[]{'[',']'}).Trim();
	//Console.WriteLine(processname);
	// Extraction du pid
	pattern=@pid:\s*\S*\s;
	match= Regex.Match(line,pattern);
	string pid=match.ToString();
	pid=pid.Replace(pid: ,);
	//Console.WriteLine(pid);
	try{
	int pidint=int.Parse(pid);
		process.Add(pidint,processname);
	}catch
	{
		Console.WriteLine(Erreur while parsing +pid);
		Console.WriteLine(Ligne +line);
	}
	
}
if (line.IndexOf([ Thread])!=-1)
{
	//Console.WriteLine(Thread);
	// Extraction du thread id
//	string pattern=@tid:\s\S*,;
//	Match match= Regex.Match(line,pattern);
//	string tid=match.ToString();
//	tid=tid.Replace(tid: -,);
//	tid=tid.Replace(,,);
//	int tidint=int.Parse(tid);
	//Console.WriteLine(tidint);
	// Recherche du pid du process
	string pattern=@proc:\s\S*,;
	Match match= Regex.Match(line,pattern);
	string proc=match.ToString();	
	proc=proc.Replace(proc: ,);
	proc=proc.Replace(,,);
	int procint=int.Parse(proc);
	//Console.WriteLine(procint);
	threads.Add(Guid.NewGuid().ToString(),procint);
}




			}
			//Console.WriteLine(sortedtable.Count);
			
		}
		
		
		public string GetData()
		{
			Process process=new Process();
			ProcessStartInfo info=new ProcessStartInfo();
			info.FileName=/usr/bin/mono;
			info.Arguments=--wapi=hps;
			info.UseShellExecute = false;
info.RedirectStandardOutput = true;
			info.RedirectStandardError = true;
			process.StartInfo=info;
			process.Start();
			string sortie=process.StandardOutput.ReadToEnd();
			process.WaitForExit();
			//Console.WriteLine(sortie);
			return sortie;
			

		}
		
	}
}___

Re: [Mono-dev] Mono - CreateProcess error

2006-09-26 Thread Brian Crowell
Honey, Steve wrote:
 Help!

Hey, Steve. I've been watching this one, too. For months.

The latest bug is filed as:

   http://bugzilla.ximian.com/show_bug.cgi?id=79286

The only workaround I know of at this point (other than, say, rebooting every 
now and then) is to periodically empty the contents of the ~/.wapi directory. 
You can do this while the program's running, say, every ten minutes, or just as 
you've finished one run of data.

At least, I *think* that works. It's such a finicky problem, I can never be 
sure 
of a real fix.

--Brian
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Mono - CreateProcess error

2006-09-26 Thread Honey, Steve








Help!



Ive been using Mono/C# (on Linux) to develop an
algorithm to process real time radar data.



So far, so good. Development has gone smooth and I
love the Mono environment (first time using C# as well).



However, Im running into a problem now that I want to
run this in real time.



On one system, I ingest about 45 radar sites in real time,
with a mono application running for each site. 

After a few hours I start getting CreateProcess:
error creating process handle errors and then the application begins to
fail.



A search of google says this was a bug which was supposed to
be corrected in 1.1.16. I was running 1.1.13 so I upgraded to 1.1.17 but
still have the problem. I also tried adding Process.Dispose() to the code
but that hasnt help either (dont know if it should have, but Im
desperate). 



Are there other workarounds I can try? (I need to make
system calls from the application)

What should I do next?



Thanks,

Steve






___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono - CreateProcess error

2006-09-26 Thread Brian Crowell
Brian Crowell wrote:
 At least, I *think* that works. It's such a finicky problem, I can never be 
 sure 
 of a real fix.

Check that. We just received reports in this morning from our application. This 
doesn't clear or disable WAPI at all.

Looks like the next alternative would be to shut down the Mono process, delete 
the contents of ~/.wapi, and restart the Mono process.

--Brian
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono - CreateProcess error

2006-09-26 Thread Miguel de Icaza
Hello,

 A search of google says this was a bug which was supposed to be
 corrected in 1.1.16.  I was running 1.1.13 so I upgraded to 1.1.17 but
 still have the problem.  I also tried adding Process.Dispose() to the
 code but that hasn’t help either (don’t know if it should have, but
 I’m desperate).  
 
  
 
 Are there other workarounds I can try?  (I need to make system calls
 from the application)

One possible workaround is to not use the CreateProcess which consumes
these wapi handles but instead P/Invoke into system or g_spawn.

I wonder if you are calling too many processes in quick succession, so
its just a matter of not enough time to clean up those handles/.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono - CreateProcess error

2006-09-26 Thread Robert Jordan
Honey, Steve wrote:
 A search of google says this was a bug which was supposed to be
 corrected in 1.1.16.  I was running 1.1.13 so I upgraded to 1.1.17 but
 still have the problem.  I also tried adding Process.Dispose() to the
 code but that hasn't help either (don't know if it should have, but I'm
 desperate).  

Try calling proc.WaitForExit() if you don't already.

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list