You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2013/09/11 16:33:06 UTC

[Bug 55546] New: Connection hangs after Websocket upgrade through Apache AJP reverse proxy

https://issues.apache.org/bugzilla/show_bug.cgi?id=55546

            Bug ID: 55546
           Summary: Connection hangs after Websocket upgrade through
                    Apache AJP reverse proxy
           Product: Tomcat 7
           Version: 7.0.42
          Hardware: PC
                OS: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: archie@dellroad.org

I've encountered a hang when using a Vaadin application connecting to Apache
which in turn reverse proxies to Tomcat via the AJP connector and Websockets
are used. The bug does not occur when connecting to Tomcat directly.

I originally filed a bug with Vaadin: http://dev.vaadin.com/ticket/12435

According to their analysis, the bug is not a Vaadin bug but either an Apache
or Tomcat bug.

Please see that bug for details and a WAR file that demonstrates the problem.
To reproduce the problem, it was necessary for me to set up an Apache reverse
proxy like this:

  <LocationMatch "/demo3/">
    ProxyPass         ajp://127.0.0.1:8009/demo3/
    ProxyPassReverse  ajp://127.0.0.1:8009/demo3/
  </LocationMatch>

and then connect to the Tomcat application indirectly via Apache.

Due to the numerous moving parts and my incomplete understanding of them all,
I'll apologize in advance if this bug report is invalid.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55546] Connection hangs after Websocket upgrade through Apache AJP reverse proxy

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55546

--- Comment #6 from Archie Cobbs <ar...@dellroad.org> ---
> > So maybe this is just an Apache limitation.
> 
> No, it is also an AJP limitation and that protocol is owned by the Tomcat PMC.

Thanks, now I understand. So in the packet trace, AJP is simply passing along
those headers without really knowing what they mean or what to do about them.

> OK. We should take a look at that then as you you ideally see some
> form of error if you try an http upgrade over AJP.

Yes, that would help clarify what's going on and where the problem lies if/when
other folks run into this situation.

Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55546] Connection hangs after Websocket upgrade through Apache AJP reverse proxy

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55546

--- Comment #2 from Archie Cobbs <ar...@dellroad.org> ---
Thanks for the clarification.

What would be the appropriate next step then? Would getting this to work
constitute a feature request for Apache httpd, or Tomcat, or both?

FYI, the upgrade request does pass through to Tomcat via AJP and Tomcat does
respond (see packet trace below)... is this just accidental?

Thanks for helping me understand what is going on here.

