Bug 240274

Summary: www/nginx: Unable to start when built with LUA support
Product: Ports & Packages Reporter: Thomas Steen Rasmussen / Tykling <thomas>
Component: Individual Port(s)Assignee: Jochen Neumeister <joneum>
Status: Closed FIXED    
Severity: Affects Only Me CC: clukas, joneum, kidon, mm, prj
Priority: --- Flags: bugzilla: maintainer-feedback? (joneum)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 240438    
Bug Blocks:    
Attachments:
Description Flags
www_nginx_Makefile_extmod.patch none

Description Thomas Steen Rasmussen / Tykling 2019-09-02 11:59:15 UTC
For a while now I have been getting this warning whenever I start nginx when it is build with the LUA option:


[tykling@mail ~]$ sudo 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] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)
[tykling@mail ~]$ 


The maintainer is aware of this warning, I reported it back in February by email.

Recently (since ports r508962 I think) I am still getting the warning but nginx now refuses to start:

[tykling@staging3 ~]$ sudo 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] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)
nginx: [error] lua_load_resty_core failed to load the resty.core module from https://github.com/openresty/lua-resty-core; ensure you are using an OpenResty release from https://openresty.org/en/download.html (rc: 2, reason: module 'resty.core' not found:
        no field package.preload['resty.core']
        no file './resty/core.lua'
        no file '/usr/local/share/luajit-2.0.5/resty/core.lua'
        no file '/usr/local/share/lua/5.1/resty/core.lua'
        no file '/usr/local/share/lua/5.1/resty/core/init.lua'
        no file './resty/core.so'
        no file '/usr/local/lib/lua/5.1/resty/core.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './resty.so'
        no file '/usr/local/lib/lua/5.1/resty.so'
        no file '/usr/local/lib/lua/5.1/loadall.so')
[tykling@staging3 ~]$ 


This is preventing me from upgrading nginx to solve the recent vulnerabilities https://vuxml.freebsd.org/freebsd/87679fcb-be60-11e9-9051-4c72b94353b5.html
Comment 1 commit-hook freebsd_committer freebsd_triage 2019-09-12 08:50:32 UTC
A commit references this bug:

Author: joneum
Date: Thu Sep 12 08:49:53 UTC 2019
New revision: 511862
URL: https://svnweb.freebsd.org/changeset/ports/511862

Log:
  The lua module for nginx is intended to be used with Openrestys luajit branch.

  PR:		240438 240274
  Sponsored by:	Netzkommune GmbH

Changes:
  head/www/nginx/Makefile.extmod
Comment 2 Thomas Steen Rasmussen / Tykling 2019-09-13 07:54:53 UTC
Hello,

Thank you. My poudriere has built the new nginx package but it didn't seem to do anything, I still get the same error:

[tsr@webproxy3 ~]$ pkg info | grep nginx
nginx-1.16.1_2,2               Robust and small WWW server
[tsr@webproxy3 ~]$ pkg info | grep lua  
luajit-openresty-2.1.20190626  Just-In-Time Compiler for Lua (OpenResty branch)
[tsr@webproxy3 ~]$ sudo service nginx restart
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
Stopping nginx.
Waiting for PIDS: 66697.
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: [error] lua_load_resty_core failed to load the resty.core module from https://github.com/openresty/lua-resty-core; ensure you are using an OpenResty release from https://openresty.org/en/download.html (rc: 2, reason: module 'resty.core' not found:
        no field package.preload['resty.core']
        no file './resty/core.lua'
        no file '/usr/local/share/luajit-2.1.0-beta3/resty/core.lua'
        no file '/usr/local/share/lua/5.1/resty/core.lua'
        no file '/usr/local/share/lua/5.1/resty/core/init.lua'
        no file './resty/core.so'
        no file '/usr/local/lib/lua/5.1/resty/core.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './resty.so'
        no file '/usr/local/lib/lua/5.1/resty.so'
        no file '/usr/local/lib/lua/5.1/loadall.so')
[tsr@webproxy3 ~]$
Comment 3 Christoph Lukas 2019-09-13 12:03:44 UTC
You also need the two ports in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240160
Comment 4 Phillip R. Jaenke 2019-09-17 03:00:54 UTC
Created attachment 207542 [details]
www_nginx_Makefile_extmod.patch

Please see attached patch. This will reduce the amount of incidental foot-shooting by approximately 100% by adding a dependency on www/lua-resty-core (which was added <looks> yesterday!) I have tested locally and it compiles cleanly with no issues AND keeps me from picking toes up off the floor.
Comment 5 Philipp Engel 2019-09-19 18:25:28 UTC
Can confirm, all issues gone after www/lua-resty-core was installed.
Comment 6 Jochen Neumeister freebsd_committer freebsd_triage 2019-09-20 06:47:23 UTC
(In reply to Thomas Steen Rasmussen / Tykling from comment #2)

Can you confirm that everything's okay?:

(In reply to Philipp Engel from comment #5)
Comment 7 Thomas Steen Rasmussen / Tykling 2019-09-20 07:44:03 UTC
I can confirm that adding www/lua-resty-core makes the problem go away!
Comment 8 Thomas Steen Rasmussen / Tykling 2019-09-20 08:43:09 UTC
We still need a commit to add the patch with the www/lua-resty-core dep to the ports tree, right? Or am I missing something?
Comment 9 Thomas Steen Rasmussen / Tykling 2019-09-24 07:03:45 UTC
This patch never got committed, right?
Comment 10 commit-hook freebsd_committer freebsd_triage 2019-11-16 09:41:57 UTC
A commit references this bug:

Author: mm
Date: Sat Nov 16 09:41:09 UTC 2019
New revision: 517734
URL: https://svnweb.freebsd.org/changeset/ports/517734

Log:
  lua-nginx-module requires lua-resty-core (and lrucache) on runtime

  PR:		240274
  Submitted by:	Thomas Steen Rasmussen / Tykling <thomas@gibfest.dk>
  Reviewed by:	mm@FreeBSD.org
  Approved by:	maintainer timeout

Changes:
  head/www/nginx/Makefile.extmod
Comment 11 commit-hook freebsd_committer freebsd_triage 2019-11-16 17:58:31 UTC
A commit references this bug:

Author: osa
Date: Sat Nov 16 17:57:40 UTC 2019
New revision: 517767
URL: https://svnweb.freebsd.org/changeset/ports/517767

Log:
  Merge r517734 revision from www/nginx.
  Bump PORTREVISION.

  PR:	240274

Changes:
  head/www/nginx-devel/Makefile
  head/www/nginx-devel/Makefile.extmod