Skip to main content

Invalid Chunk Header

7 replies [Last post]
hsirges
Offline
Joined: 2010-01-20

Hi,

I'm running a webservice on GlassFish v3 (build 74.2) with a JavaME client program.
For one specific mobile device i receive an IOException (stacktrace below) with message "Invalid chunk header".
I have already found the thread
http://forums.java.net/jive/thread.jspa?messageID=374212&#374212
where the same problem is described.
I applied the patch from
https://glassfish.dev.java.net/issues/show_bug.cgi?id=6303 and set the jvm-options they mentioned in the thread but i still get the "invalid chunk header" message.

I captured the network traffic for both a successful and an unsuccessful request
(attachment cap-file).
Frame 20 and 22 show the successful request.
Frame 75 and 76 show the unsuccessful request.
As you can see frame 76 only contains the "chunk-lenght" part of the chunked http content. The data part is sent in frame 79 but Glassfish had already sent the "invalid chunk header" response in frame 77.

Is this a client or should Glassfish usually accept the chunked body split over multiple frames and there is something wrong with the server?

Best regards,

Hendrik

Message ID java.io.IOException
Complete Message Invalid chunk header at com.sun.grizzly.tcp.http11.filters.ChunkedInputFilter.doRead(ChunkedInputFilter.java:169) at com.sun.grizzly.tcp.http11.InternalInputBuffer.doRead(InternalInputBuffer.java:736) at com.sun.grizzly.tcp.Request.doRead(Request.java:490) at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:331) at com.sun.grizzly.util.buf.ByteChunk.substract(ByteChunk.java:378) at org.apache.catalina.connector.InputBuffer.readByte(InputBuffer.java:343) at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:161) at java.io.DataInputStream.readShort(DataInputStream.java:295) at com.sanderdoll.ws.WebToMobileServlet.doPost(WebToMobileServlet.java:117) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619)

Message was edited by: hsirges

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
is_true
Offline
Joined: 2010-04-10

Hi,

I am sorry to ride along on your thread. But i am also facing the same problem with you. So did you manage to find a solution to it?? This problem only surface when i tested it on HTC HD2.

Kevin

Oleksiy Stashok

Hi,

are you using GFv3? Did you try a patch provided @ https://glassfish.dev.java.net/issues/show_bug.cgi?id=6303?

Thanks.

WBR,
Alexey.

On Apr 11, 2010, at 8:10 , glassfish@javadesktop.org wrote:

> Hi,
>
> I am sorry to ride along on your thread. But i am also facing the
> same problem with you. So did you manage to find a solution to it??
> This problem only surface when i tested it on HTC HD2.
>
> Kevin
> [Message sent by forum member 'is_true']
>
> http://forums.java.net/jive/thread.jspa?messageID=396311
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

[att1.html]

is_true
Offline
Joined: 2010-04-10

Hi Oleksiy ,

So sorry for my late reply.

I am using Netbeans 6.8 which runs Sun GlassFish Enterprise Server v3.

I have replace the grizzly-utils.jar at
C:\Program Files\sges-v3\glassfish\modules. But i still experiencing the same error java.io.IOException: Invalid chunk header.

Is there any setting that i need to do prior to that? If yes, please guide me as i am new to this. Thanks a million...

Kevin

Oleksiy Stashok

Hi Kevin,

is it difficult to reproduce the issue?
May be you can create a simple test case for it?

Thank you in advance.

WBR,
Alexey.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

is_true
Offline
Joined: 2010-04-10

Hi Alexey,

No thank you for helping me out for i am very new to the programming society.

Anyway if not difficult to reproduce the problem as it will definitely occur when ever i tried to connect the GF from the HTC HD2 mobile device. Only this device is giving the problem so far.

you want me to reproduce a test case meaning?? Test case on my codes or something else?? Can you show me an sample then i can follow it. Sorry for the noob question.

Kevin

is_true
Offline
Joined: 2010-04-10

Hi Alexey,

I manage to solve the error. Apparently is my code that is causing the problem. Not sure why this problem only surface on HTC HD2.

DataOutputStream os = (DataOutputStream)c.openDataOutputStream();
os.writeUTF(info);
os.flush();
os.close();

The above code is called when i am trying to send info to the server. The line that is causing the problem is os.flush(). My program works like a charm when i commented that out. Yup. Not really sure why it works after i commented that line out. I got to know this from another forum where that guy advice me to comment it out as os.flush(); behaves differently on different mobile devices.

Thanks for your help. Really appreciate it. :)

Oleksiy Stashok

Hi,

very interesting, can you pls. give us update, once you'll figure out
what was the problem with os.flush? Cause as I understand you're not
the only person who observes this problem.

Thank you in advance.

WBR,
Alexey.

On Apr 18, 2010, at 5:53 , glassfish@javadesktop.org wrote:

> Hi Alexey,
>
> I manage to solve the error. Apparently is my code that is causing
> the problem. Not sure why this problem only surface on HTC HD2.
>
> DataOutputStream os = (DataOutputStream)c.openDataOutputStream();
> os.writeUTF(info);
> os.flush();
> os.close();
>
> The above code is called when i am trying to send info to the
> server. The line that is causing the problem is os.flush(). My
> program works like a charm when i commented that out. Yup. Not
> really sure why it works after i commented that line out. I got to
> know this from another forum where that guy advice me to comment it
> out as os.flush(); behaves differently on different mobile devices.
>
> Thanks for your help. Really appreciate it. :)
> [Message sent by forum member 'is_true']
>
> http://forums.java.net/jive/thread.jspa?messageID=397595
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net