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

Null pointer issue with mlcache lru #629

Open
DuzzlinAdmin opened this issue Oct 3, 2024 · 3 comments
Open

Null pointer issue with mlcache lru #629

DuzzlinAdmin opened this issue Oct 3, 2024 · 3 comments

Comments

@DuzzlinAdmin
Copy link

DuzzlinAdmin commented Oct 3, 2024

Context : Changes added to Kong-Pongo for version 3.8.0.0 added a few lines in spec/helpers.lua line 323 which are highlighted below

_G.kong.cache.mlcache.lru = nil collectgarbage()

When mlcache.lru is set to nil we have this issue of cluster_events callback failing
[error] 1342#0: *18 [lua] init.lua:270: process_event(): [cluster_events] callback threw an error: /usr/local/share/lua/5.1/kong/resty/mlcache/init.lua:1420: attempt to index field 'lru' (a nil value), context: ngx.timer

Can you please provide reasons on why the above lines were added to helpers.lua and what can be the resolution to this as callbacks are being executed after the function call clear_cache_on_file_end

@Tieske
Copy link
Member

Tieske commented Oct 3, 2024

@DuzzlinAdmin when do you encounter this error? Always, or specific to your custom plugin, etc.

@chobits this was part of the dns refactor I think. Can you have a look at this issue?

@SomnolentKalash
Copy link

SomnolentKalash commented Oct 3, 2024

@Tieske Replying via main account, encountered it during few plugin execution,
Happens randomly and mostly after all the tests from 1 file completed execution or between 2 tests, doesn't happen if I remove _G.kong.cache.mlcache.lru = nil from kong-pongo
Also tried finding logs no logs are found for this because happens before log is initialized, found out via timestamps

@SomnolentKalash
Copy link

I checked the logs, Happens when worker calls the poll function which calls to cluster_events process event where callbacks are set and then when callbacks are executed in the below part it gives the error

else
      local ok, err = pcall(cbs[j], row.data)
      if not ok and not ngx_debug then
        log(ERR, "callback threw an error: ", err)
      end
    end

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

3 participants