Closed Bug 543515 Opened 14 years ago Closed 14 years ago

Bad Content-Length headers

Categories

(Webtools Graveyard :: BzAPI, defect)

defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: gerv, Assigned: gerv)

Details

Ehsan writes:

OK, I think I figured out what the problem is.  I tried wget, and it was fast.  But the same URL loaded from Firefox was slow.  I inspected it using Firebug, and it was a single HTTP GET (no favicon loads.)  So, I figured that something in the headers that Firefox sends out should be causing a problem, and it is the "Accept-Encoding: gzip,deflate" header, but only when the Accept header is set to text/html (IOW, loading the json version which is fed to the client without an Accept header with "Accept-Encoding: gzip,deflate" works fast.  What happens is that the server is sending the wrong Length header (the value of the Length response header is 4500 for both the non-compressed and compressed response).  This causes the client to blindly wait and keep the connection open, waiting for more data, until the connection is timed out in about 15 seconds.

Here's some wget log which might be helpful:

host-209:moz ehsanakhgari$ time wget --no-check-certificate --header="Accept: text/html" --header="$header" https://api-dev.bugzilla.mozilla.org/latest/bug/350001
--2010-01-14 13:40:26--  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Resolving api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)... 63.245.210.151
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
WARNING: cannot verify api-dev.bugzilla.mozilla.org's certificate, issued by `/C=US/ST=California/L=Mountain View/O=Mozilla Corporation/OU=Mozilla Corporation Root Certificate Services/CN=Mozilla Root CA/emailAddress=hostmaster@mozilla.com':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4500 (4.4K) [text/html]
Saving to: `350001.9'

100%[==================================================================================================>] 4,500       --.-K/s   in 0.1s   

2010-01-14 13:40:29 (44.0 KB/s) - `350001.9' saved [4500/4500]


