Re: HttpModules - Webservices
- From: Scott Allen <scott@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 May 2005 11:39:17 -0400
Hi Buck:
These problems can be pretty tough to debug. One approach I've used is
the dump file approach with WinDbg [1], but this can be a steep
learning curve if you haven't used the tools or done any debugging
with a native debugger.
Just to make sure the problem isn't a thread deadlock, you could
replace Application.Lock with Ian's TimedLock [2] and see if there are
error messages about locks timing out.
What is the HistorySize? Could the Delete operation on the DataTable
be sucking up lots of CPU?
[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/dbgrm.asp
[2] http://www.interact-sw.co.uk/iangblog/2004/03/23/locking
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 12 May 2005 09:07:36 +0100, "Bruce Hodge"
<support@xxxxxxxxxxxxxxxxxx> wrote:
>Hi Scott,
>
>When the service hangs I can't break in, but I do have some information from
>before it hangs. Also when it does hang the aspnet_wp.exe goes to 95+ CPU
>processor time, the memory usage remains static at 82,052K.
>
>On the threads it appears that threads are left running not attached to a
>piece of code, I don't know enough on threading to understand this (it
>looks like a pool for the aspnet_wp.exe process), basically after a dozen or
>so requests have been made the thread window has the following entries:
>
>ID, Name, Location, Priority, Suspend
>4740, <No Name>, , Normal, 0
>3724, <No Name>, , Normal, 0
>4608, <No Name>, , , 0
>4264, <No Name>, , Mars.Utils.HttpRequestViewer.OnBeginRequest, Normal, 0
>
>The only way to clear the problem is to End the aspnet_wp.exe process.
>
>To see whether there were thread issues on the Application object I tried
>saving the Dataset on the Cache and to a Static variable, it made no
>difference.
>
>
>
>Regards Bruce H
>
>
>"Scott Allen" <scott@xxxxxxxxxxxxxxxxxxxx> wrote in message
>news:onr4811pbaftv19bc05is2k0116f9hv7tj@xxxxxxxxxx
>> Bruce:
>>
>> The Application.Lock would make me nervous. It does look as if you
>> have an Unlock at the right places, but you might consider using a
>> finally clause. I'd
>>
>> When the application blocks can you break in with the debugger and
>> look at call stacks for all the threads? That might show you how the
>> application became deadlocked.
>>
>> --
>> Scott
>> http://www.OdeToCode.com/blogs/scott/
>>
>>
>> On Wed, 11 May 2005 20:30:57 +0100, "Bruce Hodge"
>> <support@xxxxxxxxxxxxxxxxxx> wrote:
>>
>>>Hi,
>>>
>>>We have a couple of clients who are having trouble connecting to .Net
>>>webservices, (they're coming from PHP and VFP). We were looking to
>>>provide
>>>a diagonostic tool that displayed the soap message submitted so that if
>>>the
>>>call failed they could compare their SoapMessage with the ones we generate
>>>in .Net.
>>>
>>>Thought the solution was an HttpModule hooked into begin request, but
>>>after
>>>approx 10 requests it hangs the webservice/aspnet service, any thoughts?
>>>Code below.
>>>
>>>(The HttpRequests are stored in Typed Dataset, stored on the Application
>>>object so that they can be accessed from webpages.)
>>>
>>>
>>>public void OnBeginRequest(Object s, EventArgs e)
>>>{
>>> try
>>> {
>>> // Cast the Object to the HttpApplication variable.
>>> HttpApplication app = (HttpApplication)s;
>>>
>>> HttpRequest newRequest = app.Request;
>>>
>>> string servers = this.ServicesToMonitor();
>>> int posn =
>>>servers.ToLower().IndexOf(this.GetServiceName(newRequest).ToLower());
>>>
>>> if (posn > -1)
>>> this.AddFromHttpRequest(this.RequestHistory, newRequest);
>>>
>>> }
>>>
>>> catch (Exception ex)
>>> {
>>> //Custom error logging code
>>> }
>>>
>>>}
>>>
>>>private void AddFromHttpRequest(Mars.Schema.HttpRequests history,
>>>HttpRequest request)
>>>{
>>> try
>>> {
>>> HttpContext.Current.Application.Lock();
>>>
>>> byte [] byteArray = new byte[request.ContentLength];
>>>
>>> request.InputStream.Read(byteArray, 0, request.ContentLength);
>>>
>>> // Must reset the Input Stream position or the whole process
>>> fails.
>>> request.InputStream.Position = 0;
>>>
>>> Mars.Schema.HttpRequests.RequestsRow row =
>>>this.RequestHistory.Requests.AddRequestsRow(
>>>
>>>
>>> request.RawUrl,
>>> request.HttpMethod,
>>> request.ContentType,
>>> request.ContentLength,
>>> Encoding.ASCII.GetString(byteArray, 0, request.ContentLength),
>>> DateTime.Now,
>>> this.GetServiceName(request),
>>> this.SOAPAction(request),
>>> request.ServerVariables["REMOTE_ADDR"]);
>>>
>>> foreach (string s in request.Headers.AllKeys)
>>>
>>> this.RequestHistory.HttpHeaders.AddHttpHeadersRow(row.RequestID,
>>>s, request.Headers[s]);
>>>
>>> while (this.RequestHistory.Requests.Count > this.HistorySize)
>>> {
>>> this.RequestHistory.Requests[0].Delete();
>>> }
>>>
>>> this.RequestHistory.AcceptChanges();
>>>
>>> HttpContext.Current.Application.UnLock();
>>>
>>> }
>>>
>>> catch (Exception ex)
>>> {
>>>
>>> #region Catch Block
>>>
>>> #endregion
>>>
>>> HttpContext.Current.Application.UnLock();
>>>
>>> }
>>>
>>>}
>>
>
.
- Follow-Ups:
- Re: HttpModules - Webservices
- From: Bruce Hodge
- Re: HttpModules - Webservices
- References:
- HttpModules - Webservices
- From: Bruce Hodge
- Re: HttpModules - Webservices
- From: Scott Allen
- Re: HttpModules - Webservices
- From: Bruce Hodge
- HttpModules - Webservices
- Prev by Date: Progress Bar help
- Next by Date: Re: Session variables in a Public Class?
- Previous by thread: Re: HttpModules - Webservices
- Next by thread: Re: HttpModules - Webservices
- Index(es):
Relevant Pages
|