Open aholic opened 6 years ago
if there is a method for a coroutine to get his parent, that's ok....
is there any way to work around?
@aholic Maybe you need to use ngx.on_abort
and ngx.thread.kill
?
do you mean code like this ?
ngx.on_abort(function()
ngx.log(ngx.ERR, 'on_abort')
ngx.log(ngx.ERR, 'kill: ', ngx.thread.kill(th))
end)
it will get a killer not parent
error...
@aholic Apparently you need to notify the parent thread from within your on_abort()
thread to kill its own children or notify the children to stop processing when they are convenient.
Another brutal way is just to call ngx.exit(444)
in side your on_abort()
handler.
Making ngx.thread.kill()
to work on any light threads is still a TODO and there is a pending PR for it: #476
@agentzh but if the client has gone, there's no chance for the parent thread to run because the parent thread is blocked on ngx.thread.wait()
.... how to notify the parent thread from within on_abort()
?
See my previous comment for alternatives.
hello, i am meeting this problem:
how can i stop A and B when main request ternimated ?