Bug 267418 - www/nginx: nginx-1.22.1_1,3 lua support, failed to load the 'resty.core' module
Summary: www/nginx: nginx-1.22.1_1,3 lua support, failed to load the 'resty.core' module
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Florian Smeets
URL: https://www.freshports.org/www/nginx/
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-10-29 13:46 UTC by bagas
Modified: 2022-11-14 18:33 UTC (History)
7 users (show)

See Also:


Attachments
nginx.diff (2.02 KB, patch)
2022-10-29 14:34 UTC, Dmitry Wagin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bagas 2022-10-29 13:46:47 UTC
Hello.
I`a updated nginx up to versionnginx-1.22.1_1,3.
Nginx with lua support.

# nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

# service nginx start
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.
nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: /usr/local/share/lua/5.1/resty/core/base.lua:23: ngx_http_lua_module 0.10.22 required) in /usr/local/etc/nginx/nginx.conf:76
/usr/local/etc/rc.d/nginx: WARNING: failed to start nginx


# nginx -V
nginx version: nginx/1.22.1
built with OpenSSL 1.1.1o-freebsd  3 May 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --user=www --group=www --with-compat --with-pcre --modules-path=/usr/local/libexec/nginx --with-file-aio --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx/access.log --with-http_v2_module --with-http_addition_module --with-http_auth_request_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-cc-opt='-DNGX_HAVE_INET6=0 -I /usr/local/include' --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --without-pcre2 --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-stream=dynamic --add-dynamic-module=/usr/ports/www/nginx/work/ngx_devel_kit-0.3.1 --add-dynamic-module=/usr/ports/www/nginx/work/lua-nginx-module-0.10.21


Installed programs:
# pkg version -v | egrep "lua|nginx"
lua-resty-core-0.1.24 = up-to-date with index
lua-resty-lrucache-0.13 = up-to-date with index
lua53-5.3.6 = up-to-date with index
luajit-openresty-2.1.20220915 = up-to-date with index
nginx-1.22.1_1,3 = up-to-date with index

How to fix?
Rollback to old version of nginx-1.22.0_9,3?
To return the version lua-resty-core-0.1.23.
This version lua-resty-core-0.1.23|nginx-1.22.0_9,3 works without errors.
Comment 1 bagas 2022-10-29 13:48:52 UTC
-add-dynamic-module=/usr/ports/www/nginx/work/lua-nginx-module-0.10.21
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-29 13:57:57 UTC
Cc: maintainer of www/lua-resty-core

<https://test.freshports.org/www/lua-resty-core/>
Comment 3 bagas 2022-10-29 13:58:56 UTC
Perhaps the developer of the nginx port forgot to update the module, I think so.
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2022-10-29 13:59:58 UTC
Please ignore the test URL in comment #2. Instead: 

<https://www.freshports.org/www/lua-resty-core/>
Comment 5 Dmitry Wagin 2022-10-29 14:34:10 UTC
Created attachment 237709 [details]
nginx.diff

Update lua-nginx-module to v0.10.22

bugfix: did not wakeup coroutine when worker thread finished.
Comment 6 bagas 2022-10-29 14:37:30 UTC
How to update correctly?
Comment 7 Dmitry Wagin 2022-10-29 14:38:02 UTC
(In reply to bagas from comment #6)

git apply nginx.diff
Comment 8 Dmitry Wagin 2022-10-29 14:38:44 UTC
(In reply to Dmitry Wagin from comment #7)

and build from ports or poudriere
Comment 9 bagas 2022-10-29 14:41:00 UTC
in file
/usr/ports/www/nginx/Makefile.extmod
LUA_GH_TUPLE=           openresty:lua-nginx-module:v0.10.21:lua
LUA_VARS=               DSO_EXTMODS+=lua

change to
LUA_GH_TUPLE=           openresty:lua-nginx-module:v0.10.22:lua
LUA_VARS=               DSO_EXTMODS+=lua

right?
Comment 10 Dmitry Wagin 2022-10-29 14:43:33 UTC
(In reply to bagas from comment #9)

See attached patch:
https://bz-attachments.freebsd.org/attachment.cgi?id=237709
Comment 11 bagas 2022-10-29 15:39:01 UTC
Works, thanks.
Comment 12 Florian Smeets freebsd_committer freebsd_triage 2022-10-30 19:40:54 UTC
Add www/nginx maintainer. 

I just ran into this myself. www/nginx-devel already includes lua-nginx-module:v0.10.22, www/nginx still has 0.10.21.
Comment 13 bagas 2022-11-09 09:22:10 UTC
Why didn't add edits to the port?
I have to to patch the port manually.
Comment 14 Johan Ström 2022-11-10 07:03:42 UTC
Same problem here, bumping openresty:lua-nginx-module dependency to 0.10.22 as per patch fixes the ixssue.
Comment 15 commit-hook freebsd_committer freebsd_triage 2022-11-10 19:46:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=48a7ce510ad18eea66a32b0b8e9a69e9a564ee1a

commit 48a7ce510ad18eea66a32b0b8e9a69e9a564ee1a
Author:     bagas <bagas1983@mail.ru>
AuthorDate: 2022-11-10 19:27:41 +0000
Commit:     Florian Smeets <flo@FreeBSD.org>
CommitDate: 2022-11-10 19:42:31 +0000

    www/nginx: Fix nginx after lua-resty-core update

    Update 3rd party module ngx_http_lua_module to 0.10.22 otherwise nginx
    fails to start with the following error message:

    nginx: [alert] failed to load the 'resty.core' module
    (https://github.com/openresty/lua-resty-core); ensure you are using an
    OpenResty release from https://openresty.org/en/download.html (reason:
    /usr/local/share/lua/5.1/resty/core/base.lua:23: ngx_http_lua_module
    0.10.22 required) in /usr/local/etc/nginx/nginx.conf:76

    This has been broken for almost two weeks, use the
    "Trivial and tested build and runtime fixes" blanket from 22.8.1 of the
    committers guide to prevent more people from breaking their production
    setups. nginx-devel already has version 0.10.22 of the module.

    PR:             267418

 www/nginx/Makefile        | 2 +-
 www/nginx/Makefile.extmod | 2 +-
 www/nginx/distinfo        | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
Comment 16 Jochen Neumeister freebsd_committer freebsd_triage 2022-11-10 21:46:10 UTC
(In reply to commit-hook from comment #15)

if you take care of my port without asking me, then also edit the PR properly
Comment 17 Florian Smeets freebsd_committer freebsd_triage 2022-11-11 15:49:08 UTC
(In reply to Jochen Neumeister from comment #16)

So what about 2022Q4 then? I cannot cherry-pick this change as there are conflicts, because 1.22.1 hasn't been merged to quarterly. Looking at the update it mentions a security fix, which makes me wonder why it hasn't been merged?

I'm happy to let you take care of it, but please do so. People upgrading nginx and then realizing nginx does not start after the update is quite a bad situation to be in.

Also I added you to cc of the PR on the 30th, which hardly fits the description of "not asking you" about "your" port...

Let me know how you want to proceed.
Comment 18 commit-hook freebsd_committer freebsd_triage 2022-11-14 18:30:56 UTC
A commit in branch 2022Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b36da0c4991dd77a4fbc08bff5087264279e4972

commit b36da0c4991dd77a4fbc08bff5087264279e4972
Author:     bagas <bagas1983@mail.ru>
AuthorDate: 2022-11-10 19:27:41 +0000
Commit:     Florian Smeets <flo@FreeBSD.org>
CommitDate: 2022-11-14 18:06:39 +0000

    www/nginx: Fix nginx after lua-resty-core update

    Update 3rd party module ngx_http_lua_module to 0.10.22 otherwise nginx
    fails to start with the following error message:

    nginx: [alert] failed to load the 'resty.core' module
    (https://github.com/openresty/lua-resty-core); ensure you are using an
    OpenResty release from https://openresty.org/en/download.html (reason:
    /usr/local/share/lua/5.1/resty/core/base.lua:23: ngx_http_lua_module
    0.10.22 required) in /usr/local/etc/nginx/nginx.conf:76

    This has been broken for almost two weeks, use the
    "Trivial and tested build and runtime fixes" blanket from 22.8.1 of the
    committers guide to prevent more people from breaking their production
    setups. nginx-devel already has version 0.10.22 of the module.

    PR:             267418
    (cherry picked from commit 48a7ce510ad18eea66a32b0b8e9a69e9a564ee1a)

 www/nginx/Makefile        | 2 +-
 www/nginx/Makefile.extmod | 2 +-
 www/nginx/distinfo        | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
Comment 19 Florian Smeets freebsd_committer freebsd_triage 2022-11-14 18:33:27 UTC
Still no reply from the maintainer so I went ahead and MFHed the change, without the last nginx sec fix. www/nginx-full should probably also get its PORTREVISION bumped, but fixing www/nginx was most important to me, leave the rest to the maintainer.