apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niko Goutte <ngou...@hotmail.com>
Subject RE: cpu 100% or destroy brigade
Date Thu, 17 Mar 2011 20:12:20 GMT

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);

  if(lastBufferToSend)
  {    
    APR_BRIGADE_INSERT_TAIL(bb,apr_bucket_eos_create(bb->bucket_alloc));
  }
  
  rv = ap_pass_brigade(r->output_filters, bb);

  apr_bucket_delete(b);
  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.

 

--------------------------------------------------------------------------------------------------------------------------

MY PROBLEM:

If I do the delete and destroy (apr_bucket_delete(b) and apr_brigade_destroy(bb)) I do not
lock the main thread to 100% but an error is returned:
"The server encountered an internal error or misconfiguration and was unable to complete your
request "

without any logs in the Apache error_logs file.


If someone can provide me answer to this problem, I'll be very happy.

Thank you.

 

Nicolas.




 		 	   		  
Mime
View raw message