Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] incorrect http 200 response while shutting down jetty
  • From: "Robben, Bert" <Bert.Robben@xxxxxxxxxxxxx>
  • Date: Mon, 11 Jul 2022 15:19:09 +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=V30xexgoRrsjZuvF3/2GFpqpScFKDDXEPM51IuFijvo=; b=FNkMUPsRbq7w8LFYEcHJJSOGUdBK7rcJbJhw8e0ccnXxJYDvbdZm9iBZiChynXBwjRC6Q6oozH7HIwdIWP6FvEMM3Ej3rODX9/9PKj1LpKdtP0LR0xAjnnL8xg32U8YaX3WnV4krAlnpa0u+asaUfsP+CKsWt1x3lyq+N7Ecv+ADcDSSP/W9d9mGbQNdmjeDhuh5tfOfQS67gD+UTjJt8Ak+1UGbjDKn/JwhLg3GsuXmB69i7UQueyopX+5VMO02LfaDTl2j1kwXPesh4RIT7dtYIG1M0s4m2Db2k51az/4zdskZg0LROC9+qBlXgJIFAsFLI4rvuSyh7elH3dzSVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=haeEwQ0MEGHuvvdjS8prRXMVCNUK2L/f9feeQnR3PUNjQ/2QD7Or8UpZDQ9G8f4VVzp3oey9AVE81drAevZJwZsgTRid4NCMsS3d0bCUJp4oBBnFn+m5/Mhi7GeFv/EfYEcCqSc9paNbtvMq5ZW0BDKhzipuXk/3Za+5jKw1NVtSlkZWn3XCv/AaYBOANTTiQe3IhVZPraMaHLruw+KPJ/5bA/RBNz7hYndwJDfvl5WZxQjBeYAq6yLmLAMQz0z1noF/03FfwtQeRI+CCpokFlhRvic1MBeL+HLqChrELrgJ1Yl/D+cWzu7WOxK/PF+KTtEJVJTjtxG9AfU46gnG8g==
  • 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>
  • Msip_labels: MSIP_Label_9e1e58c1-766d-4ff4-9619-b604fc37898b_ActionId=603f7226-d030-42ea-a2a0-c9f60c854a16; MSIP_Label_9e1e58c1-766d-4ff4-9619-b604fc37898b_ContentBits=0; MSIP_Label_9e1e58c1-766d-4ff4-9619-b604fc37898b_Enabled=true; MSIP_Label_9e1e58c1-766d-4ff4-9619-b604fc37898b_Method=Standard; MSIP_Label_9e1e58c1-766d-4ff4-9619-b604fc37898b_Name=Internal Use; MSIP_Label_9e1e58c1-766d-4ff4-9619-b604fc37898b_SetDate=2022-07-07T14:41:55Z; MSIP_Label_9e1e58c1-766d-4ff4-9619-b604fc37898b_SiteId=e3ff91d8-34c8-4b15-a0b4-18910a6ac575;
  • Thread-index: AdiSApzTV2tsliQaQQaZkBZSookX+wABauYAAAHa83AAynJ50A==
  • Thread-topic: [jetty-users] incorrect http 200 response while shutting down jetty

I added a simple unit test now to https://github.com/eclipse/jetty.project/issues/8271 that shows the issue.

 

From: jetty-users <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Robben, Bert via jetty-users
Sent: Thursday, 7 July, 2022 4:42 PM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Cc: Robben, Bert <Bert.Robben@xxxxxxxxxxxxx>
Subject: Re: [jetty-users] incorrect http 200 response while shutting down jetty

 

Done. See https://github.com/eclipse/jetty.project/issues/8271

 

From: jetty-users <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Joakim Erdfelt
Sent: Thursday, 7 July, 2022 3:49 PM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] incorrect http 200 response while shutting down jetty

 

This would make for a good issue to open.


Joakim Erdfelt / joakim@xxxxxxxxxxx

 

 

On Thu, Jul 7, 2022 at 8:46 AM Robben, Bert via jetty-users <jetty-users@xxxxxxxxxxx> wrote:

Hi,

 

We are using the graceful shutdown feature (in other words, we configured our Jetty server with the StatisticsHandler as advised in the aftermath of https://github.com/eclipse/jetty.project/issues/8210) and noticed that a small number of requests are now getting an incorrect HTTP 200 response. These requests enter the server just after we asked the server to stop (by calling Server#stop). The vast majority of requests that enter the server after we called stop are terminated with a proper 503. However, sometimes, one or two requests get this 200 response. The response is incorrect because it’s NOT delivered by our REST resources (they return HTTP 204, but never HTTP 200), and even worse, our server-side logic for this particular request was NOT executed. Before we started using StatisticsHandler we never got this.

 

I did some digging and managed to produce(*) a stack trace that shows that the response seems to be written because the statistics handler flushes the response buffer.

 

I think this issue is caused by a race condition where the server is not yet shut down in the beginning of StatisticsHandler.handle, but by the time execution reaches the end of this method, the server is shutting down.

 

at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:998)

at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:1086)

at org.eclipse.jetty.server.HttpOutput.channelWrite(HttpOutput.java:285)

at org.eclipse.jetty.server.HttpOutput.channelWrite(HttpOutput.java:269)

at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:751)

at org.eclipse.jetty.server.Response.flushBuffer(Response.java:1112)

at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:208)

at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

at org.eclipse.jetty.server.Server.handle(Server.java:516)

at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)

at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)

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.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)

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

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)

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

 

Debug logs are attached for a problematic request/response.

 

We’re using Jetty 9.4.46.v20220331

 

Bert

 

(*) For clarity, no exceptions are thrown. I just dumped the current stack trace at that point.

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.

FIS Internal Use Only

_______________________________________________
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.

FIS Internal Use Only

 

FIS Internal Use Only

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.

FIS Internal Use Only


Back to the top