Re: StreamWriter.close() hangs in multithreaded execution
From: Jan (jango_at_newsgroup.nospam)
Date: 02/14/05
- Next message: Jan: "Re: StreamWriter.close() hangs in multithreaded execution"
- Previous message: Paul Clement: "Re: what is the best way to read text file"
- In reply to: Alvin Bruney [MVP]: "Re: StreamWriter.close() hangs in multithreaded execution"
- Next in thread: Jan: "Re: StreamWriter.close() hangs in multithreaded execution"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 14 Feb 2005 11:37:08 -0800
This is a program that collects data from several different services. I was
hoping to make it more efficient by enabling different threads to do the
collection in parallell. The service answers promptly when called from the
main thread, but when called from it's own thread it just stops on the close
method of the StreamWriter. I've incorporated a timeout to abort any
collection thread that uses more than a specified amount of time, and this is
what finally throws a ThreadAbort exception. While the close call is
"waiting" the cpu usage for the aspnet process is hovering around 90% cpu
usage. Extending the timeout period doesn't change anything. I'm actually
seeing the same problem with another collection function that interfaces with
a web service..
Jan
"Alvin Bruney [MVP]" wrote:
> It shouldn't. Are you setting the useragent correctly? How do you know it is
> hanging? Are there any exceptions?
>
> --
> Regards,
> Alvin Bruney [Microsoft MVP ASP.NET]
>
> [Shameless Author plug]
> The Microsoft Office Web Components Black Book with .NET
> Now Available @ http://www.lulu.com/owc
> ----------------------------------------------------------
>
>
> "Jan" <jango@newsgroup.nospam> wrote in message
> news:2E97DF71-056D-4B95-BC81-10AA68CA6D45@microsoft.com...
> > I've got a program accessing a HTTP service to get som XML data.
> >
> > The code receiveing the data looks something like this:
> > stream = new StreamWriter(httpRequest.GetRequestStream(),Encoding.UTF8);
> > stream.Write(body);
> > stream.Close();
> >
> > The httpRequest is a HttpWebRequest object.
> >
> > This works fine from a single thread execution, but when I'm accessing
> > this
> > method on its own thread, the Close() method seems to hang.
> >
> > Any ideas as to what I'm doing wrong?
> >
> > Jan
> >
> > --
> > Do or die..
>
>
>
- Next message: Jan: "Re: StreamWriter.close() hangs in multithreaded execution"
- Previous message: Paul Clement: "Re: what is the best way to read text file"
- In reply to: Alvin Bruney [MVP]: "Re: StreamWriter.close() hangs in multithreaded execution"
- Next in thread: Jan: "Re: StreamWriter.close() hangs in multithreaded execution"
- Messages sorted by: [ date ] [ thread ]