Multiplay Labs

tech hits and tips from Multiplay

Archive for March, 2011

nginx $body_bytes_sent gotcha

without comments

Just been trying to figure your why headers set to $body_bytes_sent where always 0 even after a successful download of a file from nginx.

We’ll after much head scratching I tried something that I didn’t think would work but it did. It turns out that the first time $body_bytes_sent is accessed in a request its value is cached and reused for subsequent references. We where using an include to configure proxy_pass headers for all our stages of the download process which had X-Bytes-Sent being configured to $body_bytes_sent.

Unfortunately because $body_bytes_sent is not flagged as none cacheable its value is fixed to then it is first used, which in our case was prior to any body being sent and hence the problem.

The fix for us was simple remove it from the include and only specify it in the one place we wanted it but this may not be possible for all uses so the correct fix may be to set NGX_HTTP_VAR_NOCACHEABLE on flag body_bytes_sent in src/http/ngx_http_variables.c for nginx.

Written by Dilbert

March 23rd, 2011 at 11:35 pm

Posted in Nginx

Plugin Storage Engines under MySQL 5.5 require Grant Tables

without comments

Under MySQL 5.5 optional storage engines now require privileges loaded and hence will fail to load when –skip-grant-tables is specified.

If you try to load them when this option is specified the result is that the entire db will fail to start and the following error will appear in the logs:
110318 21:37:23 [ERROR] /usr/local/libexec/mysqld: unknown option ‘–federated’

This in turn means that an upgrade from 5.x needs to be done in three steps if you have federated tables
1. With –skip-grant-tables and without –federated
2. Install and enable the federated plugin: mysql> install plugin federated soname ‘’;
3. Without –skip-grant-tables and with –federated

Written by Dilbert

March 18th, 2011 at 9:52 pm

Posted in MySQL