Keep Alive Bug

With keep alive enabled I regularly get issues where requests are
combined,
it seems to depend on the status of a background XMLHTTP request as to
whether or not they will be combined.

The output I get is like:

,{“id”:147,“user”:{“username”:“dursun123123”,“sitename”:“The Warez
Scene”,“profile_url”:“#”},“message”:“HELLO”,“time”:1288710293},{“id”:148,“user”:{“username”:“hacker3w0rlds”,“sitename”:“The
Warez Scene”,“profile_url”:“#”},“message”:“hello
all”,“time”:1288710537},{“id”:149,“user”:{“username”:“shootie”,“sitename”:“The
Warez
Scene”,“profile_url”:“#”},“message”:“ham”,“time”:1288724254},{“id”:150,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez
Scene”,“profile_url”:“#”},“message”:“superfly1972”,“time”:1288725995},{“id”:151,“user”:{“username”:“dursun123123”,“sitename”:“The
Warez
Scene”,“profile_url”:“#”},“message”:“HELLO”,“time”:1288728745},{“id”:152,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez
Scene”,“profile_url”:“#”},“message”:“madsen”,“time”:1288730813},{“id”:153,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez Scene”,“profile_url”:“#”},“message”:“RILEY
RILEY”,“time”:1288734307},{“id”:154,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez
Scene”,“profile_url”:“#”},“message”:“WalterBosque-art.com”,“time”:1288740171},{“id”:155,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez Scene”,“profile_url”:“#”},“message”:“what
up”,“time”:1288744021},{“id”:156,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez Scene”,“profile_url”:“#”},“message”:“whats the best jenna
presley
scene???”,“time”:1288744066},{“id”:157,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez
Scene”,“profile_url”:“#”},“message”:“:D”,“time”:1288763786},{“id”:158,“user”:{“username”:“Anonymous”,“sitename”:“TWS”,“profile_url”:“”},“message”:“drive
mender”,“time”:1288782574},{“id”:159,“user”:{“username”:“Anonymous”,“sitename”:“TWS”,“profile_url”:“”},“message”:“forensic”,“time”:1288783532}]HTTP/1.1
200 OK
Server: nginx/0.8.52
Date: Wed, 03 Nov 2010 12:45:29 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.3.3-0.dotdeb.1
Cache-Control: private, no-cache=“set-cookie”
Expires: 0
Pragma: no-cache
Content-Encoding: gzip

40b9
��������{s�ȱ��O��X�&����K��%˖�d�X��9��jH�$D��!��I��4��Or=�%�K�N��M6���A�LOO�����w/�]���5�Ǟu���ɛ#�P,�>ՎJ�/�__��X�ݲu*?rc7�W�|[�
�8��J777�7�� �.ޗnVE>N-�_�ڱ]8��=�=ގ=?�_���t���v����S�����A�����
�Q6?�gc’VL
����z������b<�8+�k�;�qI����
U9�����b��>'����Z/�~�kw��#Ig��[wL�8������RW�;�Љ�$����18X��Fq�vY��/�*/m�k��c��a�(OT�v�� �y��r�x*v޼l-��\d���_8����ч���;�i:�1�C�F��]�s|G�V_]��|��,�۸���%2�hk��Pg�Ѵ��x Oǡ�X��ĵ#(б^7�([S�җ��Bw��HC��$���U֞�!�s�v�������꽡���MJ�3 ��n��WcG ������X�5�r���E?�k�T2�9�$����ڎ�X�X(9���ڕ��
�~s�A0�’�x"�ů�P�F|섮�7&1p�k�}W0���_
�p�0I�;�!�%

The first is the JSON output of a shoutbox currently requesting on that
page, the second portion is the real page.

With keepalive disabled this does not occur. Data is being fetched via
proxy_pass to remote host. Shoutbox is using POST requests ever 10
seconds.

Nginx don’t support chunked response from buckend.

its not chunked and I believe I found the problem, the first request was
a
few bytes out on its Content-Length, nginx should stop reading input
once
this is reached and this would prevent any weird bugs from happening
again.

You request:

X-Powered-By: PHP/5.3.3-0.dotdeb.1
Cache-Control: private, no-cache=“set-cookie”
Expires: 0
Pragma: no-cache
Content-Encoding: gzip

40b9
^^^^

is a length of chunk, right?

On Wed, Nov 3, 2010 at 16:32, SplitIce [email protected] wrote:

its not chunked and I believe I found the problem, the first request was a few
bytes out on its Content-Length, nginx should stop reading input once this is
reached and this would prevent any weird bugs from happening again.


wbr, Kirill

Hello!

On Wed, Nov 03, 2010 at 04:46:29PM +0300, Kirill A. Korinskiy wrote:

is a length of chunk, right?

Kirill, it’s nginx reply as seen on client, not backend’s one.

Maxim D.

p.s. Please do not top-post. Thank you.

Hello!

On Wed, Nov 03, 2010 at 11:47:50PM +1100, SplitIce wrote:

Warez
Scene",“profile_url”:“#”},“message”:“ham”,“time”:1288724254},{“id”:150,“user”:{“username”:“Anonymous”,“sitename”:“The
Warez
Scene”,“profile_url”:“#”},“message”:“:D”,“time”:1288763786},{“id”:158,“user”:{“username”:“Anonymous”,“sitename”:“TWS”,“profile_url”:“”},“message”:"drive
Pragma: no-cache

The first is the JSON output of a shoutbox currently requesting on that
page, the second portion is the real page.

With keepalive disabled this does not occur. Data is being fetched via
proxy_pass to remote host. Shoutbox is using POST requests ever 10 seconds.

If you are able to reproduce the problem - you may want to provide
more info, i.e. what happens on wire (use tcpdump/wireshark/etc)
between client and nginx, as well as nginx -V output, config and
debug log.

See here for more info:

Note well: there are some known bugs which may introduce protocol
breakage and cause wierd effects on kept alive connections. Most
frequently mentioned one is related to caching of 0-sized replies
from backend without Content-Length set. See here for patches:

http://nginx.org/pipermail/nginx-devel/2010-January/000100.html
http://nginx.org/pipermail/nginx-devel/2010-January/000101.html
http://nginx.org/pipermail/nginx-devel/2010-January/000102.html

Maxim D.