Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua_code_cache off not working #14

Open
soerenmartius opened this issue Mar 15, 2016 · 6 comments
Open

lua_code_cache off not working #14

soerenmartius opened this issue Mar 15, 2016 · 6 comments

Comments

@soerenmartius
Copy link

I inherited from your alpine version dockerfile and ran into issues.

FROM ficusio/openresty:latest
COPY nginx/conf /opt/openresty/nginx/conf
EXPOSE 8081

Setting up a new container works as expected, also it uses my custom nginx.conf

nginx.conf

worker_processes 8;
worker_rlimit_nofile  20000;

events {
  worker_connections 5120;
}

http {
  access_log off;
  error_log stderr notice;

  keepalive_timeout 65;
  resolver 8.8.8.8;

  init_by_lua '
    require "resty.core"
  ';

  lua_shared_dict locks 1M;
  lua_shared_dict cache 10M;


  server {
    listen 8082;
    root /var/www;

    #get productviews for user + product
    location ~ /productViews.js {
        lua_code_cache off;
        default_type text/html;
        content_by_lua_file conf/example.lua;
    }

    location ~ / {
        return 200;
    }

  }
}

example.lua

ngx.print('<H1>Hello World.</H1>');

However. Setting lua_code_cache to off won't work on alpine linux. The usual warning

lua_code_cache is off; this will hurt performance

won't come up as expected. Also, if i change the code in example.lua it won't show me the new content but it comes up with an syntax exception in the logs and crashes. Although the syntax i am using is fine.

If i switched to the debian version and it all works as expected. Something seems to be broken with alpine linux version.

@soerenmartius
Copy link
Author

I reckon this is caused by missing musl libc in alpine linux

@skozin
Copy link
Member

skozin commented Mar 15, 2016

Yeah, Alpine version has problems with lua_code_cache set to off. This is caused not by missing musl libc, but, on the contrary, by the fact that musl libc is used instead of glibc when building OpenResty for Alpine, as Alpine in general uses musl libc instead of glibc. I'm not sure about the cause of this lua_code_cache behavior, but I've run into it too. I suspect this is a bug in musl or a musl/glibc compatibility problem. Also, it's hard to build OpenResty profiling tools with musl libc.

That's why I recommended using Debian flavor in the Usage during development section. Probably I need to emphasize it more in the readme.

That said, we've had no issues caused by musl libc in production.

@skozin
Copy link
Member

skozin commented Mar 15, 2016

The only real fix I see now is to build OpenResty with glibc in Alpine flavor too, but that would substantially increase the image size. I'm not sure it's worth it, given that you can use Debian version for development.

@soerenmartius
Copy link
Author

Thanks for quick reply @skozin. Making it a bit more clear in the documentation would be nice. But also i did run into issues on production. The logs showed me syntax error but the script was correct though. It even popped up with errors on lines which didn't exist.

@skozin
Copy link
Member

skozin commented Mar 18, 2016

So you're not using lua_code_cache off in production, and still get the similar problems?

@soerenmartius
Copy link
Author

Sorry for late reply. Yes exactly. Also sometimes I run into syntax errors altough the syntax is correct. If i switch to debian it is working correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants