Projects tigase _server server-core Issues #246
Inconsistent BOSH behavior over HTTP proxy (#246)
Closed
Justin Posey opened 1 decade ago

Our team uses BOSH through an HTTP proxy. At times, the BOSH session manager will close a socket by simply sending a TCP FIN packet with no "Connection: close" header. In this case, the HTTP proxy does not have a valid HTTP response to send to the client, so it manifests as an HTTP 502 response.

BOSH should always send a HTTP/1.1 compliant "Connection: Close" header when it closes a socket.

Artur Hefczyc commented 1 decade ago

Bosh server always attempts to send a correct HTTP/Bosh response to the client before closing the connection. There are some factors which are out of our control which may cause the connection to be closed before the data delivery is completed by one of the network end-point. Especially for HTTP connections and especial when proxy is involved connections can be closed for various reasons such as connection number limits on the proxy or web server. Connection timeout, or some other factors.

Also, as far as I know Bosh server never closes connection on it's own. It always keeps connections opened as it allows the client to submit multiple Bosh requests on a single connection (HTTP keep-alive). The only case when the Bosh server closes connections is when the client opens too many connections exceeding connections number limits.

The best way to of around various problems with Bosh connectivity is to avoid using Proxy. There are new standards such as CORS and similar which allow you to connect the Bosh client directly to a Bosh server without proxy.

We can of course run an investigation on the problem to check whether there is something we can do to improve situation but from what I know about the Bosh this is pretty much normal and expected if some of the connections are closed this way.

Have you tried to test this problem with the most recent 5.2.0 build? There were some improvements in Bosh in recent version, maybe it would work better for you.

Justin Posey commented 1 decade ago

Thanks, Artur. A proxy is required for us, unfortunately. A code inspection reveals the same forceful socket closes in 5.2.0.

Here's an example of a FIN packet socket shutdown initiated by Bosh with no accompanying HTTP response. We see these fairly often:

15:37:54.872874 IP PROXY.62606 > BOSH_SERVICE.http: Flags [S], seq 2974011533, win 11680, options [mss 1460,sackOK,TS val 2131812433 ecr 0,nop,wscale 10], length 0

0x0000:  4500 003c 30dc 4000 4006 af54 0abe 3a1a  E..<0.@.@..T..:.

0x0010:  0abe 0af6 f48e 0050 b143 d08d 0000 0000  .......P.C......

0x0020:  a002 2da0 5aba 0000 0204 05b4 0402 080a  ..-.Z...........

0x0030:  7f10 e051 0000 0000 0103 030a            ...Q........

15:37:54.873231 IP BOSH_SERVICE.http > PROXY.62606: Flags [S.], seq 1591863734, ack 2974011534, win 4380, options [mss 1460,nop,wscale 0,nop,nop,TS val 2156822817 ecr 2131812433,sackOK,eol], length 0

0x0000:  4500 0040 d234 4000 ff06 4ef7 0abe 0af6  E..@.4@...N.....

0x0010:  0abe 3a1a 0050 f48e 5ee1 e9b6 b143 d08e  ..:..P..^....C..

0x0020:  b012 111c aaee 0000 0204 05b4 0103 0300  ................

0x0030:  0101 080a 808e 8121 7f10 e051 0402 0000  .......!...Q....

15:37:54.873252 IP PROXY.62606 > BOSH_SERVICE.http: Flags [.], ack 1, win 12, options [nop,nop,TS val 2131812433 ecr 2156822817], length 0

0x0000:  4500 0034 30dd 4000 4006 af5b 0abe 3a1a  E..40.@.@..[..:.

0x0010:  0abe 0af6 f48e 0050 b143 d08e 5ee1 e9b7  .......P.C..^...

0x0020:  8010 000c 5ab2 0000 0101 080a 7f10 e051  ....Z..........Q

0x0030:  808e 8121                                ...!

15:37:54.873353 IP PROXY.62606 > BOSH_SERVICE.http: Flags [P.], seq 1:844, ack 1, win 12, options [nop,nop,TS val 2131812433 ecr 2156822817], length 843

0x0000:  4500 037f 30de 4000 4006 ac0f 0abe 3a1a  E...0.@.@.....:.

0x0010:  0abe 0af6 f48e 0050 b143 d08e 5ee1 e9b7  .......P.C..^...

0x0020:  8018 000c 5dfd 0000 0101 080a 7f10 e051  ....]..........Q

0x0030:  808e 8121 504f 5354 202f 6874 7470 2d62  ...!POST./http-b

0x0040:  696e 6420 4854 5450 2f31 2e31 0d0a 582d  ind.HTTP/1.1..X-

0x0050:  4644 2d54 7261 6365 4944 3a20 3134 3138  FD-TraceID:.1418

0x0060:  3037 3836 3133 3730 3641 4135 3830 3030  078613706AA58000

0x0070:  4338 3630 3030 300d 0a58 2d46 442d 456e  C860000..X-FD-En

0x0080:  6470 6f69 6e74 4944 3a20 2f73 7461 6765  dpointID:./stage

0x0090:  612f 736f 6369 616c 2f73 6572 7669 6365  a/social/service

0x00a0:  732f 6672 6965 6e64 732f 7631 0d0a 582d  s/friends/v1..X-

0x00b0:  466f 7277 6172 6465 642d 466f 723a 2031  Forwarded-For:.1

0x00c0:  302e 3231 372e 3132 382e 3133 362c 2031  0.217.128.136,.1

0x00d0:  302e 3139 302e 3538 2e37 3a33 3333 3438  0.190.58.7:33348

0x00e0:  0d0a 436f 6e6e 6563 7469 6f6e 3a20 6b65  ..Connection:.ke

0x00f0:  6570 2d61 6c69 7665 0d0a 582d 466f 7277  ep-alive..X-Forw

0x0100:  6172 6465 642d 5072 6f74 6f3a 2068 7474  arded-Proto:.htt

0x0110:  7073 0d0a 582d 466f 7277 6172 6465 642d  ps..X-Forwarded-

0x0120:  466f 723a 2031 302e 3231 372e 3132 382e  For:.10.217.128.

0x0130:  3133 360d 0a43 6f6f 6b69 653a 2042 4947  136..Cookie:.BIG

0x0140:  6970 5365 7276 6572 706f 6f6c 2d73 7461  ipServerpool-sta

0x0150:  6765 2e66 7269 656e 6473 2d61 2e73 6f63  ge.friends-a.soc

0x0160:  6961 6c2e 6469 736e 6579 2e63 6f6d 3d32  ial.disney.com=2

0x0170:  3433 3334 3030 3333 302e 3430 3938 302e  433400330.40980.

0x0180:  3030 3030 0d0a 4163 6365 7074 2d4c 616e  0000..Accept-Lan

0x0190:  6775 6167 653a 2065 6e2d 5553 2c65 6e3b  guage:.en-US,en;

0x01a0:  713d 302e 380d 0a41 6363 6570 742d 456e  q=0.8..Accept-En

0x01b0:  636f 6469 6e67 3a20 677a 6970 2c64 6566  coding:.gzip,def

0x01c0:  6c61 7465 2c73 6463 680d 0a52 6566 6572  late,sdch..Refer

0x01d0:  6572 3a20 6874 7470 733a 2f2f 696e 742e  er:.https://int.

0x01e0:  6170 692e 6469 736e 6579 2e70 7269 7661  api.disney.priva

0x01f0:  7465 2f71 612f 736f 6369 616c 2f66 6c69  te/qa/social/fli

0x0200:  6768 7473 2f6c 6174 6573 742f 626f 6f74  ghts/latest/boot

0x0210:  7374 7261 7073 2f64 6973 6e65 7953 6f63  straps/disneySoc

0x0220:  6961 6c43 6f6e 6669 672e 6874 6d6c 0d0a  ialConfig.html..

0x0230:  4163 6365 7074 3a20 2a2f 2a0d 0a43 6f6e  Accept:.*/*..Con

0x0240:  7465 6e74 2d54 7970 653a 2074 6578 742f  tent-Type:.text/

0x0250:  706c 6169 6e3b 6368 6172 7365 743d 5554  plain;charset=UT

0x0260:  462d 380d 0a41 7574 686f 7269 7a61 7469  F-8..Authorizati

0x0270:  xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx  on:REDACTED

0x0290:  xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx  ..Ori

0x02a0:  6769 6e3a 2068 7474 7073 3a2f 2f69 6e74  gin:.https://int

0x02b0:  2e61 7069 2e64 6973 6e65 792e 7072 6976  .api.disney.priv

0x02c0:  6174 650d 0a55 7365 722d 4167 656e 743a  ate..User-Agent:

0x02d0:  204d 6f7a 696c 6c61 2f35 2e30 2028 4d61  .Mozilla/5.0.(Ma

0x02e0:  6369 6e74 6f73 683b 2049 6e74 656c 204d  cintosh;.Intel.M

0x02f0:  6163 204f 5320 5820 3130 5f38 5f35 2920  ac.OS.X.10_8_5).

0x0300:  4170 706c 6557 6562 4b69 742f 3533 372e  AppleWebKit/537.

0x0310:  3336 2028 4b48 544d 4c2c 206c 696b 6520  36.(KHTML,.like.

0x0320:  4765 636b 6f29 2043 6872 6f6d 652f 3330  Gecko).Chrome/30

0x0330:  2e30 2e31 3539 392e 3636 2053 6166 6172  .0.1599.66.Safar

0x0340:  692f 3533 372e 3336 0d0a 436f 6e74 656e  i/537.36..Conten

0x0350:  742d 4c65 6e67 7468 3a20 3131 310d 0a48  t-Length:.111..H

0x0360:  6f73 743a 2069 6e74 2e61 7069 2e64 6973  ost:.int.api.dis

0x0370:  6e65 792e 7072 6976 6174 650d 0a0d 0a    ney.private....

15:37:54.873577 IP BOSH_SERVICE.http > PROXY.62606: Flags [.], ack 844, win 5223, options [nop,nop,TS val 2156822817 ecr 2131812433], length 0

0x0000:  4500 0034 d237 4000 ff06 4f00 0abe 0af6  E..4.7@...O.....

0x0010:  0abe 3a1a 0050 f48e 5ee1 e9b7 b143 d3d9  ..:..P..^....C..

0x0020:  8010 1467 e422 0000 0101 080a 808e 8121  ...g.".........!

0x0030:  7f10 e051                                ...Q

15:37:54.873588 IP PROXY.62606 > BOSH_SERVICE.http: Flags [P.], seq 844:955, ack 1, win 12, options [nop,nop,TS val 2131812433 ecr 2156822817], length 111

0x0000:  4500 00a3 30df 4000 4006 aeea 0abe 3a1a  E...0.@.@.....:.

0x0010:  0abe 0af6 f48e 0050 b143 d3d9 5ee1 e9b7  .......P.C..^...

0x0020:  8018 000c 5b21 0000 0101 080a 7f10 e051  ....[!.........Q

0x0030:  808e 8121 3c62 6f64 7920 7269 643d 2731  ...!<body.rid='1

0x0040:  3431 3938 3639 3932 3127 2078 6d6c 6e73  419869921'.xmlns

0x0050:  3d27 6874 7470 3a2f 2f6a 6162 6265 722e  ='http://jabber.

0x0060:  6f72 672f 7072 6f74 6f63 6f6c 2f68 7474  org/protocol/htt

0x0070:  7062 696e 6427 2073 6964 3d27 3766 3465  pbind'.sid='7f4e

0x0080:  3232 3333 2d63 3563 322d 3434 3766 2d39  2233-c5c2-447f-9

0x0090:  3036 652d 3039 3561 3761 3531 6636 3466  06e-095a7a51f64f

0x00a0:  272f 3e                                  '/>

15:37:54.873757 IP BOSH_SERVICE.http > PROXY.62606: Flags [.], ack 955, win 5334, options [nop,nop,TS val 2156822817 ecr 2131812433], length 0

0x0000:  4500 0034 d251 4000 ff06 4ee6 0abe 0af6  E..4.Q@...N.....

0x0010:  0abe 3a1a 0050 f48e 5ee1 e9b7 b143 d448  ..:..P..^....C.H

0x0020:  8010 14d6 e344 0000 0101 080a 808e 8121  .....D.........!

0x0030:  7f10 e051                                ...Q

15:38:10.481168 IP BOSH_SERVICE.http > PROXY.62606: Flags [F.], seq 1, ack 955, win 5334, options [nop,nop,TS val 2156838428 ecr 2131812433], length 0

0x0000:  4500 0034 6ee3 4000 ff06 b254 0abe 0af6  E..4n.@....T....

0x0010:  0abe 3a1a 0050 f48e 5ee1 e9b7 b143 d448  ..:..P..^....C.H

0x0020:  8011 14d6 a648 0000 0101 080a 808e be1c  .....H..........

0x0030:  7f10 e051                                ...Q

15:38:10.481261 IP PROXY.62606 > BOSH_SERVICE.http: Flags [.], ack 2, win 12, options [nop,nop,TS val 2131816335 ecr 2156838428], length 0

0x0000:  4500 0034 30e0 4000 4006 af58 0abe 3a1a  E..40.@.@..X..:.

0x0010:  0abe 0af6 f48e 0050 b143 d448 5ee1 e9b8  .......P.C.H^...

0x0020:  8010 000c 5ab2 0000 0101 080a 7f10 ef8f  ....Z...........

0x0030:  808e be1c                                ....

15:38:10.481313 IP PROXY.62606 > BOSH_SERVICE.http: Flags [F.], seq 955, ack 2, win 12, options [nop,nop,TS val 2131816335 ecr 2156838428], length 0

0x0000:  4500 0034 30e1 4000 4006 af57 0abe 3a1a  E..40.@.@..W..:.

0x0010:  0abe 0af6 f48e 0050 b143 d448 5ee1 e9b8  .......P.C.H^...

0x0020:  8011 000c 5ab2 0000 0101 080a 7f10 ef8f  ....Z...........

0x0030:  808e be1c                                ....

15:38:10.481534 IP BOSH_SERVICE.http > PROXY.62606: Flags [.], ack 956, win 5334, options [nop,nop,TS val 2156838428 ecr 2131816335], length 0

0x0000:  4500 0034 6ef5 4000 ff06 b242 0abe 0af6  E..4n.@....B....

0x0010:  0abe 3a1a 0050 f48e 5ee1 e9b8 b143 d449  ..:..P..^....C.I

0x0020:  8010 14d6 9709 0000 0101 080a 808e be1c  ................

0x0030:  7f10 ef8f                                ....
Artur Hefczyc commented 1 decade ago

Could you please point me to the code forcefully closing connection you mentioned?

Artur Hefczyc commented 1 decade ago

Closed due lack of feedback from a user.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
RedmineID
1581
Version
tigase-server-5.2.0
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#246
Please wait...
Page is in error, reload to recover