static void
ngx_http_lua_socket_handle_read_error(ngx_http_request_t *r,
ngx_http_lua_socket_tcp_upstream_t *u, ngx_uint_t ft_type)
{
ngx_http_lua_ctx_t *ctx;
ngx_http_lua_co_ctx_t *coctx;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"lua tcp socket handle read error");
u->ft_type |= ft_type;
#if 0
ngx_http_lua_socket_tcp_finalize(r, u);
#endif
u->read_event_handler = ngx_http_lua_socket_dummy_handler;
if (u->read_waiting) {
u->read_waiting = 0;
coctx = u->read_co_ctx;
coctx->cleanup = NULL;
u->read_co_ctx = NULL;
ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module); // 这里ctx 为空 导致 core dump 有人遇到过这种情况吗?
ctx->resume_handler = ngx_http_lua_socket_tcp_read_resume;
ctx->cur_co_ctx = coctx;
ngx_http_lua_assert(coctx && (!ngx_http_lua_is_thread(ctx)
|| coctx->co_ref >= 0));
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"lua tcp socket waking up the current request");
r->write_event_handler(r);
}
}