Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359175 - Exchange onException,onConnectionFailed not called on errors with RedirectListener
Summary: Exchange onException,onConnectionFailed not called on errors with RedirectLis...
Status: CLOSED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: client (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.5.x   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-28 00:29 EDT by David Kellum CLA
Modified: 2011-09-28 11:37 EDT (History)
1 user (show)

See Also:


Attachments
Implement-RedirectListener.onException-on.patch (1.33 KB, patch)
2011-09-28 00:31 EDT, David Kellum CLA
jesse.mcconnell: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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