Hello.

I return with my problem, now with more information.

Guys at the server side (the use Apache) told me they don't have any
problem related to dropping connections, and even they assure me the
server did receive my request and at least logged the response.

They have two servers: the main one and the failover server. In case the
first is in troubles we can try with the second. 

If we get the "unable to find the line starting with HTTP" Exception and
keep trying with the same server, the exception is continously catched.
If we change to the failover one, the problem disappears.

I have two ideas about that:

- The main server is under heavy load or another similar problem, so it
drops our connections and the problem is solved when we try with the
other server.

- Maybe the problem is in our side and changing the URL (changing the
server) implies destroying a "broken" object and creating a fresh one.
The new object can handle the new connection without any problem.

Could the second possibility be true in some aspect? 

In my code every HTTP POST request is handled by a new thread. I create
a HttpClient object in the beginning and manage the request inside a
loop, where I create a new PostMethod at every new iteration. If the
request doesn't success, PostMethod.releaseConnection() isn't called and
a new PostMethod (with the failover server's URL) is created to retry
the same POST. Anyway, the thread finally dies.

Another question: what can I do to check whether the server is really
working properly or not? Should I enable any kind of log?

And finally: I'm thinking in starting to use
MultiThreadedHttpConnectionManager. Is there anythig I should be worried
about? I've seen there is an open bug related to
staleConnectionChecking.

Thank you very much.

Juan Pedro López


> Thank you for your responses.
> 
> Actually, I can't do anything in the server side because it's managed by
> an external service provider. I don't know what server are they running
> but I'll try to find it. 
> 
> I thought the problem was in the client side, but now I think I'll try
> to ask them to solve the problem. Retrying the requests could be a
> problem if the server really receives and processes them.  
> 
> I'll tell you about this issue when I know new matters.
> 
>       Juan Pedro López
> 
> > I am seeing this exact same problem with 2.0rc1 as well.  A wget to the 
> > server from the same client works fine.  The httpclient wire log shows 
> > that I get a redirect and then the in waiting for the HTTP status line 
> > from the redirect, it never comes...
> > 
> > What server are you running?
> > 
> -Eric
> > 
> > 
> > Kalnichevski, Oleg wrote:
> > 
> > > Juan,
> > > Usually HttpClient reports 'unable to find line starting with "HTTP"' when the 
> > > target server drops the connection without returning any response. This can 
> > > happen, for instance, if the server is being under heavy load. 
> > > 
> > > (1) If you have access to the target server, examine the server logs to see why 
> > > the connection was dropped. Fixing the problem on the server side would be the 
> > > best
> > > 
> > > (2) Another possible solution to this problem _may_ be to retry the request, 
> > > provided that the POST methods your code is supposed to execute are idempotent. 
> > > If the server application, however, has been designed in a way that it may 
> > > receive a request, parse it, change the application state (by committing some 
> > > data to the data store, for instance) and then simply drop the connection 
> > > without giving any kind of response back to the client, you are in 
> > > <strong>BIG</strong> trouble, as simply retrying the same POST method case cause 
> > > data inconsistency problems. So, the best thing to do is to get in touch with 
> > > the server guys and find out if it is safe to retry POST methods.
> > > 
> > > Hope this clarifies things a little
> > > 
> > > Oleg
> > > 
> > > 
> > > 
> > > -----Original Message-----
> > > From: Juan Pedro López Sáez [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, June 02, 2004 17:18
> > > To: [EMAIL PROTECTED]
> > > Subject: unable to find line starting with "HTTP"
> > > 
> > > 
> > > Hi,
> > > 
> > > I've been searching in the archive list looking for something related to
> > > my "unable to find line starting with HTTP". 
> > > 
> > > There are lots of comments about it, but they all seem to be unuseful
> > > for me.
> > > 
> > > Currently I'm using 2.0-rc3 version. My HTTP client is very simple.
> > > Below you can see everything I do. That code is executed everytime I
> > > need to send new data to the HTTP server.
> > > 
> > > --------------------------------------
> > > 
> > > HttpClient client= new HttpClient();
> > > client.setStrictMode(true);
> > > client.setTimeout(120000); 
> > > client.setConnectionTimeout(10000); 
> > > 
> > > PostMethod post = new PostMethod(currentURL);
> > > post.setRequestContentLength(XMLRequest.length());
> > > post.setRequestBody(XMLRequest);
> > > post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
> > > post.addRequestHeader("Connection", "close");
> > > 
> > > String response;
> > > 
> > > try{
> > > httpStatus = client.executeMethod(post);
> > > response = post.getResponseBodyAsString();
> > > }
> > > catch (HttpException e) {
> > > log.fatal("IOException in client.executeMethod( post )",e);
> > > throw e;
> > > }
> > > catch(IOException e){ 
> > > log.fatal("IOException in client.executeMethod( post )",e);
> > > throw e;
> > > }
> > > finally {
> > > post.releaseConnection();
> > > }
> > > 
> > > ------------------------------------------------
> > > 
> > > I'm getting the exception in the HttpClient.excetuteMethod line. The
> > > exception happens from time to time, is not quite common but I don't
> > > know what to do with it.  
> > > 
> > > The exception stack trace is the following:
> > > 
> > > org.apache.commons.httpclient.HttpRecoverableException:
> > > org.apache.commons.httpclient.HttpRecoverableException: Error in parsing
> > > the status  line from the response: unable to find line starting with
> > > "HTTP"
> > > at
> > > org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1965)
> > > at
> > > org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2659)
> > > at
> > > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1093)
> > > at
> > > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:674)
> > > at
> > > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)
> > > 
> > > I would apreciate any help.
> > > 
> > > Thank you very much
> > > 
> > > Juan Pedro López
> > > 
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Juan Pedro López Sáez
ALTIRIA TIC, Soluciones en Servicios Móviles
Tlf: 913 311 198
Móvil: 610 258 837
www.altiria.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to