openresty / homebrew-brew

Official homebrew repo for open source OpenResty
https://openresty.org/
Other
40 stars 23 forks source link

Openresty dies with `terminated by signal SIGSEGV` after upgrade to 1.25.3.2 #42

Open dsimunic opened 2 weeks ago

dsimunic commented 2 weeks ago

Indicate troubleshooting steps taken

Brief summary of issue:

After unintentionally upgrading to 1.25.3.2 with brew upgrade, the binary fails with SYSSEGV. Running under lldb shows this error in luajit:

(lldb) run
Process 57024 launched: '/opt/homebrew/bin/openresty' (arm64)
Process 57024 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x34)
    frame #0: 0x0000000100272338 libluajit-5.1.2.dylib`lj_ff_getmetatable + 48
libluajit-5.1.2.dylib`lj_ff_getmetatable:
->  0x100272338 <+48>: ldr    w9, [x17, #0x34]
    0x10027233c <+52>: ldr    w10, [x28, #0xc]
    0x100272340 <+56>: ldr    x2, [x17, #0x28]
    0x100272344 <+60>: and    w9, w9, w10
Target 0: (openresty) stopped.

Running on Sequoia.

Darwin MacBookPro 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:39:07 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6000 arm64

The latest known version that works seems to be 1.19.9.1. I looked into Git history and successively tried older and older versions for all commits titled "upgraded openresty to ..." (so 1.21.4.1, 1.21.4.2, and 1.25.3.2).

Strangely, at one point I noticed that I had 1.21.4.1_1 installed, so I was presumably running that for the past two years:

brew info openresty/brew/openresty
==> openresty/brew/openresty: stable 1.25.3.2
Scalable Web Platform by Extending NGINX with Lua
https://openresty.org
Installed
/opt/homebrew/Cellar/openresty/1.21.4.1_1 (308 files, 12.8MB)
  Built from source on 2022-12-21 at 14:11:23
/opt/homebrew/Cellar/openresty/1.25.3.2_1 (325 files, 7.5MB) *
  Built from source on 2024-10-08 at 16:48:43
From: https://github.com/openresty/homebrew-brew/blob/HEAD/Formula/openresty.rb

Sadly this older version got cleaned up by brew shortly after, so I could not verify if that version still worked after the unintentional brew upgrade that wholesale upgraded everything.

1.19.9.1_2 works, even though it shows the same libluajit version (5.1.2) like the newer ones that fail.

openresty -v
nginx version: openresty/1.19.9.1

otool -L /opt/homebrew/bin/openresty
/opt/homebrew/bin/openresty:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1351.0.0)
    /opt/homebrew/Cellar/openresty/1.19.9.1_2/luajit/lib/libluajit-5.1.2.dylib (compatibility version 2.1.0, current version 2.1.0)
    /opt/homebrew/opt/pcre/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.13.0)
    /opt/homebrew/opt/openresty-openssl111/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
    /opt/homebrew/opt/openresty-openssl111/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
    /opt/homebrew/opt/geoip/lib/libGeoIP.1.dylib (compatibility version 8.0.0, current version 8.12.0)
silasb commented 2 days ago

I also get the same EXC_BAD_ACCESS in libluajit-5.1.2.dylib, but on 1.27.1.1.