Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] EXTERNAL: Re: jetty client delivers incomplete response without exception?
  • From: "Robben, Bert" <Bert.Robben@xxxxxxxxxxxxx>
  • Date: Fri, 15 Apr 2022 10:00:17 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fisglobal.com; dmarc=pass action=none header.from=fisglobal.com; dkim=pass header.d=fisglobal.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wfbuV3lzL9BAPqTUBf0Er50iWg/ivO3Aag/ZB1sSitg=; b=EiNaog5UtX4gtnbF5lEUEy/5fYyisiBLDvFUAbjsEPy0epTCPbrpNjMAXM2p8DM8GkJfMndkkiCr8tUSybYLSkj6g/mFkljrvvMUYqIMupbw5iHthX2Sd+5AKtfUpfHylRBlM3kw38c6EcWp9W4P0h9elVlkAKVj0+1wXS5ipYUVNwK3/uvozsy5QcqzZMFN34qmgjF63wqH58YbIPkGrX1U15Htid7zczAkubu0ocKklhq/HPbYr4qPfenCodKgyqQ9cHuemNnwOMM34sb2dNvVs3h0AOgP6qZKqfMdQeIL8fQG073WaS0mLhVb8Y0HIEgCDMIvybhqzbr/FWxP9A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aVdVpbvnx7cdrYln15JovuQJtp2sPJoGHNzjFsCoEESE+nuVkSiCph7Jb5PO6mY7V2sbgVriY2I/bVU+xfu7jgH7vSkBAD4RcSjbb46LjWijfMTvK0LU81zTzCm9KdklmijhBIzp/y4eUqXW0svpQgHZPzcnQaB5hMQ+oZ1zR0ScghgGjgP3Q0BmH03KFTyiJANoVdEASr2SnS5NvG1Vt/wt8y8q+8PcL+YJM+Zo2MNQW6kE/GA4/73EL4uP2orvsP2oj5kYpUo+nkZzGPhT9M4/fufBgDxtrjsu3Pr1jSeYjidO0ML85S7QTrXrR3iSg4EglaMSHPXjyIYsjGyfNg==
  • Delivered-to: jetty-users@xxxxxxxxxxx
  • Disclaimersource: eop
  • List-archive: <https://www.eclipse.org/mailman/private/jetty-users/>
  • List-help: <mailto:jetty-users-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AdhQFhgH9tNRmK7WQoq4ltsCz18IGQAA6cwAACVY35A=
  • Thread-topic: EXTERNAL: Re: [jetty-users] jetty client delivers incomplete response without exception?

Thanks for the reply.

 

Since we actively kill the server ourselves (as part of our test), I’m not surprised at all connections are closed prematurely. These exceptions are all expected and what I want.

 

The problem is that for the other request that the test did, there was NO EXCEPTION at all. From the client’s point-of-view, the request finished correctly. The problem was that the response was incomplete. My question is if it is normal behavior for the client to sometimes only get a subset of the response data with NO exceptions being thrown at all.

 

Since this test failed only once in many runs, I think there is some race condition involved.

 

Bert

 

From: jetty-users <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Joakim Erdfelt
Sent: Thursday, 14 April, 2022 6:08 PM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: EXTERNAL: Re: [jetty-users] jetty client delivers incomplete response without exception?

 

CAUTION: This email originated from outside of the company. Do not click links or open attachments unless you recognize the sender and know the content is safe.

 

> Caused by: java.io.IOException: Connection reset by peer

>                  at sun.nio.ch.IOUtil.write(IOUtil.java:148)

 

This means the remote side closed the connection prematurely during a write operation.

This is fishy, and I would consider it a red-flag that the remote isn't following the HTTP spec properly.

 

You can verify if all of the data was legitimately sent over the network using a tracing tool like wireshark.

You can also determine how that data was sent (with Content-Length, using Transfer-Encoding: chunked, compressed or not, or using super old school HTTP/1.0 techniques of raw bytes and closure of the connection).

 

Joakim Erdfelt / joakim@xxxxxxxxxxx

 

 

On Thu, Apr 14, 2022 at 10:47 AM Robben, Bert via jetty-users <jetty-users@xxxxxxxxxxx> wrote:

Hey,

 

I had a test failure (race condition, saw it only once) where a jetty client makes a request on a jetty server and only gets an incomplete response back. The jetty client does an asynchronous POST and consumes the response using an InputStreamResponseListener.

 

                try (InputStream inputStream = listener.getInputStream()) {

                    long dataReceived = 0;

                    byte[] buffer = new byte[…];

                    int read = inputStream.read(buffer);

                    while (read >= 0) {

                        dataReceived += read;

                        read = inputStream.read(buffer);

                    }

 

This loop ends without exceptions. However, the amount of data in the response (dataReceived) is > 0, but a lot smaller than expected which makes the test fail.

 

Important to know is that at the moment of this failure, the server was killed (as part of the test). Other requests that were ongoing get exceptions like the ones below. I understand and fully expect these exceptions. What I don’t understand is why the request that was consuming its response didn’t get any.

 

Is it wrong from me to assume I’ll always get some exception in case the server is killed?

 

I assume that our server-side resource is working as it should (so it completes when the entire response has been sent to the output); so this one doesn’t count.

 

Note that the server does NOT fill in the CONTENT_LENGTH of the response; as such the client doesn’t know when the stream will end. Is it possible that the client interprets closure of the response stream sometimes as “ok, this is the end” and doesn’t throw exceptions?

 

 

Here are some of the other exceptions from other (but different) requests:

 

[2022-04-12 03:09:49,154] [ERROR] [] [http-requests] [] - 1649732989067,87,GET,http://test-product:8080/test-product/v1/clustersingleton/clusterinfo/clusterInfoProvider?id=554d75d7-5c16-47e4-95e9-c0b110d1ec40-3484&replyAfter=110,EOFException,"HttpConnectionOverHTTP@48aa14a1::SocketChannelEndPoint@4c95996c{l=/10.233.90.85:35120,r=test-product/10.233.45.8:8080,ISHUT,fill=-,flush=-,to=85/29123}{io=0/0,kio=0,kro=1}->HttpConnectionOverHTTP@48aa14a1(l:/10.233.90.85:35120 <-> r:test-product/10.233.45.8:8080,closed=false)=>HttpChannelOverHTTP@9971e9a(exchange=HttpExchange@20c3f0a6{req=HttpRequest[GET /test-product/v1/clustersingleton/clusterinfo/clusterInfoProvider HTTP/1.1]@38d4f703[TERMINATED/null] res=HttpResponse[null 0 null]@586a478c[PENDING/null]})[send=HttpSenderOverHTTP@69b8e1d5(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@56417a84{s=START}],recv=HttpReceiverOverHTTP@4932f3a0(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]"

 

                                at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.earlyEOF(HttpReceiverOverHTTP.java:376)

                                at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:181)

                                at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:131)

                                at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)

                                at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)

                                at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1614)

 

and

 

                java.io.IOException: org.eclipse.jetty.io.EofException

                                at org.eclipse.jetty.client.util.OutputStreamContentProvider$DeferredOutputStream.flush(OutputStreamContentProvider.java:151)

                Caused by: java.io.IOException: Connection reset by peer

                                at sun.nio.ch.IOUtil.write(IOUtil.java:148)

 

This test failure was exceptional; I suspect some race condition on the server.

 

Note: I was using Jetty 9.4.43.v20210629 in this test. (I’ve now upgraded to 9.4.46)

 

Thanks,

 

Bert

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.

Back to the top