I've been testing the new RC (1.9.15.1rc1) and have been running into an odd issue. I'm on Ubuntu 12.04 and use resty for a number of things in production including what's breaking in the RC. I've been testing on 1.9.15 and 1.11.1. I'm hoping for some guidance on whether this is a bug in the RC, and/or where to go next with debugging.
In the RC version, if I try to make an HTTP request in ssl_certificate_by_lua_file, the request just dies. The same code works fine in a production 1.9.9 instance. I assume it's something weird with my setup, but I'm at a loss as to what to look at next.
I've tried a couple of different resty.http modules (and to reiterate, this was testing code that already is in production on 1.9.9 and works fine doing HTTP reqs in the ssl_certificate_by_lua_file context). I've added ngx.log statements to two resty.http modules I've tried and in both cases they die in the resty C code (specifically when they call connect on ngx.socket.tcp). I've not seen a single logged error in all my tests. The worker isn't segfaulting either, it's still around. strace'ing gives no indication of what it's choking on.
The connection is actually made but then immediately shut down by nginx (and not by the remote server, lots of tcpdump'ing to confirm this). There's two cases: in one, the nginx box immediately sends a RST when the remote server SYN-ACKs (presumably the nginx box closed it really quickly); in the other, the nginx box will ACK the SYN-ACK, and then send a FIN.
I've been using the super stripped-down script below to test (as well as going through the standard nginx process of pulling out all the 3rd party modules that I could). If I use this script in ssl_certificate_by_lua_file, it never reaches 'GOT HERE 2'. If I do NOT use it in ssl_certificate_by_lua_file and rather use this script in content_by_lua_file, it DOES reach 'GOT HERE 2'.
<begin>
ngx.log(ngx.ERR, "GOT HERE" )
local url = "" href="http://www.perl.com">http://www.perl.com"
local http = require "resty.http"
local hc = http.new()
local ok = hc:request_uri( url)
ngx.log(ngx.ERR, "GOT HERE 2" )
return
</end>