Modules behaving differently on 32-bit and 64-bit systems?
Maxim Dounin
mdounin at mdounin.ru
Mon Oct 21 11:14:20 UTC 2013
Hello!
On Mon, Oct 21, 2013 at 01:13:56AM -0400, andrewc wrote:
> Hi there,
>
> I have built nginx 1.5.6 from source, with a 3rd party module (xtoken -
> http://code.google.com/p/nginx-xtoken-module/).
>
> I have it working fine on a 32-bit Debian Squeeze system. An identical build
> on a 64-bit Centos 6.4 system, with an identical configuration file results
> in the error: "nginx: [crit] ngx_slab_alloc() failed: no memory" on
> startup.
>
> I have narrowed the problem to the xtoken module, in as much as removing
> references to it on the 64-bit system results in nginx starting correctly.
>
> I have had a quick look at the module source code, and can't see anything
> that is obviously 32-bit -centric, other than a couple of variables that
> have been declared as uint32_t.
>
> Is it correct to assume that a properly written module will work correctly
> on both 32 and 64-bit systems?
Yes.
> Is there any additional nginx configuration that needs to be performed on
> 64-bit systems?
In some cases, additional configuration may be required due to
different data sizes.
Quick looks suggests that the problem in xtoken module is likely
here:
https://code.google.com/p/nginx-xtoken-module/source/browse/trunk/ngx_http_xtoken_module.c#660
It tries to estimate size of shared memory zone needed to keep
it's data, but the estimate likely fails on 64-bit platforms due
to internal structures of slab allocator being bigger on these
platforms.
The same code may also unexpectedly fail in the future on internal
slab allocator changes.
--
Maxim Dounin
http://nginx.org/en/donation.html
More information about the nginx
mailing list