Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359175

Summary: Exchange onException,onConnectionFailed not called on errors with RedirectListener
Product: [RT] Jetty Reporter: David Kellum <dek94>
Component: clientAssignee: Jan Bartel <janb>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jetty-inbox
Version: unspecified   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Implement-RedirectListener.onException-on.patch jesse.mcconnell: iplog+

Description David Kellum CLA 2011-09-28 00:29:47 EDT
Build Identifier: 7.4.5-7.5.1

waitForDone() never returns if onException,onConnectionFailed when RedirectListener is running.

I noticed that my exchange wasn't getting called if the next request after a 301/302 redirect fails with onConnectionFailed() or onException(). Looks like RedirectListener disables deligating and then doesn't specifically re-enable it in these cases: HttpEventListenerWrapper ends up dropping the onException,onConnectionFailed() on the floor.

Here is an extract from a test case which can reproduce this:

bs.accept do |sock|
  sock.write "HTTP/1.1 302 Found\r\n"
  sock.write "Location: http://localhost:54929/no-exist\r\n"
  sock.write "Content-Type: text/plain\r\n"
  sock.write "Transfer-Encoding: chunked\r\n"
  sock.write "\r\n"
  sock.write "FF3DF\r\n"
  sock.write "An incomplete chunk"
  sock.write "An incomplete chunk"
  sock.write "An incomplete chunk"
  sock.close
end

waitForDone() never returns in this case.

I was able to fix this by overriding RedirectListener with the (patch attached) methods. 

Reproducible: Always
Comment 1 David Kellum CLA 2011-09-28 00:31:07 EDT
Created attachment 204141 [details]
Implement-RedirectListener.onException-on.patch
Comment 2 David Kellum CLA 2011-09-28 00:31:36 EDT
This mirrors: https://jira.codehaus.org/browse/JETTY-1421
Comment 3 Jesse McConnell CLA 2011-09-28 11:36:32 EDT
applied, thanks much