Dmitry Kudrenko | 12 May 12:54
Picon
Favicon

Long time processing in the DwrServlet.service()

Greetings

I am using DWR with Simple framework
(http://www.simpleframework.org/). It has own Simple API which is
different from servlet-api. But I use Adaptor pattern to convert
simple.Request to HttpServletRequest and HttpServletResponse to simple.Response.

Also I am using Reverse Ajax in my web application.

Simple request handler receives request and forwards it to the DWR
Servlet using DwrServlet.service(request, response) method. DWR
Servlet configured properly and it works.

Sometimes I have strange behavior: request is being processed 1 minute but
method on the class mapped to javascript works only 10 msec.

I received this statistic wrapping DwrServlet.service with timer1 and
adding timer2 to the my Java class.

timer1.maximum value = 1 minute (The maximum time is the same as maximum time for Reverse Ajax request)
timer2.maximum value = 10 msec.

This situation is hard to reproduce in my local version of the
application. But I have this statistic often in the live system. So it
is hard to debug it.

It seems the number of these errors depends on browser (can't
reproduce it with FireFox) and connection quality. (Not sure).

Have you idea where the request can be 60 sec in the
(Continue reading)

Mike Wilson | 13 May 13:46
Picon
Favicon

RE: Long time processing in the DwrServlet.service()

Hi Dmitry,

I would suggest you try your application in a regular servlet engine,
like f ex Tomcat or Jetty, and report back if you still have any 
problems. Reproducing your error in a "standard" environment will make
it much easier for other developers on the list to help you.

BTW: What is your impression of Simple framework? (There doesn't seem
to have been much activity the last years.)

Best regards
Mike Wilson

> -----Original Message-----
> From: Dmitry Kudrenko [mailto:dmitry@...] 
> Sent: den 12 maj 2008 12:56
> To: users@...
> Subject: [dwr-user] Long time processing in the DwrServlet.service()
> 
> Greetings
> 
> I am using DWR with Simple framework
> (http://www.simpleframework.org/). It has own Simple API which is
> different from servlet-api. But I use Adaptor pattern to convert
> simple.Request to HttpServletRequest and HttpServletResponse 
> to simple.Response.
> 
> Also I am using Reverse Ajax in my web application.
> 
> Simple request handler receives request and forwards it to the DWR
(Continue reading)

Dmitry Kudrenko | 13 May 14:42
Picon
Favicon

Re[2]: Long time processing in the DwrServlet.service()

Greetings, Mike

MW> I would suggest you try your application in a regular servlet engine,
MW> like f ex Tomcat or Jetty, and report back if you still have any 
MW> problems. Reproducing your error in a "standard" environment will make
MW> it much easier for other developers on the list to help you.

Certainly it will be good, but unfortunately, I have not chance to do
it easily. And it is why I ask you for ideas (potential solutions)
about reason why/where DwrServlet keeps (can keep) request for a long
time. And have not chance to debug it because of it is hard to
reproduce this issue locally (with good network connection).

I have no ideas how to localize the problem in a short term and why
processing time the same with Comet request maximum connection time.

Maybe it is question to the developer mailing list, not sure...

MW> BTW: What is your impression of Simple framework? (There doesn't seem
MW> to have been much activity the last years.)

Simple framework was an engine of the original application I started
to support/rebuild several months ago. So, Simple framework was
inherited from previous developers. But, as for me, it is a good
solutions for project where you have a lot of _small_ requests to
server. For example, JBoss creates separate thread for every
connection and it is rather expensive operation if you have a lot of
small AJAX requests from 1000 and more clients.

Simple framework provides the article with comparisons of Simple's
(Continue reading)

Mike Wilson | 13 May 15:51
Picon
Favicon

RE: Long time processing in the DwrServlet.service()

> MW> I would suggest you try your application in a regular 
> servlet engine,
> MW> like f ex Tomcat or Jetty, and report back if you still have any 
> MW> problems. Reproducing your error in a "standard" 
> environment will make
> MW> it much easier for other developers on the list to help you.
> 
> Certainly it will be good, but unfortunately, I have not chance to do
> it easily. And it is why I ask you for ideas (potential solutions)
> about reason why/where DwrServlet keeps (can keep) request for a long
> time. And have not chance to debug it because of it is hard to
> reproduce this issue locally (with good network connection).

Ok, but be aware that you will get less help with an unknown 
environment. It could be helpful if you deployed some of the DWR demo 
apps on your custom environment, to see if you get the same problem 
there (that would rule out one unknown variable = your application).

> I have no ideas how to localize the problem in a short term and why
> processing time the same with Comet request maximum connection time.

You need to provide a lot more information about your scenario:
- DWR version?
- Which request are you talking about? (Originating from a call on
  a JavaScript proxy object or from a DWR Reverse Ajax poll?)
- Describe more about the call that you are timing, sequence of
  operations, normal behaviour and expected times.
- Can you snoop and provide a HTTP log from when the problem appears?

Also think about this:
(Continue reading)

Dmitry Kudrenko | 13 May 20:24
Picon
Favicon

Re[2]: Long time processing in the DwrServlet.service()

Greetings, Mike

>> ..., I have not chance to do
>> it easily. And it is why I ask you for ideas (potential solutions)
>> about reason why/where DwrServlet keeps (can keep) request for a long
>> time. And have not chance to debug it because of it is hard to
>> reproduce this issue locally (with good network connection).

MW> Ok, but be aware that you will get less help with an unknown 
MW> environment. It could be helpful if you deployed some of the DWR demo 
MW> apps on your custom environment, to see if you get the same problem 
MW> there (that would rule out one unknown variable = your application).

Yes, I know that and really don't wait for the ready solution. And
thank you a lot for your help and work you did/doing for DWR community.

Certainly, I will try to investigate the problem with standard JEE
way. I want to add Filter with timer to my test application to
calculate all request processing times.

MW> You need to provide a lot more information about your scenario:
MW> - DWR version?
Oops. Forgot to write. dwr-2.0.3

MW> - Which request are you talking about? (Originating from a call on
MW>   a JavaScript proxy object or from a DWR Reverse Ajax poll?)

I wanted to say request to the simple method in my Java class which is mapped to the
javascript.

(Continue reading)

Mike Wilson | 14 May 14:21
Picon
Favicon

RE: Long time processing in the DwrServlet.service()

> MW> You need to provide a lot more information about your scenario:
> MW> - DWR version?
> Oops. Forgot to write. dwr-2.0.3

There have been some small changes to thread wake-up for 2.0.4 so you
could try the Release Candidate 1 at 
https://dwr.dev.java.net/servlets/ProjectDocumentList?folderID=9081

>           StatisticManager.addValue(request.getPath(), duration);

Nice explanation of your tests, and yes they make sense I think.
Use
  request.getPathInfo()
instead of getPath() in your next deploy as this is the value that 
DWR bases its decisions on. Just to be sure. 
(See UrlProcessor.handle)

> Name                                    Num       Min     Max 
>     Ave     Disp
> --------------------------------------------------------------
> ------------------
> ...
> Send method                             74635     0       22  
>     2       2
> /dwr/call/plaincall/Client.send.dwr     74740     0       
> 59999   268     3352
> /dwr/call/plainpoll/ReverseAjax.dwr     30600     502     
> 60000   2009    7070
> ...
> 
(Continue reading)

Dmitry Kudrenko | 14 May 20:15
Picon
Favicon

Re[2]: Long time processing in the DwrServlet.service()

Greetings, Mike

MW> There have been some small changes to thread wake-up for 2.0.4 so you
MW> could try the Release Candidate 1 at 
MW> https://dwr.dev.java.net/servlets/ProjectDocumentList?folderID=9081
Ok. I will try it in the 2nd stage after applying all other your
suggestions. To be sure that something is changed. :)

>> StatisticManager.addValue(request.getPath(), duration);

MW> Nice explanation of your tests, and yes they make sense I think.
MW> Use  request.getPathInfo() instead of getPath() in your next
MW> deploy as this is the value that DWR bases its decisions on. Just
MW> to be sure. (See UrlProcessor.handle)
There is no equest.getPathInfo() in simple. And it returns in the
Adaptor between simple and servlet APIs.

Hm.. I will check the req.getPathInfo();
Thanks

>> Interesting note: /dwr/call/plaincall/Client.send.dwr request started
>> more times than "Send method". But I didn't find Error 
>> message in the log.

MW> That's interesting. I wonder if DWR somehow could be picking up the 
MW> wrong handler for these 105 calls, and this is when you see the delay
MW> (would make sense with the Avg time you are seeing). Normally your
MW> Client.send calls should be routed through PlainCallHandler.

MW> It would be interesting to see the response data being returned
(Continue reading)

Mike Wilson | 14 May 21:23
Picon
Favicon

RE: Long time processing in the DwrServlet.service()

> MW> Use  request.getPathInfo() instead of getPath() in your next
> MW> deploy as this is the value that DWR bases its decisions on. Just
> MW> to be sure. (See UrlProcessor.handle)
>
> There is no equest.getPathInfo() in simple. And it returns in the
> Adaptor between simple and servlet APIs.
> 
> Hm.. I will check the req.getPathInfo();

Ah yes, my bad. It's the HttpServletRequest I was thinking about
so use req.getPathInfo().

> MW> You could also make your JavaScript code count the number of 
> MW> successful callback returns and error/exception callback returns
> MW> resulting from your Client.send.
> 
> Ok, yes. it should give us new information. I will add the 
> counter to the
> JavaScript and counter of request with duration more than 30 sec and
> will compare them.

Yes, and also please count in error/exception callbacks as this may
signal any error code returns.

Best regards
Mike
Dmitry Kudrenko | 9 Jun 13:31
Picon
Favicon

Re[2]: Long time processing in the DwrServlet.service()

Greetings, Mike

Could it be the same issue with
http://www.nabble.com/Dwr-2.0.3,-reverseAjaxEnabled-and-IE6-td16031191.html

>> MW> Use  request.getPathInfo() instead of getPath() in your next
>> MW> deploy as this is the value that DWR bases its decisions on. Just
>> MW> to be sure. (See UrlProcessor.handle)
>>
>> There is no equest.getPathInfo() in simple. And it returns in the
>> Adaptor between simple and servlet APIs.
>> 
>> Hm.. I will check the req.getPathInfo();

MW> Ah yes, my bad. It's the HttpServletRequest I was thinking about
MW> so use req.getPathInfo().

I did, but the situation is the same. The PathInfo() is correct.

>> MW> You could also make your JavaScript code count the number of 
>> MW> successful callback returns and error/exception callback returns
>> MW> resulting from your Client.send.
>> 
>> Ok, yes. it should give us new information. I will add the 
>> counter to the
>> JavaScript and counter of request with duration more than 30 sec and
>> will compare them.

MW> Yes, and also please count in error/exception callbacks as this may
MW> signal any error code returns.
(Continue reading)

Mike Wilson | 10 Jun 13:07
Picon
Favicon

RE: Long time processing in the DwrServlet.service()

Hi Dmitry, 

> Could it be the same issue with
>
http://www.nabble.com/Dwr-2.0.3,-reverseAjaxEnabled-and-IE6-td16031191.html

Probably not. This only regards an IE bug that would
normally make the browser hang but not the server. And you are
seeing the DWR servlet hang in service() for 60 secs right?

> >> MW> You could also make your JavaScript code count the number of 
> >> MW> successful callback returns and error/exception 
> callback returns
> >> MW> resulting from your Client.send.
> >> 
> >> Ok, yes. it should give us new information. I will add the 
> >> counter to the
> >> JavaScript and counter of request with duration more than 
> 30 sec and
> >> will compare them.
> 
> MW> Yes, and also please count in error/exception callbacks 
> as this may
> MW> signal any error code returns.
> 
> I did the number of errors in the client side = number of long time
> requests. Where target method is not executed.

I'm not totally sure on what you mean here. Could you describe
your numbers in a bit more detail? (And the actual numbers are 
(Continue reading)

Dmitry Kudrenko | 10 Jun 14:37
Picon
Favicon

Re[2]: Long time processing in the DwrServlet.service()

Hello, Mike
Thank you for your response.
>> Could it be the same issue with
MW> http://www.nabble.com/Dwr-2.0.3,-reverseAjaxEnabled-and-IE6-td16031191.html

MW> Probably not. This only regards an IE bug that would
MW> normally make the browser hang but not the server. And you are
MW> seeing the DWR servlet hang in service() for 60 secs right?

Yes. I saw this issue reproduced only with IE, but I am not sure that
it is only IE issue. And DWR servlet hangs in service() for 60 secs.

>> >> MW> You could also make your JavaScript code count the number of 
>> >> MW> successful callback returns and error/exception 
>> callback returns
>> >> MW> resulting from your Client.send.
>> >> 
>> >> Ok, yes. it should give us new information. I will add the 
>> >> counter to the
>> >> JavaScript and counter of request with duration more than 
>> 30 sec and
>> >> will compare them.
>> 
>> MW> Yes, and also please count in error/exception callbacks 
>> as this may signal any error code returns.
>> 
>> I did the number of errors in the client side = number of long time
>> requests. Where target method is not executed.

MW> I'm not totally sure on what you mean here. Could you describe
(Continue reading)

Dmitry Kudrenko | 10 Jun 15:50
Picon
Favicon

Re[3]: Long time processing in the DwrServlet.service()

DK> often. I am waiting to apply modifications. I also want to send
DK> exception description from the client to server side.
I reproduced this issue with IE. The DebugBar HTTP(S) tab shows me the
following:

POST /dwr/call/plaincall/Client.send.dwr HTTP/1.1

callCount=1
page=/webclient.html
httpSessionId=
scriptSessionId=BC2DC6A1CE3783D23B577C6EA8F54DBA396
c0-scriptName=Client
c0-methodName=send
c0-id=0
c0-param0=number:3844
c0-param1=string:n
c0-param2=boolean:false
batchId=3920

And there is no difference between success request and this one.

It seems the request fault with the following error:

throw 'allowScriptTagRemoting is false.';
//#DWR-REPLY
if (window.dwr) dwr.engine._remoteHandleBatchException({
name:'org.directwebremoting.extend.ServerException', message:'Failed to read input' });
else if (window.parent.dwr) window.parent.dwr.engine._remoteHandleBatchException({
name:'org.directwebremoting.extend.ServerException', message:'Failed to read input' });

(Continue reading)

Mike Wilson | 11 Jun 21:43
Picon
Favicon

RE: Long time processing in the DwrServlet.service()

Hi Dmitry,

> >> I did the number of errors in the client side = number of long time
> >> requests. Where target method is not executed.
> 
> MW> I'm not totally sure on what you mean here. Could you describe
> MW> your numbers in a bit more detail? (And the actual numbers are 
> MW> interesting too)
>
> I did the following:
> 
<snip>
> 
> So, I have the numbers like the following:
> 
>                    Name                       Num     Min     
> Max      Ave
> --------------------------------------------------------------
> ----------------
> Normal /call/plaincall/Client.send.dwr        98      3       
> 200      9
> Slow /call/plaincall/Client.send.dwr          2       59999   
> 60000    60000
> 
> SendMessage                                   98      2       
> 180      6
> 
> send-requests                                 100     ...
> send-errors                                   2       ...
> send-callbacks                                98      ...
(Continue reading)

Joe Walker | 4 Jul 19:28

Re: Long time processing in the DwrServlet.service()



On Wed, Jun 11, 2008 at 8:43 PM, Mike Wilson <mikewse-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:
Great! I think this will help us a lot. I'm guessing that this
exception is thrown from ParseUtil.java:110 while it is reading
the POST body from the request InputStream.
As these requests are delayed by 60 secs my next guess is that it
is waiting for data and times out. Is the SimpleFramework socket
possibly configured with a timeout of 60 secs? Could you configure
the Simple socket to another timeout value and try again?

Maybe you could also configure your SimpleReq->ServletReq adapter
to spy on the input stream and log what data is actually fetched
by DWR for the different requests, so we can see how much DWR is
actually fetching before giving up on the slow requests.

I'm also noting that the
 throw new ServerException
on line 110 isn't being logged, so we can't see the nested exception.

Joe: could we add logging of this exception?

Yes, but I'm not keen on doing this to 2.0.
I'm just checking something for this into HEAD, can you try it out there?

Joe.


Gmane