users@grizzly.java.net

Problem with Suspend/Resume

From: Gay David (Annecy) <"Gay>
Date: Wed, 19 Jan 2011 16:32:32 +0100

Hi all,

 

I've got a problem with Grizzly with the Suspend/Resume mode.

I've write a small test trying to reproduce what's happen sometimes in
our server.

(A whole Maven project is attached, just unzip and run 'mvn clean test'
to reproduce it)

 

Basically this test suspend the response and delegate the computation of
the request to a Thread pool executor and then resume the request.

 

While running the test, there are some error, most often there is a NPE
here :

 

java.lang.NullPointerException

        at com.sun.grizzly.tcp.Response.resume(Response.java:784)

        at com.acme.MyExecutor.run(MyExecutor.java:55)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:886)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:908)

        at java.lang.Thread.run(Thread.java:619)

 

(I made the test on windows XP with JDK 1.6.0_21)

 

I would like to know if someone has already see this problem ?

Is what I am doing just crazy ? ;-)

Do I misunderstand how to play with suspend/resume ?

Is there a problem in Grizzly ?

 

PS1 : I have better result if I add a small sleep here in the MyExecutor
class :

 

...

    @Override

    public void run()

    {

        try

        {

            Thread.sleep( 5 );

            res.setStatus( 200 );

...

 

It sounds like a synchronize problem ?

 

PS2 : I also made the test on an Ubuntu, and I've other problems :

 

GRAVE: GRIZZLY0038: HTTP Processing error.

java.lang.NullPointerException

                at
com.sun.grizzly.tcp.SuspendResponseUtils.attach(SuspendResponseUtils.jav
a:61)

                at
com.sun.grizzly.tcp.Response.suspend(Response.java:945)

                at
com.sun.grizzly.tcp.Response.suspend(Response.java:884)

                at
com.sun.grizzly.tcp.Response.suspend(Response.java:858)

                at
com.sun.grizzly.tcp.Response.suspend(Response.java:841)

                at com.acme.MyAdapter.service(MyAdapter.java:34)

                at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:818)

                at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)

                at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1008)

                at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter
.java:225)

                at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtoc
olChain.java:137)

                at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:1
04)

                at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:9
0)

                at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79
)

                at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask
.java:54)

                at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.jav
a:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool
.java:532)

                at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.ja
va:513)

                at java.lang.Thread.run(Thread.java:662)

19 janv. 2011 16:25:40 com.sun.grizzly.http.ProcessorTask parseRequest

GRAVE: GRIZZLY0041: Unblocking keep-alive exception.

java.lang.NullPointerException

                at
com.sun.grizzly.tcp.http11.InternalInputBuffer.fill(InternalInputBuffer.
java:768)

                at
com.sun.grizzly.tcp.http11.InternalInputBuffer.parseRequestLine(Internal
InputBuffer.java:402)

                at
com.sun.grizzly.http.ProcessorTask.parseRequest(ProcessorTask.java:851)

                at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:692)

                at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1008)

                at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter
.java:225)

                at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtoc
olChain.java:137)

                at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:1
04)

                at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:9
0)

                at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79
)

                at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask
.java:54)

                at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.jav
a:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool
.java:532)

                at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.ja
va:513)

                at java.lang.Thread.run(Thread.java:662)

 

 

Thanks for any help or tips.

Regards

David