Malformed response message

I am running a networked J2ME application. Things work great for a while then, at random times, I get a IOException "malformed response message" when I try to process an ouput stream. could any one tell me some of the reason why I could be getting this message ?

Links to more information are also welcomed.

Thanks in advance.

[354 byte] By [fmhunter] at [2007-9-26 3:27:58]
# 1
I also get this problem when testing using the sun toolkit.Did you every resolve the problem ?
gary.ranson at 2007-6-29 11:51:14 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
Nope, not really. I did a mayor refactory of my network code and that seemed to make the problem go away for the most part. However, it's still manifesting itself once in a while. Sorry. I'll post an answer here if I ever find one. :(
fmhunter at 2007-6-29 11:51:14 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

Here's the stack trace on the IOException:

java.io.IOException: malformed response message

at com.sun.midp.io.j2me.http.Protocol.readResponseMessage(+138)

at com.sun.midp.io.j2me.http.Protocol.connect(+603)

at com.sun.midp.io.j2me.http.Protocol$PrivateOutputStream.flush(+17)

at java.io.DataOutputStream.flush(+7)

For me, this is only happening in a polling thread that's issuing a POST every handful of seconds. While this thread is running, another thread can issue a second POST request.

Do you have one and only one thread? Perhaps Sun has a multi-threading bug in http.Protocol?

luni at 2007-6-29 11:51:14 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
This is exactly the problem I am having. I never saw this message untill I added a thread that send a message to the server every 3 secs.How do you think we could resolve this problem? Do you really think it could be a bug, or something we are doing?
fmhunter at 2007-6-29 11:51:14 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

I submitted this to the Bug Parade, but they want more information.

Specifically,

1- Do you have more than one thread issuing HTTP requests?

2- Do you close the HttpConnection between requests or reuse it?

3- Are you performing GET or POST queries?

4- If POST, how much data are you sending?

5- What type of content are you receiving in the reply?

6- How big is the reponse data?

7- Are there any non-standard headers in the query or response?

8- Are you sending the request to Tomcat or another HTTP server?

luni at 2007-6-29 11:51:14 > top of Java-index,Java Mobility Forums,Java ME Technologies...