Forking Nginx process

Tigran Bayburtsyan tigran.bayburtsyan at gmail.com
Wed Feb 18 15:37:13 UTC 2015


Hi.
I'm writing simple module for Nginx just to fork process on request and
execute some separate process and then exit.

*if(fork() == 0)*
*{*
*       // Use r  request pointer*
*.*
*.*
*.*
*   // creating out_chain (could be more than 700kb)*
*    ngx_http_output_filter ( r , out_chain );*

*    ngx_http_finalize_request(r, NGX_OK);*
*}*
*else*
*{*
*       close(r->connection->fd); *

*       ngx_http_finalize_request(r, NGX_OK);*
*}*

if I'm sending 1 request per time it works fine , but when I'm sending 2 or
more requests at the same time works only the last request , other requests
just staying in loading stage.

Who can help me figure out what is the problem ?

I'm just thinking it could be because ngx_request_t *r pointer is in nginx
shared memory so every request overriding another .... but maybe it's not
about that.

Please let me know if you can give any help.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150218/f908af61/attachment.html>


More information about the nginx-devel mailing list