real    0m3.044s
user    0m0.013s
sys    0m0.007s
host-209:moz ehsanakhgari$ header="Accept-Encoding: gzip,deflate"host-209:moz ehsanakhgari$ time wget --no-check-certificate --header="Accept: text/html" --header="$header" https://api-dev.bugzilla.mozilla.org/latest/bug/350001
--2010-01-14 13:40:39--  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Resolving api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)... 63.245.210.151
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
WARNING: cannot verify api-dev.bugzilla.mozilla.org's certificate, issued by `/C=US/ST=California/L=Mountain View/O=Mozilla Corporation/OU=Mozilla Corporation Root Certificate Services/CN=Mozilla Root CA/emailAddress=hostmaster@mozilla.com':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4500 (4.4K) [text/html]
Saving to: `350001.10'

24% [=======================>                                                                           ] 1,103       --.-K/s   in 14s    

2010-01-14 13:40:56 (77.4 B/s) - Connection closed at byte 1103. Retrying.

--2010-01-14 13:40:57--  (try: 2)  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
WARNING: cannot verify api-dev.bugzilla.mozilla.org's certificate, issued by `/C=US/ST=California/L=Mountain View/O=Mozilla Corporation/OU=Mozilla Corporation Root Certificate Services/CN=Mozilla Root CA/emailAddress=hostmaster@mozilla.com':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4500 (4.4K) [text/html]
Saving to: `350001.10'

24% [=======================>                                                                           ] 1,103       --.-K/s   in 14s    

2010-01-14 13:41:14 (77.3 B/s) - Connection closed at byte 1103. Retrying.

--2010-01-14 13:41:16--  (try: 3)  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
WARNING: cannot verify api-dev.bugzilla.mozilla.org's certificate, issued by `/C=US/ST=California/L=Mountain View/O=Mozilla Corporation/OU=Mozilla Corporation Root Certificate Services/CN=Mozilla Root CA/emailAddress=hostmaster@mozilla.com':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4500 (4.4K) [text/html]
Saving to: `350001.10'

24% [=======================>                                                                           ] 1,103       --.-K/s   in 14s    

2010-01-14 13:41:32 (77.3 B/s) - Connection closed at byte 1103. Retrying.

--2010-01-14 13:41:35--  (try: 4)  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
WARNING: cannot verify api-dev.bugzilla.mozilla.org's certificate, issued by `/C=US/ST=California/L=Mountain View/O=Mozilla Corporation/OU=Mozilla Corporation Root Certificate Services/CN=Mozilla Root CA/emailAddress=hostmaster@mozilla.com':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4500 (4.4K) [text/html]
Saving to: `350001.10'

24% [=======================>                                                                           ] 1,103       --.-K/s   in 14s    

2010-01-14 13:41:52 (76.9 B/s) - Connection closed at byte 1103. Retrying.

--2010-01-14 13:41:56--  (try: 5)  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
WARNING: cannot verify api-dev.bugzilla.mozilla.org's certificate, issued by `/C=US/ST=California/L=Mountain View/O=Mozilla Corporation/OU=Mozilla Corporation Root Certificate Services/CN=Mozilla Root CA/emailAddress=hostmaster@mozilla.com':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4500 (4.4K) [text/html]
Saving to: `350001.10'

24% [=======================>                                                                           ] 1,103       --.-K/s   in 14s    

2010-01-14 13:42:12 (77.0 B/s) - Connection closed at byte 1103. Retrying.

--2010-01-14 13:42:17--  (try: 6)  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
WARNING: cannot verify api-dev.bugzilla.mozilla.org's certificate, issued by `/C=US/ST=California/L=Mountain View/O=Mozilla Corporation/OU=Mozilla Corporation Root Certificate Services/CN=Mozilla Root CA/emailAddress=hostmaster@mozilla.com':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 4500 (4.4K) [text/html]
Saving to: `350001.10'

24% [=======================>                                                                           ] 1,103       --.-K/s  eta 12s     ^C

real    1m42.506s
user    0m0.066s
sys    0m0.013s
host-209:moz ehsanakhgari$


And later he says:

You can do the easy thing, which is disabling compression (which is not so good), or the hard thing (correcting the Length header).  The latter depends on whether you're doing the compression yourself or you're passing it off to the web server.  I think most web servers should handle that header correctly though.
This, among other issues, actually blocks people form using the Bugzilla API for anything, because it means ~15s wait time for any Bugzilla API query made form inside Firefox.  I think this deserves to be critical, if not blocker.
Severity: normal → critical
I've worked around this by turning off mod_deflate.

I don't know where the bug is, and ten minutes searching the web reveals that various people have this problem, and there's no simple obvious fix. Which surprises me, but there you go.

Gerv
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
It's much better now, thanks!  Now, if only the SSL certificate problem is fixed, people can actually start to use the API in useful ways.  :-)
Status: RESOLVED → VERIFIED
Ehsan: api-dev has had a default-trusted-in-browsers SSL cert for over a week now... :-) Try it.

Gerv
(In reply to comment #4)
> Ehsan: api-dev has had a default-trusted-in-browsers SSL cert for over a week
> now... :-) Try it.

Ah, yep, it's using the mozilla.org cert now.  Nice!

Oh, and I just got this when I tried it again; not nice.  :(

host-209:src ehsanakhgari$ time wget --no-check-certificate --header="Accept: text/html" --header="$header" https://api-dev.bugzilla.mozilla.org/latest/bug/350001
--2010-02-16 17:42:16--  https://api-dev.bugzilla.mozilla.org/latest/bug/350001
Resolving api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)... 63.245.210.151
Connecting to api-dev.bugzilla.mozilla.org (api-dev.bugzilla.mozilla.org)|63.245.210.151|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3399 (3.3K) [application/json]
Saving to: `350001'

100%[====================================================================================================================>] 3,399       --.-K/s   in 0s      

2010-02-16 17:43:57 (32.4 MB/s) - `350001' saved [3399/3399]


real	1m41.711s
user	0m0.024s
sys	0m0.010s
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.