Skip to content

fix: eliminate deepcopy when destroying prometheus#12905

Merged
Baoyuantop merged 1 commit into
apache:masterfrom
shreemaan-abhishek:fix/dont-deepcopy
Jan 22, 2026
Merged

fix: eliminate deepcopy when destroying prometheus#12905
Baoyuantop merged 1 commit into
apache:masterfrom
shreemaan-abhishek:fix/dont-deepcopy

Conversation

@shreemaan-abhishek

@shreemaan-abhishek shreemaan-abhishek commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Description

This PR: #11117 introduced a bug: deep-copying the prometheus table when destroying prometheus. Which would lead to the following failure:

2026/01/13 15:42:35 [error] 255#255: exit_worker_by_lua error: /usr/local/apisix/apisix/core/table.lua:144: table overflow
stack traceback:
    /usr/local/apisix/apisix/core/table.lua:131: in function '_deepcopy'
    /usr/local/apisix/apisix/core/table.lua:141: in function '_deepcopy'
    /usr/local/apisix/apisix/core/table.lua:141: in function '_deepcopy'
    /usr/local/apisix/apisix/core/table.lua:141: in function '_deepcopy'
    /usr/local/apisix/apisix/core/table.lua:166: in function 'deepcopy'
    /usr/local/apisix/apisix/plugins/prometheus/exporter.lua:917: in function 'destroy'
    /usr/local/apisix/apisix/plugin.lua:128: in function 'unload_plugin'
    /usr/local/apisix/apisix/plugin.lua:477: in function 'exit_worker'
    /usr/local/apisix/apisix/init.lua:183: in function 'http_exit_worker'
    exit_worker_by_lua:2: in main chunk

Deep-copying in this scenario is not necessary as nullifying the source table won't nullify the backup table

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Jan 14, 2026
@Baoyuantop
Baoyuantop merged commit a269d61 into apache:master Jan 22, 2026
24 checks passed
wistefan pushed a commit to wistefan/apisix that referenced this pull request Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants