Latest LuaJIT which shipped with Openresty 1.31.1.1 causing regression on ppc64le
On ppc64le (IBM Power little-endian), LuaJIT 2.1-20260415 converts a valid Lua number to zero when casting it through FFI to int64_t or intptr_t.
Environment
- OpenResty version: 1.31.1.1
- LuaJIT snapshot: 2.1-20260415
- Architecture: ppc64le (IBM Power, little-endian)
- OS: RHEL 9
- Compiler: gcc 11.5.0 20240719
- OpenSSL: 3.5.x
Tried simple below function & observed issue with it: A normal Lua numeric value is correct before conversion:
Input: 123456789 Expected integer conversion: 123456789 Actual converted value: 0 Both int64_t and intptr_t conversions return 0LL, and converting that result back to a Lua number also yields 0. 123456789 is safely representable as an exact Lua number, so this is not a floating-point precision or integer-range issue. The failure occurs specifically at the LuaJIT FFI conversion call, ffi.cast, indicating an FFI/JIT/runtime compatibility defect rather than an application-level formatting issue.
root@power-rhl9pawan-oct4 openresty]# /usr/local/openresty/luajit/bin/luajit -e '
local ffi = require("ffi")
local n = 123456789
local x = ffi.cast("int64_t", n)
print("n:", n)
print("x:", x)
print("x as number:", tonumber(x))
'
n: 123456789
x: 0LL
x as number: 0
[root@power-rhl9pawan-oct4 openresty]# /usr/local/openresty/luajit/bin/luajit -e '
local ffi = require("ffi")
local n = 123456789
local x = ffi.cast("intptr_t", n)
print("n:", n)
print("intptr:", x)
print("intptr as number:", tonumber(x))
'
n: 123456789
intptr: 0LL
intptr as number: 0We suspect this conversion problem is contributing to failures in our Nginx/OpenResty deployment. Request handling fails while loading the global-auth Lua module:
2026/09/15 17:30:31 [error] 633#633: *1 lua entry thread aborted: runtime error: /nginx_data/resty/http.lua:16: attempt to index field 're' (a nil value)
stack traceback:
coroutine 0:
/nginx_data/resty/http.lua: in main chunk
[C]: in function 'require'
/nginx_data/common-utils.lua:3: in main chunk
[C]: in function 'require'
/nginx_data/global-auth.lua:1: in main chunk
[C]: in function 'require'http-req-auth.lua:1
→ require("global-auth")
→ global-auth.lua:1
→ require("common-utils")
→ common-utils.lua:3
→ require("resty.http")
→ resty/http.lua:16oc logs -f ibm-nginx-6f685c8f58-mxlwg -n zen
Defaulted container "ibm-nginx-container" out of: ibm-nginx-container, zen-objstore-mirror-container, nginx-init-container (init), zen-objstore-init-container (init)
starting up
Setting up ssl certificate files...
Custom ssl certs not found. Processing default out-of-the-box self-signed certificate files...
[init] IPv6 not present -> pruning IPv6 directives under /nginx_data
lrwxrwxrwx. 1 1000810000 1000810000 50 Sep 15 17:29 /nginx_data/defaults.d/external-server.conf -> /nginx_data/defaults.d/external-server.active.conf
Setting up grpc-ssl certificate files...
2026-09-15 17:29:34: Fetch zen extensions for startup
time=2026-09-15T17:29:34.861399597Z msg=/scripts/get-zen-extns.sh: Retrieving front-door extensions
time=2026-09-15T17:29:35.065693479Z msg=/scripts/get-zen-extns.sh: Retrieved front-door-extensions
time=2026-09-15T17:29:35.264769977Z msg=/scripts/get-zen-extns.sh: Processing /nginx_data/extensions/upstreams/zen_zen-upstream_ie_15.conf
time=2026-09-15T17:29:35.267457133Z msg=/scripts/get-zen-extns.sh: Remove any zen-upstream conf that are already existing
time=2026-09-15T17:29:35.356112806Z msg=/scripts/get-zen-extns.sh: Updating nginx routes with front-door-extensions
time=2026-09-15T17:29:35.358761113Z msg=/scripts/get-zen-extns.sh: Processing extensions in parallel (max 8 workers)
time=2026-09-15T17:29:38.761222642Z msg=/scripts/get-zen-extns.sh: Parallel processing completed: 30 extensions processed
time=2026-09-15T17:29:38.765879635Z msg=/scripts/get-zen-extns.sh: Processed nginx routes with front-door-extensions
time=2026-09-15T17:29:38.774621367Z msg=/scripts/get-zen-extns.sh: get-zen-extns script execution time: 4s
Successfully updated the worker_connections in nginx.conf to 2048
Host header injection protection enabled
NS_DOMAIN: zen.svc.cluster.local
IBM_PRODUCT_NAME: IBM Cloud Pak for Data
2026-09-15 17:29:38: Startup script execution time: 4s
2026/09/15 17:29:38 [warn] 632#632: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /nginx_data/defaults.d/grpc-server.conf:3
nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /nginx_data/defaults.d/grpc-server.conf:3
2026/09/15 17:29:38 [notice] 632#632: using the "epoll" event method
2026/09/15 17:29:38 [notice] 632#632: openresty/1.31.1.1
2026/09/15 17:29:38 [notice] 632#632: built by gcc 11.5.0 20240719 (Red Hat 11.5.0-14) (GCC)
2026/09/15 17:29:38 [notice] 632#632: OS: Linux 5.14.0-687.31.1.el9_8.ppc64le
2026/09/15 17:29:38 [notice] 632#632: getrlimit(RLIMIT_NOFILE): 65536:65536
2026/09/15 17:29:38 [notice] 632#632: start worker processes
2026/09/15 17:29:38 [notice] 632#632: start worker process 633
2026/09/15 17:29:38 [notice] 632#632: start cache manager process 634
2026/09/15 17:29:38 [notice] 632#632: start cache loader process 635
2026/09/15 17:30:31 [error] 633#633: *1 lua entry thread aborted: runtime error: /nginx_data/resty/http.lua:16: attempt to index field 're' (a nil value)
stack traceback:
coroutine 0:
/nginx_data/resty/http.lua: in main chunk
[C]: in function 'require'
/nginx_data/common-utils.lua:3: in main chunk
[C]: in function 'require'
/nginx_data/global-auth.lua:1: in main chunk
[C]: in function 'require'
/nginx_data/http-req-auth.lua:1: in main chunk, client: 127.0.0.1, server: localhost, request: "HEAD /diag HTTP/1.1", host: "localhost:8443"
2026/09/15 17:30:31 [error] 633#633: *1 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/base.lua:82: loop or previous error loading module 'global-auth'
stack traceback:
coroutine 0:
[C]: in function 'error'
/usr/local/openresty/lualib/resty/core/base.lua:82: in function 'require'
/nginx_data/http-req-auth.lua:1: in main chunk, client: 127.0.0.1, server: localhost, request: "HEAD /diag HTTP/1.1", host: "localhost:8443"
2026/09/15 17:30:37 [error] 633#633: *2 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/base.lua:82: loop or previous error loading module 'global-auth'
stack traceback:
coroutine 0:
[C]: in function 'error'
/usr/local/openresty/lualib/resty/core/base.lua:82: in function 'require'
/nginx_data/http-req-auth.lua:1: in main chunk, client: 127.0.0.1, server: localhost, request: "HEAD /diag?ready=true HTTP/1.1", host: "localhost:8443"
2026/09/15 17:30:37 [error] 633#633: *2 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/base.lua:82: loop or previous error loading module 'global-auth'
stack traceback:
coroutine 0:
[C]: in function 'error'
/usr/local/openresty/lualib/resty/core/base.lua:82: in function 'require'
/nginx_data/http-req-auth.lua:1: in main chunk, client: 127.0.0.1, server: localhost, request: "HEAD /diag?ready=true HTTP/1.1", host: "localhost:8443"
2026/09/15 17:30:39 [notice] 635#635: http file cache: /dev/shm/cache_jupyter 0.000M, bsize: 65536
2026/09/15 17:30:39 [notice] 635#635: http file cache: /dev/shm/cache_nb 0.000M, bsize: 65536
2026/09/15 17:30:39 [notice] 632#632: signal 17 (SIGCHLD) received from 635
2026/09/15 17:30:39 [notice] 632#632: cache loader process 635 exited with code 0
2026/09/15 17:30:39 [notice] 632#632: signal 29 (SIGIO) received
NOTE: No Issue seen with Openresty 1.27.1.1 Results of 1.27.1.1
[root@power-rhl9pawan-oct4 openresty]# /usr/local/openresty/luajit/bin/luajit -e '
local ffi = require("ffi")
local n = 123456789
local x = ffi.cast("int64_t", n)
print("n:", n)
print("x:", x)
print("x as number:", tonumber(x))
'
n: 123456789
x: 123456789LL
x as number: 123456789
[root@power-rhl9pawan-oct4 openresty]# /usr/local/openresty/luajit/bin/luajit -e '
local ffi = require("ffi")
local n = 123456789
local x = ffi.cast("intptr_t", n)
print("n:", n)
print("intptr:", x)
print("intptr as number:", tonumber(x))
'
n: 123456789
intptr: 123456789LL
intptr as number: 123456789Source: openresty/openresty