Hello, I developped an apache module which send small data coming from file. A client request from file through a Get request and data are sent with block size equals to 100KB. One 100KB buffer is allocated in the pool, then each buffer are used to create one bucket that will be sent just after being inserted into the brigade. To sum up: ---------------------------------------------------------------------------------------------------------------------------- apr_bucket_brigade *bb; apr_bucket* b;
bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); Buf = apr_palloc(r->pool,100KB); while(lastBufferToSend==false) { Processing(Buf); b = apr_bucket_pool_create(Buf ,size, r->pool, r->connection->bucket_alloc) ; APR_BRIGADE_INSERT_TAIL(bb, b); APR_BRIGADE_INSERT_TAIL(bb,apr_bucket_flush_create(bb->bucket_alloc)); if(lastBufferToSend) { APR_BRIGADE_INSERT_TAIL(bb,apr_bucket_eos_create(bb->bucket_alloc)); } rv = ap_pass_brigade(r->output_filters, bb); if (rv != APR_SUCCESS) { return HTTP_INTERNAL_SERVER_ERROR; } apr_brigade_cleanup(bb); } apr_brigade_destroy(bb); ---------------------------------------------------------------------------------------------------------------------------- I want to call ap_pass_brigade for each buffer because I want the module to send immediatly 100KB. Clients don't have to wait for the complete processing of the file more than 2GB. They receive small blocks until the end. -------------------------------------------------------------------------------------------------------------------------- Apache Server is in prefork mode. <IfModule prefork.c> StartServers 8 MinSpareServers 5 MaxSpareServers 20 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 4000 </IfModule> In worker mode, everything is excepted 10 bytes that are send in addition including value "\n256\r\n" : it is very strange because the sum of every chunk corrsesponds exactly to the expected size. <IfModule worker.c> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadPerChild 64 MaxClients 1024 MaxRequestsPerChild 0 </IfModule> -------------------------------------------------------------------------------------------------------------------------- MY PROBLEMS: In prefork mode, the first 8 client requests (which corresponds to the StartServers = 8) are well processed. My client received all data, everything is fine. But the 9th freezes the module in ap_pass_brigade function. httpd is freezed with 100% cpu on this process. In worker mode, it is ok excepted the 10 bytes added. It seems that it is linked with apr_brigade_destroy or apr_bucket_delete(b). If someone can provide me answers to these problems, I'll be very happy. Thank you. Nicolas.