Skip to content

bug: read header may cause an abnormally high CPU #7258

Description

@zuiyangqingzhou

Current Behavior

currently, apisix gets the "X-Forwarded-Proto" header when calling the set_upstream_headers function,

https://github.com/apache/apisix/blob/master/apisix/init.lua#L228-L239

but it reads all the headers first, which may cause the CPU to rise abnormally if the number of headers is very large and the size is large

https://github.com/apache/apisix/blob/master/apisix/core/request.lua#L45-L66

image

Expected Behavior

No response

Error Logs

No response

Steps to Reproduce

none

Environment

  • APISIX version (run apisix version):
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions