Re: PHP 4.0 Bug #7199 Fixed
| From: | Jason Greene | Date: | Sat, 14 Oct 2000 06:21:16 +0000 |
| Subject: | Re: PHP 4.0 Bug #7199 Fixed | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-34985@lists.php.net to get a copy of this message | ||
excuse the formating of that patch, I did not verify all tabs.
----- Original Message -----
From: "Jason Greene" <jason@inetgurus.net>
To: <php-dev@lists.php.net>
Cc: <rasmus@php.net>; <zeev@zend.com>; "Andi Gutmans" <andi@zend.com>;
<ssb@fast.no>
Sent: Friday, October 13, 2000 11:17 PM
Subject: Re: [PHP-DEV] PHP 4.0 Bug #7199 Fixed
> Hi all,
>
> Here is the fix to the x-httpd-php-source problem. If you have any questions let me know.
>
> -Jason
>
> *** sapi_apache.c.orig Fri Oct 13 23:12:44 2000
> --- sapi_apache.c Fri Oct 13 22:55:02 2000
> ***************
> *** 69,91 ****
> /* sending a file handle to another dll is not working
> // so let zend open it.
> */
> ! file_handle.type = ZEND_HANDLE_FILENAME;
> ! file_handle.handle.fd = 0;
> ! file_handle.filename = SG(request_info).path_translated;
> ! file_handle.opened_path = NULL;
> ! file_handle.free_filename = 0;
> !
> if (display_source_mode) {
> zend_syntax_highlighter_ini syntax_highlighter_ini;
>
> ! if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
> ! php_get_highlight_struct(&syntax_highlighter_ini);
> ! zend_highlight(&syntax_highlighter_ini);
> return OK;
> } else {
> return NOT_FOUND;
> }
> } else {
> (void) php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
> }
>
> --- 69,91 ----
> /* sending a file handle to another dll is not working
> // so let zend open it.
> */
> !
> if (display_source_mode) {
> zend_syntax_highlighter_ini syntax_highlighter_ini;
>
> ! php_get_highlight_struct(&syntax_highlighter_ini);
> ! if (highlight_file(SG(request_info).path_translated,&syntax_highlighter_ini)){
> return OK;
> } else {
> return NOT_FOUND;
> }
> } else {
> + file_handle.type = ZEND_HANDLE_FILENAME;
> + file_handle.handle.fd = 0;
> + file_handle.filename = SG(request_info).path_translated;
> + file_handle.opened_path = NULL;
> + file_handle.free_filename = 0;
> +
> (void) php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
> }
>
>
>
> ----- Original Message -----
> From: "Bug Database" <php-dev@lists.php.net>
> To: <php-dev@lists.php.net>
> Sent: Friday, October 13, 2000 9:03 PM
> Subject: [PHP-DEV] PHP 4.0 Bug #7199 Updated: Memmory leak when calling x-httpd-php-source
>
>
> > ID: 7199
> > User Update by: jason@inetgurus.net
> > Status: Open
> > Bug Type: Apache related
> > Description: Memmory leak when calling x-httpd-php-source
> >
> > I have solved the problem and have a solution. Zend has a function already built for
> > displaying highlighted files,
highlight_file,
> this is the same function called by php's
> > highlight_file. The sapi module ,however, does not store and reset the lexical state.
> > Therefore, a new state is created with
every
> call to apache_php_module_main.
> >
> > There are 2 possible solutions. One is too reqrite the sapi module to store the lexical
> > state. The other, the one I am going to
> send a patch on, is to just call the already written highlight_file function( that way there is
> one location to modify when this
> changes. ) I will be writing to php-dev with the fix after I update this
> >
> > -Jason
> >
> > Previous Comments:
> > ---------------------------------------------------------------------------
> >
> > [2000-10-13 23:40:34] jason@inetgurus.net
> > Well I have been stabbing at this for a really long time.
> > I ended up in in zend-scanner.l where I can see lex allocating the 16K block as it should,
> > but I am not sure how to free a block
> with zends internal engine. Since the sapi module calls open_file_for_scanning, I can see why
> the block is allocated. I have tried
> calling zend_destroy_file_handle, since php_execute_script calls it. That did clean the
> file_handle but not the memmory area. I
can
> also see the that zend_execute_scripts will recycle from already allocated code, but of coure
> just calling open_file_for_scanning
> would bypass this and not use a cached instance. Is there a need to clear the current op_array
> associated with this?
> >
> > ---------------------------------------------------------------------------
> >
> > [2000-10-13 22:20:43] jason@inetgurus.net
> > bug still exists in latest cvs
> >
> > ---------------------------------------------------------------------------
> >
> > [2000-10-13 20:53:29] andi@php.net
> > Can you please try the latest CVS. A memory leak was fixed.
> >
> > ---------------------------------------------------------------------------
> >
> > [2000-10-13 20:41:17] jason@inetgurus.net
> > I am currently debugging php trying to find the leak. So far it appears that the memmory
> > segment is allocated by the function
> open_file_for_scanning, and that it is never cleared. I will post more as I find more.
> >
> > -Jason
> >
> > ---------------------------------------------------------------------------
> >
> > [2000-10-13 17:28:02] jason@inetgurus.net
> > Verified bug on php 4.0.3/Apache 1.3.12/Redhat Linux 6.2 Intel/DSO, with the exception of
> > memmory growing in 4K increments.(Arch
> difference from sparc)
> >
> > ---------------------------------------------------------------------------
> >
> > The remainder of the comments for this report are too long. To view the rest of the
> > comments, please view the bug report
online.
> >
> > Full Bug description available at:
> > http://bugs.php.net/?id=7199
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-dev-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>