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

feature: support socket in some block phase #1825

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

rainingmaster
Copy link
Member

I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.

Sometime we need use cosocket in init_by_lua to get some data from remote before NGINX init.
This feature allow us use cosocket in some block phase, and we should limit its use way.

config Outdated Show resolved Hide resolved
@rainingmaster rainingmaster force-pushed the block_by_event branch 11 times, most recently from 972f3d4 to f083783 Compare November 20, 2020 01:17
@rainingmaster rainingmaster force-pushed the block_by_event branch 9 times, most recently from 836cadf to 96f98b8 Compare November 28, 2020 16:06
@mergify
Copy link

mergify bot commented Feb 24, 2022

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Feb 24, 2022

if (revents & (EPOLLERR|EPOLLHUP)) {
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
"epoll_wait() error on fd:%d ev:%04XD",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"epoll_wait() error on fd:%d ev:%04XD",
"lua epoll_wait() error on fd:%d ev:%04XD",

}

if (events == 0) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
if (timer != NGX_TIMER_INFINITE) {
return NGX_OK;
}
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,

}

if (events == 0) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
if (timer != NGX_TIMER_INFINITE) {
return NGX_OK;
}
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,

}

if (ready == 0) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
if (timer != NGX_TIMER_INFINITE) {
return NGX_OK;
}
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,

Comment on lines +24 to +26
extern ngx_http_lua_event_actions_t ngx_http_lua_epoll;
extern ngx_http_lua_event_actions_t ngx_http_lua_poll;
extern ngx_http_lua_event_actions_t ngx_http_lua_kqueue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
extern ngx_http_lua_event_actions_t ngx_http_lua_epoll;
extern ngx_http_lua_event_actions_t ngx_http_lua_poll;
extern ngx_http_lua_event_actions_t ngx_http_lua_kqueue;
#if (NGX_HAVE_EPOLL)
extern ngx_http_lua_event_actions_t ngx_http_lua_epoll;
#endif
#if (NGX_HAVE_POLL)
extern ngx_http_lua_event_actions_t ngx_http_lua_poll;
#endif
#if (NGX_HAVE_KQUEUE)
extern ngx_http_lua_event_actions_t ngx_http_lua_kqueue;
#endif

@@ -890,15 +911,233 @@ ngx_http_lua_init(ngx_conf_t *cf)
ngx_http_lua_assert(lmcf->lua != NULL);

if (!lmcf->requires_shm && lmcf->init_handler) {
cycle = cf->cycle;
Copy link
Contributor

Choose a reason for hiding this comment

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

we should move all these codes into init_handler

@@ -40,6 +40,14 @@
| NGX_HTTP_LUA_CONTEXT_SSL_CERT \
| NGX_HTTP_LUA_CONTEXT_SSL_SESS_FETCH)

#define NGX_HTTP_LUA_CONTEXT_BLOCKED_COSOCKET \
(NGX_HTTP_LUA_CONTEXT_INIT \
Copy link
Contributor

Choose a reason for hiding this comment

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

need align




=== TEST 73: run in init_worker_by_lua
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
=== TEST 73: run in init_worker_by_lua
=== TEST 73: run in init_by_lua

\z
[error]
--- timeout: 5
--- ONLY
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--- ONLY
--- ONLY
Suggested change
--- ONLY

@mergify mergify bot removed the conflict label Mar 20, 2023
@mergify
Copy link

mergify bot commented Mar 20, 2023

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Mar 20, 2023
@mergify mergify bot removed the conflict label May 10, 2023
@mergify
Copy link

mergify bot commented May 10, 2023

This pull request is now in conflict :(

@mergify mergify bot added the conflict label May 10, 2023
@mergify mergify bot removed the conflict label Sep 23, 2023
@mergify
Copy link

mergify bot commented Sep 23, 2023

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Sep 23, 2023
@mergify mergify bot removed the conflict label Mar 6, 2024
Copy link

mergify bot commented Mar 6, 2024

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Mar 6, 2024
@mergify mergify bot removed the conflict label May 27, 2024
Copy link

mergify bot commented May 27, 2024

This pull request is now in conflict :(

@mergify mergify bot added the conflict label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants