From cba848ea359eac72b4709316f4f6422ff417e827 Mon Sep 17 00:00:00 2001 From: Michal Cichra Date: Wed, 11 Jan 2017 14:21:40 +0100 Subject: [PATCH] [module] detect recursive module loading --- apicast/src/module.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apicast/src/module.lua b/apicast/src/module.lua index e3476d8b6..d10b7999d 100644 --- a/apicast/src/module.lua +++ b/apicast/src/module.lua @@ -65,6 +65,11 @@ local prequire = function(file) ok, ret = pcall(dofile, file) end + if type(ret) == 'userdata' then + ngx.log(ngx.WARN, 'cyclic require detected: ', debug.traceback()) + return false, ret + end + if ok then cache[file] = ret else