Skip to content

Commit

Permalink
[module] detect recursive module loading
Browse files Browse the repository at this point in the history
  • Loading branch information
mikz committed Jan 11, 2017
1 parent 8d05976 commit e72e80c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apicast/src/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e72e80c

Please sign in to comment.