Skip to content

openid-connect plugin leaving server-side sessions locked by not calling explicit session:close() #8017

Description

@brentmjohnson

Current Behavior

Server-side session stores that support locking remain locked after authentication until the default or configured lock ttl (https://github.com/bungle/lua-resty-session#redis-storage-adapter) expires. This results in subsequent requests (using the same APISIX session) hanging until the lock expires.

Apisix plugin code:

response, err, _, session = openidc.authenticate(conf)

Does not implement explicit session:close() as recommended by zmartzone/lua-resty-openidc https://github.com/zmartzone/lua-resty-openidc#sessions-and-locking

Expected Behavior

APISIX openid-connect plugin should call explicit session:close() and subsequent requests (using the same APISIX session) should complete immediately.

Error Logs

No response

Steps to Reproduce

  1. Configure APISIX openid-connect plugin for a server-side session store that supports locking
  2. Configure route using the openid-connect plugin
  3. Authenticate on protected route
  4. Immediately refresh route using the same session cookie - request will hang until the default or configured lock ttl

Environment

  • APISIX version (run apisix version): 2.15.0
  • Operating system (run uname -a): Linux apisix-6fcbf58999-t8x9r 5.15.0-48-generic # 54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 Linux
  • OpenResty / Nginx version (run openresty -V or nginx -V): nginx version: openresty/1.21.4.1
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info): N/A
  • APISIX Dashboard version, if relevant: N/A
  • Plugin runner version, for issues related to plugin runners: N/A
  • LuaRocks version, for installation issues (run luarocks --version): /usr/local/bin/luarocks 3.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions