From modules-dev-return-3361-apmail-httpd-modules-dev-archive=httpd.apache.org@httpd.apache.org Thu Mar 31 17:26:28 2011 Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 99788 invoked from network); 31 Mar 2011 17:26:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Mar 2011 17:26:28 -0000 Received: (qmail 72968 invoked by uid 500); 31 Mar 2011 17:26:28 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 72923 invoked by uid 500); 31 Mar 2011 17:26:27 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 72915 invoked by uid 99); 31 Mar 2011 17:26:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2011 17:26:27 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sorinm@gmail.com designates 209.85.216.45 as permitted sender) Received: from [209.85.216.45] (HELO mail-qw0-f45.google.com) (209.85.216.45) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2011 17:26:19 +0000 Received: by qwj8 with SMTP id 8so2506028qwj.18 for ; Thu, 31 Mar 2011 10:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=KzRjMA5zINNSDEqsT3TpIZMYQmkW1dHZUtRv/VMtWw4=; b=wID4UQWPjHnSB7VLOKysRA7U/EZ5vZhzO1ypaQOVof8KT5b65L9meu8Jzyo7Q/UN/j icV1FkH7O8oEJOnl8mLid4/w6YinV8R/L8iFqH+Z6uR1lfgsfP8D0c+4cSxwScMW6FuQ iEkqVPl5zjmxJSHoZIZUpCwrfnaFGC/XB5BCg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ilGj0RdaS4tru0dhyb8Ry0Kt10yYXf1maftQ2q0plIhdKMP4lK40XMh74Cx6mAgFgn cbOd2hANrtkAqog1LRl7i+RgrgejwagYrcr12MkaR+B6iAvT+dpzDE3pa/bJfMxEgLT7 DkT+kE73E+3JqnEoanCv7zXqJFfZG6bAGxCGM= MIME-Version: 1.0 Received: by 10.224.215.73 with SMTP id hd9mr2525808qab.262.1301592358688; Thu, 31 Mar 2011 10:25:58 -0700 (PDT) Received: by 10.224.37.19 with HTTP; Thu, 31 Mar 2011 10:25:58 -0700 (PDT) In-Reply-To: References: Date: Thu, 31 Mar 2011 19:25:58 +0200 Message-ID: Subject: Re: cpu 100% From: Sorin Manolache To: modules-dev@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Mar 31, 2011 at 19:10, Niko Goutte wrote: > >> Date: Thu, 31 Mar 2011 18:22:34 +0200 >> Subject: Re: cpu 100% >> From: sorinm@gmail.com >> To: modules-dev@httpd.apache.org >> >> > ----------------------------------------------------------------------= --------------------------------------------------------- >> > HERE IS: >> > #include >> > #include >> > #include >> > #include >> > #include >> > #include >> > #include >> > #include >> > >> > >> > #define ASE_FILE_SIZE =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0512000 >> > #define ASE_BUFFER_SIZE =A0 =A0 =A0 =A0 =A0 104858 >> > >> > module AP_MODULE_DECLARE_DATA =A0 =A0 ase_mod_module; >> > #define ASE_MOD_HANDLER "ase-mod.extensions" >> > >> > static int ase_mod_handler(request_rec *r) >> > { >> > =A0 =A0apr_status_t rv =3D APR_SUCCESS; >> > =A0 =A0apr_bucket_brigade* bb =3D NULL;; >> > =A0 =A0apr_bucket* b =3D NULL;; >> > =A0 =A0char filename[256]; >> > >> > =A0 =A0/* First, some housekeeping. */ >> > =A0 =A0if (((!r->handler) !=3D 0)|| (strcmp(r->handler, ASE_MOD_HANDLE= R))) >> > =A0 =A0{ >> > =A0 =A0 =A0 =A0/* r->handler wasn't "ase_mod", so it's none of our bus= iness */ >> > =A0 =A0 =A0 =A0ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,"Decli= ne processing file %s is not %s and handler %s", r->filename,ASE_MOD_HANDLE= R,r->handler); >> > =A0 =A0 =A0 =A0return DECLINED; >> > =A0 =A0} >> > >> > =A0 =A0if (r->method_number !=3D M_GET) >> > =A0 =A0{ >> > =A0 =A0 =A0 =A0ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,"Error= METHOD_NOT_ALLOWED (%d)",r->method_number); >> > =A0 =A0 =A0 =A0return HTTP_METHOD_NOT_ALLOWED; >> > =A0 =A0} >> > >> > =A0 =A0ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"%s",r->the_r= equest); >> > >> > =A0 =A0// Construct filename >> > =A0 =A0strncpy(filename, r->filename, sizeof(filename) / sizeof(char) = - 1); >> > =A0 =A0filename[sizeof(filename) / sizeof(char) - 1] =3D '\0'; >> > >> > =A0 =A0ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"filename =3D= %s",filename); >> > >> > =A0 =A0int DataSize =3D ASE_FILE_SIZE; >> > >> > =A0 =A0ap_set_content_type(r, "video/ase"); >> > >> > =A0 =A0ap_update_mtime(r, r->finfo.mtime); >> > =A0 =A0ap_set_last_modified(r); >> > >> > =A0 =A0apr_table_setn(r->headers_out, "Accept-Ranges", "bytes"); >> > >> > =A0 =A0r->vlist_validator =3D apr_pstrcat(r->pool, "X",apr_itoa(r->poo= l, DataSize), "\"", NULL); >> > =A0 =A0ap_set_etag(r); >> > >> > =A0 =A0char content_range[64]; >> > =A0 =A0sprintf(content_range,"bytes %d-%d/%d",0,ASE_FILE_SIZE-1,ASE_FI= LE_SIZE); >> > =A0 =A0ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,"Add content= range %s",content_range); >> > =A0 =A0apr_table_setn(r->headers_out, "Content-Range",content_range); >> > >> > =A0 =A0r->status =3D HTTP_OK; >> > >> > =A0 =A0bb =3D apr_brigade_create(r->pool, r->connection->bucket_alloc)= ; >> > =A0 =A0char* Buf; >> > =A0 =A0Buf =3D apr_palloc(r->pool,ASE_BUFFER_SIZE); >> > =A0 =A0int size =3D ASE_BUFFER_SIZE; >> > >> > =A0 =A0unsigned int count =3D 0; >> > =A0 =A0while(DataSize>0) >> > =A0 =A0{ >> > =A0 =A0 =A0 =A0if((DataSize - size)<0) >> > =A0 =A0 =A0 =A0{ >> > =A0 =A0 =A0 =A0 =A0 =A0size =3D DataSize; >> > =A0 =A0 =A0 =A0} >> > >> > =A0 =A0 =A0 =A0memset(Buf,count,size); >> > >> > =A0 =A0 =A0 =A0b =3D apr_bucket_pool_create(Buf ,size, r->pool, r->con= nection->bucket_alloc) ; >> > >> > =A0 =A0 =A0 =A0APR_BRIGADE_INSERT_TAIL(bb, b); >> > =A0 =A0 =A0 =A0APR_BRIGADE_INSERT_TAIL(bb,apr_bucket_flush_create(bb->= bucket_alloc)); >> > >> > =A0 =A0 =A0 =A0if(DataSize <=3D size) >> > =A0 =A0 =A0 =A0{ >> > =A0 =A0 =A0 =A0 =A0 =A0APR_BRIGADE_INSERT_TAIL(bb,apr_bucket_eos_creat= e(bb->bucket_alloc)); >> > =A0 =A0 =A0 =A0 =A0 =A0ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->serv= er,"APR_BRIGADE_INSERT_TAIL EOS Bucket"); >> > =A0 =A0 =A0 =A0} >> > >> > =A0 =A0 =A0 =A0rv =3D ap_pass_brigade(r->output_filters, bb); >> > >> > =A0 =A0 =A0 =A0if (rv !=3D APR_SUCCESS) >> > =A0 =A0 =A0 =A0{ >> > =A0 =A0 =A0 =A0 =A0 =A0ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->serve= r,"HTTP_INTERNAL_SERVER_ERROR ap_pass_brigade "); >> > =A0 =A0 =A0 =A0 =A0 =A0r->status =3D HTTP_INTERNAL_SERVER_ERROR; >> > =A0 =A0 =A0 =A0 =A0 =A0return r->status; >> > =A0 =A0 =A0 =A0} >> > >> > =A0 =A0 =A0 =A0DataSize =3D DataSize - size; >> > =A0 =A0 =A0 =A0count++; >> > =A0 =A0 =A0 =A0ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"ap_p= ass_brigade, DataSize =3D =A0%d and Size =3D %d",DataSize, size ); >> > >> > =A0 =A0 =A0 =A0apr_brigade_cleanup(bb); >> > =A0 =A0} >> > >> > =A0 =A0ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"Out of While= "); >> > >> > =A0 =A0apr_bucket_delete(b); >> >> Try to remove this apr_bucket_delete from here. apr_brigade_cleanup in >> the while loop deletes the buckets in the brigade. I think you delete >> b twice. >> >> Sorin > > > > That's true, I've no more the segmentation fault but in wireshark capture= on the client side, I've this error message only in prefork mode: > > > > GET /mmrk_dummy_2mbps_10s.mmrk?TxId=3D8 HTTP/1.1 > Range: bytes=3D0-511999 > User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/= 0.9.8b zlib/1.2.3 libidn/0.6.5 > Host: 192.X.X.X > > Accept: */* > Cache-Control: no-cache > > HTTP/1.1 200 OK > Date: Thu, 31 Mar 2011 16:53:57 GMT > Server: Apache/2.2.3 (CentOS) > Last-Modified: Fri, 25 Mar 2011 11:18:16 GMT > Accept-Ranges: bytes > ETag: "12a8006-4e2e90-49f4cc0186e00;512000" > Content-Range: bytes 0-511999/512000 > Connection: close > Transfer-Encoding: chunked > Content-Type: video/ase > > 1999a + DATA > 1999a + DATA > 1999a + DATA > 1999a + DATA > 0 > > 23e > > > 200 OK > >

OK

>

The server encountered an internal error or > misconfiguration and was unable to complete > your request.

>

Please contact the server administrator, > =A0root@localhost and inform them of the time the error occurred, > and anything you might have done that may have > caused the error.

>

More information about this error may be available > in the server error log.

>
>
Apache/2.2.3 (CentOS) Server at 192.X.X.X Port 80
> > Try to exit with return OK instead of return r->status from your handler. Sorin