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

fix(core) ctx dropped in log phase #8604

Merged
merged 6 commits into from
Apr 7, 2022
Merged

Conversation

StarlightIbuki
Copy link
Contributor

Log phase does recover ngx.ctx for some of functions(with wrapper function), however for those functions not wrapped, they will see an empty ngx.ctx, and cause an unreadable error message for check_phase.
This is an ad hoc fix for check_phase.

Fix #8598

@StarlightIbuki
Copy link
Contributor Author

For people who want to review this PR:
We handle log phase RPC in a timer because we are using cosocket for RPC that is not available in the log phase.
We did save the ngx.ctx object but if we recover it unconditionally it causes new problems(and ngx.ctx is not stable).

@ADD-SP
Copy link
Contributor

ADD-SP commented Mar 30, 2022

Should we keep the context for all phases? This way seems a bit unreliable. Is there any other way that we can share data for all phases, except shared memory and database?

@StarlightIbuki
Copy link
Contributor Author

@fffonion suggests recovering ngx.ctx in the timer instead of in mp_rpc.lua, as this should be transparent to the rpc implementation, and apply both for mp and pb.

Copy link
Contributor

@fffonion fffonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment, otherwise look good to me. feel free to merge after addressed (and squashed)

StarlightIbuki and others added 6 commits April 7, 2022 15:44
Log phase does recover ngx.ctx for some of functions(with wrapper function), however for those functon not wrapped, they will see an empty ngx.ctx, and cause unreadable error message for `check_phase`.
This is an ad hoc fix for `check_phase`.

Fix #8598
Co-authored-by: Wangchong Zhou <[email protected]>
@StarlightIbuki
Copy link
Contributor Author

Rebased the PR. Hope that will fix the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] plugin log phase handler causes error in PDK
3 participants