09:23:22.191785 IP (tos 0x0, ttl 64, id 39678, offset 0, flags [DF], proto TCP
(6), length 842, bad cksum 0 (->9ead)!)
    127.0.0.1.59458 > 127.0.0.1.8009: Flags [P.], cksum 0x013f (incorrect ->
0x016f), seq 3415144928:3415145718, ack 538769145, win 9130, options
[nop,nop,TS val 3740489560 ecr 3740449039], length 790
    0x0000:  4500 034a 9afe 4000 4006 0000 7f00 0001  E..J..@.@.......
    0x0010:  7f00 0001 e842 1f49 cb8e f9e0 201c f6f9  .....B.I........
    0x0020:  8018 23aa 013f 0000 0101 080a def3 5758  ..#..?........WX
    0x0030:  def2 b90f 1234 0312 0202 0008 4854 5450  .....4......HTTP
    0x0040:  2f31 2e31 0000 0c2f 6465 6d6f 332f 5055  /1.1.../demo3/PU
    0x0050:  5348 2f00 0009 3132 372e 302e 302e 3100  SH/...127.0.0.1.
    0x0060:  ffff 0009 6c6f 6361 6c68 6f73 7400 0050  ....localhost..P
    0x0070:  0000 0da0 0b00 096c 6f63 616c 686f 7374  .......localhost
    0x0080:  00a0 0e00 514d 6f7a 696c 6c61 2f35 2e30  ....QMozilla/5.0
    0x0090:  2028 4d61 6369 6e74 6f73 683b 2049 6e74  .(Macintosh;.Int
    0x00a0:  656c 204d 6163 204f 5320 5820 3130 2e38  el.Mac.OS.X.10.8
    0x00b0:  3b20 7276 3a32 332e 3029 2047 6563 6b6f  ;.rv:23.0).Gecko
    0x00c0:  2f32 3031 3030 3130 3120 4669 7265 666f  /20100101.Firefo
    0x00d0:  782f 3233 2e30 00a0 0100 3f74 6578 742f  x/23.0....?text/
    0x00e0:  6874 6d6c 2c61 7070 6c69 6361 7469 6f6e  html,application
    0x00f0:  2f78 6874 6d6c 2b78 6d6c 2c61 7070 6c69  /xhtml+xml,appli
    0x0100:  6361 7469 6f6e 2f78 6d6c 3b71 3d30 2e39  cation/xml;q=0.9
    0x0110:  2c2a 2f2a 3b71 3d30 2e38 00a0 0400 0e65  ,*/*;q=0.8.....e
    0x0120:  6e2d 5553 2c65 6e3b 713d 302e 3500 a003  n-US,en;q=0.5...
    0x0130:  000d 677a 6970 2c20 6465 666c 6174 6500  ..gzip,.deflate.
    0x0140:  0015 5365 632d 5765 6253 6f63 6b65 742d  ..Sec-WebSocket-
    0x0150:  5665 7273 696f 6e00 0002 3133 0000 064f  Version...13...O
    0x0160:  7269 6769 6e00 0010 6874 7470 3a2f 2f6c  rigin...http://l
    0x0170:  6f63 616c 686f 7374 0000 1153 6563 2d57  ocalhost...Sec-W
    0x0180:  6562 536f 636b 6574 2d4b 6579 0000 1836  ebSocket-Key...6
    0x0190:  6c2f 6562 7831 7453 6766 3933 2b59 394c  l/ebx1tSgf93+Y9L
    0x01a0:  6e59 2b50 513d 3d00 a009 002b 4a53 4553  nY+PQ==....+JSES
    0x01b0:  5349 4f4e 4944 3d35 3830 4534 3839 3136  SIONID=580E48916
    0x01c0:  3631 3832 4135 3744 3134 3134 4241 3336  6182A57D1414BA36
    0x01d0:  4238 3645 3745 4600 a006 0013 6b65 6570  B86E7EF.....keep
    0x01e0:  2d61 6c69 7665 2c20 5570 6772 6164 6500  -alive,.Upgrade.
    0x01f0:  a00c 0008 6e6f 2d63 6163 6865 0000 0d43  ....no-cache...C
    0x0200:  6163 6865 2d43 6f6e 7472 6f6c 0000 086e  ache-Control...n
    0x0210:  6f2d 6361 6368 6500 0007 5570 6772 6164  o-cache...Upgrad
    0x0220:  6500 0009 7765 6273 6f63 6b65 7400 0500  e...websocket...
          ....
09:23:22.193066 IP (tos 0x0, ttl 64, id 61059, offset 0, flags [DF], proto TCP
(6), length 248, bad cksum 0 (->4d7a)!)
    127.0.0.1.8009 > 127.0.0.1.59458: Flags [P.], cksum 0xfeec (incorrect ->
0xf765), seq 1:197, ack 790, win 8869, options [nop,nop,TS val 3740489561 ecr
3740489560], length 196
    0x0000:  4500 00f8 ee83 4000 4006 0000 7f00 0001  E.....@.@.......
    0x0010:  7f00 0001 1f49 e842 201c f6f9 cb8e fcf6  .....I.B........
    0x0020:  8018 22a5 feec 0000 0101 080a def3 5759  .."...........WY
    0x0030:  def3 5758 4142 00c0 0400 6500 1353 7769  ..WXAB....e..Swi
    0x0040:  7463 6869 6e67 2050 726f 746f 636f 6c73  tching.Protocols
    0x0050:  0000 0400 1858 2d41 746d 6f73 7068 6572  .....X-Atmospher
    0x0060:  652d 7472 6163 6b69 6e67 2d69 6400 0024  e-tracking-id..$
    0x0070:  3935 3934 6566 3634 2d63 6263 612d 3435  9594ef64-cbca-45
    0x0080:  3132 2d38 6230 342d 6631 3933 3230 3030  12-8b04-f1932000
    0x0090:  3937 6430 0000 0755 7067 7261 6465 0000  97d0...Upgrade..
    0x00a0:  0977 6562 736f 636b 6574 0000 0a43 6f6e  .websocket...Con
    0x00b0:  6e65 6374 696f 6e00 0007 7570 6772 6164  nection...upgrad
    0x00c0:  6500 0014 5365 632d 5765 6253 6f63 6b65  e...Sec-WebSocke
    0x00d0:  742d 4163 6365 7074 0000 1c62 5065 7971  t-Accept...bPeyq
    0x00e0:  3473 4f4a 3741 6873 4931 694b 4733 6b59  4sOJ7AhsI1iKG3kY
    0x00f0:  5a6e 4254 6445 3d00                      ZnBTdE=.
09:23:22.193082 IP (tos 0x0, ttl 64, id 4279, offset 0, flags [DF], proto TCP
(6), length 60, bad cksum 0 (->2c03)!)
    127.0.0.1.8009 > 127.0.0.1.59458: Flags [P.], cksum 0xfe30 (incorrect ->
0xbd3a), seq 197:205, ack 790, win 8869, options [nop,nop,TS val 3740489561 ecr
3740489560], length 8
    0x0000:  4500 003c 10b7 4000 4006 0000 7f00 0001  E..<..@.@.......
    0x0010:  7f00 0001 1f49 e842 201c f7bd cb8e fcf6  .....I.B........
    0x0020:  8018 22a5 fe30 0000 0101 080a def3 5759  .."..0........WY
    0x0030:  def3 5758 4142 0004 0300 0000            ..WXAB......
09:23:22.193146 IP (tos 0x0, ttl 64, id 20178, offset 0, flags [DF], proto TCP
(6), length 52, bad cksum 0 (->edef)!)
    127.0.0.1.59458 > 127.0.0.1.8009: Flags [.], cksum 0xfe28 (incorrect ->
0x0097), seq 790, ack 197, win 9118, options [nop,nop,TS val 3740489561 ecr
3740489561], length 0
    0x0000:  4500 0034 4ed2 4000 4006 0000 7f00 0001  E..4N.@.@.......
    0x0010:  7f00 0001 e842 1f49 cb8e fcf6 201c f7bd  .....B.I........
    0x0020:  8010 239e fe28 0000 0101 080a def3 5759  ..#..(........WY
    0x0030:  def3 5759                                ..WY
09:23:22.193154 IP (tos 0x0, ttl 64, id 43150, offset 0, flags [DF], proto TCP
(6), length 52, bad cksum 0 (->9433)!)
    127.0.0.1.59458 > 127.0.0.1.8009: Flags [.], cksum 0xfe28 (incorrect ->
0x0090), seq 790, ack 205, win 9117, options [nop,nop,TS val 3740489561 ecr
3740489561], length 0
    0x0000:  4500 0034 a88e 4000 4006 0000 7f00 0001  E..4..@.@.......
    0x0010:  7f00 0001 e842 1f49 cb8e fcf6 201c f7c5  .....B.I........
    0x0020:  8010 239d fe28 0000 0101 080a def3 5759  ..#..(........WY
    0x0030:  def3 5759                                ..WY
09:23:22.193288 IP (tos 0x0, ttl 64, id 15790, offset 0, flags [DF], proto TCP
(6), length 58, bad cksum 0 (->ff0d)!)
    127.0.0.1.8009 > 127.0.0.1.59458: Flags [P.], cksum 0xfe2e (incorrect ->
0xbb34), seq 205:211, ack 790, win 8869, options [nop,nop,TS val 3740489561 ecr
3740489561], length 6
    0x0000:  4500 003a 3dae 4000 4006 0000 7f00 0001  E..:=.@.@.......
    0x0010:  7f00 0001 1f49 e842 201c f7c5 cb8e fcf6  .....I.B........
    0x0020:  8018 22a5 fe2e 0000 0101 080a def3 5759  .."...........WY
    0x0030:  def3 5759 4142 0002 0501                 ..WYAB....
09:23:22.193302 IP (tos 0x0, ttl 64, id 17593, offset 0, flags [DF], proto TCP
(6), length 52, bad cksum 0 (->f808)!)
    127.0.0.1.59458 > 127.0.0.1.8009: Flags [.], cksum 0xfe28 (incorrect ->
0x008a), seq 790, ack 211, win 9117, options [nop,nop,TS val 3740489561 ecr
3740489561], length 0
    0x0000:  4500 0034 44b9 4000 4006 0000 7f00 0001  E..4D.@.@.......
    0x0010:  7f00 0001 e842 1f49 cb8e fcf6 201c f7cb  .....B.I........
    0x0020:  8010 239d fe28 0000 0101 080a def3 5759  ..#..(........WY
    0x0030:  def3 5759                                ..WY

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55546] Connection hangs after Websocket upgrade through Apache AJP reverse proxy

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55546

--- Comment #4 from Archie Cobbs <ar...@dellroad.org> ---
> Adding HTTP upgrade support to AJP would be a task for Tomcat although
> personally I'd say don't bother and proxy using HTTP instead.

Unless I'm misunderstanding something, it appears that Tomcat already supports
HTTP upgrade.. because it is responding with "101 Switching Protocols" and
"Connection: upgrade". So maybe this is just an Apache limitation.

> I'd expect to see some error messages in the Tomcat logs.

No logs in error log. Access log shows:

127.0.0.1 - - [11/Sep/2013:09:23:22 -0500] "GET
/demo3/PUSH/?v-uiId=6&v-csrfToken=4e90dd10-d18f-4c97-901c-fb8d98effe22&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=1.0.14.vaadin4&X-Atmosphere-Transport=websocket&X-Atmosphere-
TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8
HTTP/1.1" 101 -

Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55546] Connection hangs after Websocket upgrade through Apache AJP reverse proxy

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55546

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
(In reply to Archie Cobbs from comment #4)

> Unless I'm misunderstanding something, it appears that Tomcat already
> supports HTTP upgrade.. because it is responding with "101 Switching
> Protocols" and "Connection: upgrade".

I know Tomcat supports HTTP upgrade. I wrote the implementation.

> So maybe this is just an Apache limitation.

No, it is also an AJP limitation and that protocol is owned by the Tomcat PMC.

> > I'd expect to see some error messages in the Tomcat logs.
> 
> No logs in error log. Access log shows:
> 
> 127.0.0.1 - - [11/Sep/2013:09:23:22 -0500] "GET
> /demo3/PUSH/?v-uiId=6&v-csrfToken=4e90dd10-d18f-4c97-901c-fb8d98effe22&X-
> Atmosphere-tracking-id=0&X-Atmosphere-Framework=1.0.14.vaadin4&X-Atmosphere-
> Transport=websocket&X-Atmosphere-
> TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;
> %20charset=UTF-8 HTTP/1.1" 101 -
> 
> Thanks.

OK. We should take a look at that then as you you ideally see some form of
error if you try an http upgrade over AJP.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55546] Connection hangs after Websocket upgrade through Apache AJP reverse proxy

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55546

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
(In reply to Archie Cobbs from comment #2)
> What would be the appropriate next step then? Would getting this to work
> constitute a feature request for Apache httpd, or Tomcat, or both?

I'd expect proxy support for HTTP upgrade to require changes in httpd.

Adding HTTP upgrade support to AJP would be a task for Tomcat although
personally I'd say don't bother and proxy using HTTP instead.

> FYI, the upgrade request does pass through to Tomcat via AJP and Tomcat does
> respond (see packet trace below)... is this just accidental?

I'd expect to see some error messages in the Tomcat logs.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55546] Connection hangs after Websocket upgrade through Apache AJP reverse proxy

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55546

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
httpd does not support proxying HTTP upgrade requests. Neither does AJP.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org