#38950 [NEW]: script times out long befor reaching max. execution time

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #38950 [NEW]: script times out long befor reaching max. execution time

    From: pavel dot stratil-jun at fenix dot cz
    Operating system: gentoo (amd64smp)
    PHP version: 5.1.6
    PHP Bug Type: *Encryption and hash functions
    Bug description: script times out long befor reaching max. execution time

    Description:
    ------------
    when trying to hash large files (cant say yet how large, but a 800MB file
    was hashed without problems but a 1300MB file not), the script times out
    after about 1 minute even if max. execution time is set to half an hour.
    smaller files, such as the 800MB file were successfully hashed a few times
    using different hashing methods (in total the script took about 4 minutes
    to run).

    Reproduce code:
    ---------------
    // tried both:

    $fp = fopen('file.ext', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp,$bytes));
    }
    $res_hash = hash_final($ctx); // this would be line 58
    fclose($fp);

    // and

    hash_file('sha512', 'file.ext'); // this would be line 67

    // $bytes were set to anywhere from 4kB to 32MB.. same result all the time

    Expected result:
    ----------------
    obviously, a hash.

    Actual result:
    --------------
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    or

    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 67.

    depending what piece of code was commented.

    --
    Edit bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=38950&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=38950&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=38950&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=38950&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=38950&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=38950&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=38950&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=38950&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=38950&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=38950&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=38950&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=38950&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=38950&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=38950&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=38950&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=38950&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=38950&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=38950&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=38950&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=38950&r=mysqlcfg[/url]
    pavel dot stratil-jun at fenix dot cz Guest

  2. Similar Questions and Discussions

    1. Problems with the time limit of script execution
      Hi, I'm working with a big amount of data (stored in datasets) and I've got a lot of problems with script execution time limit. So is there...
    2. Extremely long startup times in RHEL4
      I seeing some very strange behaviour in my latest install of MX 7 on RHEL4. The install goes fine, except for the fact that it doesn't...
    3. long audio lag times
      We are currently trying to put together a web site to tutor/teach the disabled. We were hoping to get disabled students to register, create a...
    4. [PHP] Script Execution Time
      Petya A Shushpanov <mailto:shpa@eastof.ru> on Monday, July 28, 2003 3:41 PM said: You could one up this class by creating another method that...
    5. Script Execution Time
      Could someone pass on a snippet, a function or a technique for measuring script times. It appears the host I am with is having some PHP engine...
  3. #2

    Default #38950 [Opn->Fbk]: script times out long befor reaching max. execution time

    ID: 38950
    Updated by: [email]tony2001@php.net[/email]
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Open
    +Status: Feedback
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]




    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-25 15:01:51] pavel dot stratil-jun at fenix dot cz

    Description:
    ------------
    when trying to hash large files (cant say yet how large, but a 800MB
    file was hashed without problems but a 1300MB file not), the script
    times out after about 1 minute even if max. execution time is set to
    half an hour. smaller files, such as the 800MB file were successfully
    hashed a few times using different hashing methods (in total the script
    took about 4 minutes to run).

    Reproduce code:
    ---------------
    // tried both:

    $fp = fopen('file.ext', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp,$bytes));
    }
    $res_hash = hash_final($ctx); // this would be line 58
    fclose($fp);

    // and

    hash_file('sha512', 'file.ext'); // this would be line 67

    // $bytes were set to anywhere from 4kB to 32MB.. same result all the
    time

    Expected result:
    ----------------
    obviously, a hash.

    Actual result:
    --------------
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    or

    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 67.

    depending what piece of code was commented.


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    tony2001@php.net Guest

  4. #3

    Default #38950 [Fbk->Opn]: script times out long befor reaching max. execution time

    ID: 38950
    User updated by: pavel dot stratil-jun at fenix dot cz
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Feedback
    +Status: Open
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:

    seems that the problem is in

    $fp = fopen('test', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp, 4096));
    }
    $uplo_mhash = hash_final($ctx);
    fclose($fp);

    when calling the script from apache. When running from shell the
    problem disappears completely. In apache the premature timeout problem
    disappeared in the snapshot version, but streaming hashing still fails
    on large files (the script timeouts for real after max_execution_time
    even on relatively small files, compared to the first tests - i.e.
    200MB). Hash_file() seems to work flawlesly. When going towards smaller
    files, streaming hashing catches on and is about 60% the speed of
    hash_file.

    Tried this with apache 2.2.2 and 2.2.3 with modified as well as
    distribution configurations with the same result.


    tested on
    php5.2-200609261030
    ../configure --prefix=${PHP_PATH} --with-apxs2=${APACHE_PATH}/bin/apxs
    gmake # ok
    gmake test # failed in 4 tests

    # Test for buffering in core functions with implicit flush off
    [tests/func/008.phpt]
    # Bug #16069 [ext/iconv/tests/bug16069.phpt]
    #iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
    # Math constants [ext/standard/tests/math/constants.phpt]

    ps: dont know how far the development of php 5.2 is but i was getting
    many compile failures when trying to build with some common extensions
    such as imap (against imap2006) or mysqli (5.1.11).


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 09:13:41] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-09-25 15:01:51] pavel dot stratil-jun at fenix dot cz

    Description:
    ------------
    when trying to hash large files (cant say yet how large, but a 800MB
    file was hashed without problems but a 1300MB file not), the script
    times out after about 1 minute even if max. execution time is set to
    half an hour. smaller files, such as the 800MB file were successfully
    hashed a few times using different hashing methods (in total the script
    took about 4 minutes to run).

    Reproduce code:
    ---------------
    // tried both:

    $fp = fopen('file.ext', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp,$bytes));
    }
    $res_hash = hash_final($ctx); // this would be line 58
    fclose($fp);

    // and

    hash_file('sha512', 'file.ext'); // this would be line 67

    // $bytes were set to anywhere from 4kB to 32MB.. same result all the
    time

    Expected result:
    ----------------
    obviously, a hash.

    Actual result:
    --------------
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    or

    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 67.

    depending what piece of code was commented.


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    pavel dot stratil-jun at fenix dot cz Guest

  5. #4

    Default #38950 [Opn->Fbk]: script times out long befor reaching max. execution time

    ID: 38950
    Updated by: [email]tony2001@php.net[/email]
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Open
    +Status: Feedback
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:
    >but streaming hashing still fails on large files (the
    >script timeouts for real after max_execution_time even on
    > relatively small files, compared to the first tests - i.e.
    >200MB)
    Please elaborate.
    >many compile failures when trying to build with some
    > common extensions such as imap (against imap2006) or
    > mysqli (5.1.11).
    Please report them as separate issues.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 12:45:31] pavel dot stratil-jun at fenix dot cz

    seems that the problem is in

    $fp = fopen('test', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp, 4096));
    }
    $uplo_mhash = hash_final($ctx);
    fclose($fp);

    when calling the script from apache. When running from shell the
    problem disappears completely. In apache the premature timeout problem
    disappeared in the snapshot version, but streaming hashing still fails
    on large files (the script timeouts for real after max_execution_time
    even on relatively small files, compared to the first tests - i.e.
    200MB). Hash_file() seems to work flawlesly. When going towards smaller
    files, streaming hashing catches on and is about 60% the speed of
    hash_file.

    Tried this with apache 2.2.2 and 2.2.3 with modified as well as
    distribution configurations with the same result.


    tested on
    php5.2-200609261030
    ../configure --prefix=${PHP_PATH} --with-apxs2=${APACHE_PATH}/bin/apxs
    gmake # ok
    gmake test # failed in 4 tests

    # Test for buffering in core functions with implicit flush off
    [tests/func/008.phpt]
    # Bug #16069 [ext/iconv/tests/bug16069.phpt]
    #iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
    # Math constants [ext/standard/tests/math/constants.phpt]

    ps: dont know how far the development of php 5.2 is but i was getting
    many compile failures when trying to build with some common extensions
    such as imap (against imap2006) or mysqli (5.1.11).

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

    [2006-09-26 09:13:41] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-09-25 15:01:51] pavel dot stratil-jun at fenix dot cz

    Description:
    ------------
    when trying to hash large files (cant say yet how large, but a 800MB
    file was hashed without problems but a 1300MB file not), the script
    times out after about 1 minute even if max. execution time is set to
    half an hour. smaller files, such as the 800MB file were successfully
    hashed a few times using different hashing methods (in total the script
    took about 4 minutes to run).

    Reproduce code:
    ---------------
    // tried both:

    $fp = fopen('file.ext', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp,$bytes));
    }
    $res_hash = hash_final($ctx); // this would be line 58
    fclose($fp);

    // and

    hash_file('sha512', 'file.ext'); // this would be line 67

    // $bytes were set to anywhere from 4kB to 32MB.. same result all the
    time

    Expected result:
    ----------------
    obviously, a hash.

    Actual result:
    --------------
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    or

    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 67.

    depending what piece of code was commented.


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    tony2001@php.net Guest

  6. #5

    Default #38950 [Fbk->Opn]: script times out long befor reaching max. execution time

    ID: 38950
    User updated by: pavel dot stratil-jun at fenix dot cz
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Feedback
    +Status: Open
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:

    I cant find the rule in the problem. I was able to reproduce it always
    on files > 1.2GB. I could reproduce it sometimes on files ranging from
    70MB to 1.2GB and I havent been able to reproduce on files < 70MB.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 12:59:18] [email]tony2001@php.net[/email]
    >but streaming hashing still fails on large files (the
    >script timeouts for real after max_execution_time even on
    > relatively small files, compared to the first tests - i.e.
    >200MB)
    Please elaborate.
    >many compile failures when trying to build with some
    > common extensions such as imap (against imap2006) or
    > mysqli (5.1.11).
    Please report them as separate issues.

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

    [2006-09-26 12:45:31] pavel dot stratil-jun at fenix dot cz

    seems that the problem is in

    $fp = fopen('test', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp, 4096));
    }
    $uplo_mhash = hash_final($ctx);
    fclose($fp);

    when calling the script from apache. When running from shell the
    problem disappears completely. In apache the premature timeout problem
    disappeared in the snapshot version, but streaming hashing still fails
    on large files (the script timeouts for real after max_execution_time
    even on relatively small files, compared to the first tests - i.e.
    200MB). Hash_file() seems to work flawlesly. When going towards smaller
    files, streaming hashing catches on and is about 60% the speed of
    hash_file.

    Tried this with apache 2.2.2 and 2.2.3 with modified as well as
    distribution configurations with the same result.


    tested on
    php5.2-200609261030
    ../configure --prefix=${PHP_PATH} --with-apxs2=${APACHE_PATH}/bin/apxs
    gmake # ok
    gmake test # failed in 4 tests

    # Test for buffering in core functions with implicit flush off
    [tests/func/008.phpt]
    # Bug #16069 [ext/iconv/tests/bug16069.phpt]
    #iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
    # Math constants [ext/standard/tests/math/constants.phpt]

    ps: dont know how far the development of php 5.2 is but i was getting
    many compile failures when trying to build with some common extensions
    such as imap (against imap2006) or mysqli (5.1.11).

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

    [2006-09-26 09:13:41] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-09-25 15:01:51] pavel dot stratil-jun at fenix dot cz

    Description:
    ------------
    when trying to hash large files (cant say yet how large, but a 800MB
    file was hashed without problems but a 1300MB file not), the script
    times out after about 1 minute even if max. execution time is set to
    half an hour. smaller files, such as the 800MB file were successfully
    hashed a few times using different hashing methods (in total the script
    took about 4 minutes to run).

    Reproduce code:
    ---------------
    // tried both:

    $fp = fopen('file.ext', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp,$bytes));
    }
    $res_hash = hash_final($ctx); // this would be line 58
    fclose($fp);

    // and

    hash_file('sha512', 'file.ext'); // this would be line 67

    // $bytes were set to anywhere from 4kB to 32MB.. same result all the
    time

    Expected result:
    ----------------
    obviously, a hash.

    Actual result:
    --------------
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    or

    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 67.

    depending what piece of code was commented.


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    pavel dot stratil-jun at fenix dot cz Guest

  7. #6

    Default #38950 [Opn->Fbk]: script times out long befor reaching max. execution time

    ID: 38950
    Updated by: [email]tony2001@php.net[/email]
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Open
    +Status: Feedback
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:

    Reproduce what? What is the value of max_execution_time? What is the
    error message? What is the real amount of time spent and how did you
    measure it?


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 14:19:35] pavel dot stratil-jun at fenix dot cz

    I cant find the rule in the problem. I was able to reproduce it always
    on files > 1.2GB. I could reproduce it sometimes on files ranging from
    70MB to 1.2GB and I havent been able to reproduce on files < 70MB.

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

    [2006-09-26 12:59:18] [email]tony2001@php.net[/email]
    >but streaming hashing still fails on large files (the
    >script timeouts for real after max_execution_time even on
    > relatively small files, compared to the first tests - i.e.
    >200MB)
    Please elaborate.
    >many compile failures when trying to build with some
    > common extensions such as imap (against imap2006) or
    > mysqli (5.1.11).
    Please report them as separate issues.

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

    [2006-09-26 12:45:31] pavel dot stratil-jun at fenix dot cz

    seems that the problem is in

    $fp = fopen('test', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp, 4096));
    }
    $uplo_mhash = hash_final($ctx);
    fclose($fp);

    when calling the script from apache. When running from shell the
    problem disappears completely. In apache the premature timeout problem
    disappeared in the snapshot version, but streaming hashing still fails
    on large files (the script timeouts for real after max_execution_time
    even on relatively small files, compared to the first tests - i.e.
    200MB). Hash_file() seems to work flawlesly. When going towards smaller
    files, streaming hashing catches on and is about 60% the speed of
    hash_file.

    Tried this with apache 2.2.2 and 2.2.3 with modified as well as
    distribution configurations with the same result.


    tested on
    php5.2-200609261030
    ../configure --prefix=${PHP_PATH} --with-apxs2=${APACHE_PATH}/bin/apxs
    gmake # ok
    gmake test # failed in 4 tests

    # Test for buffering in core functions with implicit flush off
    [tests/func/008.phpt]
    # Bug #16069 [ext/iconv/tests/bug16069.phpt]
    #iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
    # Math constants [ext/standard/tests/math/constants.phpt]

    ps: dont know how far the development of php 5.2 is but i was getting
    many compile failures when trying to build with some common extensions
    such as imap (against imap2006) or mysqli (5.1.11).

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

    [2006-09-26 09:13:41] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-09-25 15:01:51] pavel dot stratil-jun at fenix dot cz

    Description:
    ------------
    when trying to hash large files (cant say yet how large, but a 800MB
    file was hashed without problems but a 1300MB file not), the script
    times out after about 1 minute even if max. execution time is set to
    half an hour. smaller files, such as the 800MB file were successfully
    hashed a few times using different hashing methods (in total the script
    took about 4 minutes to run).

    Reproduce code:
    ---------------
    // tried both:

    $fp = fopen('file.ext', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp,$bytes));
    }
    $res_hash = hash_final($ctx); // this would be line 58
    fclose($fp);

    // and

    hash_file('sha512', 'file.ext'); // this would be line 67

    // $bytes were set to anywhere from 4kB to 32MB.. same result all the
    time

    Expected result:
    ----------------
    obviously, a hash.

    Actual result:
    --------------
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    or

    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 67.

    depending what piece of code was commented.


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    tony2001@php.net Guest

  8. #7

    Default #38950 [Fbk->Opn]: script times out long befor reaching max. execution time

    ID: 38950
    User updated by: pavel dot stratil-jun at fenix dot cz
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Feedback
    +Status: Open
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:

    * Reproduce what?
    reproduce the timeout error when trying streaming hashing.

    * What is the value of max_execution_time?
    1800 seconds

    * What is the error message?
    on php 5.1.6 after running for about a minute (checked with a
    stopwatch): Fatal error: Maximum execution time of 1800 seconds
    exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    on php 5.2 after running for 1800 seconds (checked with a stopwatch):
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.


    My totally naive guess is that during the while loop the eof might not
    be properly recognised (on both versions) or that the loop itself has
    some counter which for some reason signals to php that the script timed
    out even if it didnt.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 14:24:44] [email]tony2001@php.net[/email]

    Reproduce what? What is the value of max_execution_time? What is the
    error message? What is the real amount of time spent and how did you
    measure it?

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

    [2006-09-26 14:19:35] pavel dot stratil-jun at fenix dot cz

    I cant find the rule in the problem. I was able to reproduce it always
    on files > 1.2GB. I could reproduce it sometimes on files ranging from
    70MB to 1.2GB and I havent been able to reproduce on files < 70MB.

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

    [2006-09-26 12:59:18] [email]tony2001@php.net[/email]
    >but streaming hashing still fails on large files (the
    >script timeouts for real after max_execution_time even on
    > relatively small files, compared to the first tests - i.e.
    >200MB)
    Please elaborate.
    >many compile failures when trying to build with some
    > common extensions such as imap (against imap2006) or
    > mysqli (5.1.11).
    Please report them as separate issues.

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

    [2006-09-26 12:45:31] pavel dot stratil-jun at fenix dot cz

    seems that the problem is in

    $fp = fopen('test', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp, 4096));
    }
    $uplo_mhash = hash_final($ctx);
    fclose($fp);

    when calling the script from apache. When running from shell the
    problem disappears completely. In apache the premature timeout problem
    disappeared in the snapshot version, but streaming hashing still fails
    on large files (the script timeouts for real after max_execution_time
    even on relatively small files, compared to the first tests - i.e.
    200MB). Hash_file() seems to work flawlesly. When going towards smaller
    files, streaming hashing catches on and is about 60% the speed of
    hash_file.

    Tried this with apache 2.2.2 and 2.2.3 with modified as well as
    distribution configurations with the same result.


    tested on
    php5.2-200609261030
    ../configure --prefix=${PHP_PATH} --with-apxs2=${APACHE_PATH}/bin/apxs
    gmake # ok
    gmake test # failed in 4 tests

    # Test for buffering in core functions with implicit flush off
    [tests/func/008.phpt]
    # Bug #16069 [ext/iconv/tests/bug16069.phpt]
    #iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
    # Math constants [ext/standard/tests/math/constants.phpt]

    ps: dont know how far the development of php 5.2 is but i was getting
    many compile failures when trying to build with some common extensions
    such as imap (against imap2006) or mysqli (5.1.11).

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

    [2006-09-26 09:13:41] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/38950[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    pavel dot stratil-jun at fenix dot cz Guest

  9. #8

    Default #38950 [Opn->Fbk]: script times out long befor reaching max. execution time

    ID: 38950
    Updated by: [email]tony2001@php.net[/email]
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Open
    +Status: Feedback
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:
    >on php 5.2 after running for 1800 seconds (checked with a
    > stopwatch): Fatal error: Maximum execution time of 1800
    > seconds exceeded
    So it does work fine, right?


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 15:14:54] pavel dot stratil-jun at fenix dot cz

    * Reproduce what?
    reproduce the timeout error when trying streaming hashing.

    * What is the value of max_execution_time?
    1800 seconds

    * What is the error message?
    on php 5.1.6 after running for about a minute (checked with a
    stopwatch): Fatal error: Maximum execution time of 1800 seconds
    exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    on php 5.2 after running for 1800 seconds (checked with a stopwatch):
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.


    My totally naive guess is that during the while loop the eof might not
    be properly recognised (on both versions) or that the loop itself has
    some counter which for some reason signals to php that the script timed
    out even if it didnt.

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

    [2006-09-26 14:24:44] [email]tony2001@php.net[/email]

    Reproduce what? What is the value of max_execution_time? What is the
    error message? What is the real amount of time spent and how did you
    measure it?

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

    [2006-09-26 14:19:35] pavel dot stratil-jun at fenix dot cz

    I cant find the rule in the problem. I was able to reproduce it always
    on files > 1.2GB. I could reproduce it sometimes on files ranging from
    70MB to 1.2GB and I havent been able to reproduce on files < 70MB.

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

    [2006-09-26 12:59:18] [email]tony2001@php.net[/email]
    >but streaming hashing still fails on large files (the
    >script timeouts for real after max_execution_time even on
    > relatively small files, compared to the first tests - i.e.
    >200MB)
    Please elaborate.
    >many compile failures when trying to build with some
    > common extensions such as imap (against imap2006) or
    > mysqli (5.1.11).
    Please report them as separate issues.

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

    [2006-09-26 12:45:31] pavel dot stratil-jun at fenix dot cz

    seems that the problem is in

    $fp = fopen('test', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
    hash_update($ctx, fgets($fp, 4096));
    }
    $uplo_mhash = hash_final($ctx);
    fclose($fp);

    when calling the script from apache. When running from shell the
    problem disappears completely. In apache the premature timeout problem
    disappeared in the snapshot version, but streaming hashing still fails
    on large files (the script timeouts for real after max_execution_time
    even on relatively small files, compared to the first tests - i.e.
    200MB). Hash_file() seems to work flawlesly. When going towards smaller
    files, streaming hashing catches on and is about 60% the speed of
    hash_file.

    Tried this with apache 2.2.2 and 2.2.3 with modified as well as
    distribution configurations with the same result.


    tested on
    php5.2-200609261030
    ../configure --prefix=${PHP_PATH} --with-apxs2=${APACHE_PATH}/bin/apxs
    gmake # ok
    gmake test # failed in 4 tests

    # Test for buffering in core functions with implicit flush off
    [tests/func/008.phpt]
    # Bug #16069 [ext/iconv/tests/bug16069.phpt]
    #iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
    # Math constants [ext/standard/tests/math/constants.phpt]

    ps: dont know how far the development of php 5.2 is but i was getting
    many compile failures when trying to build with some common extensions
    such as imap (against imap2006) or mysqli (5.1.11).

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/38950[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    tony2001@php.net Guest

  10. #9

    Default #38950 [Fbk->Opn]: script times out long befor reaching max. execution time

    ID: 38950
    User updated by: pavel dot stratil-jun at fenix dot cz
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Feedback
    +Status: Open
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:

    on 5.2? well yes and no. the timeout problem disappeared, but the
    timeout itself is still there.

    file_hash() does a 200MB file on my machine in about 4 seconds the
    checksum

    stream hashing times out after half an hour!

    and i am not sure if its a performance issue because on smaller files
    (anything from bytes to tens of MB) the stream hashing has 60% the
    speed of file_hash(), so extrapolating this i would expect a 200MB file
    to be hashed in say max 10 seconds, a timeout after 30 minutes is not ok


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 15:17:42] [email]tony2001@php.net[/email]
    >on php 5.2 after running for 1800 seconds (checked with a
    > stopwatch): Fatal error: Maximum execution time of 1800
    > seconds exceeded
    So it does work fine, right?

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

    [2006-09-26 15:14:54] pavel dot stratil-jun at fenix dot cz

    * Reproduce what?
    reproduce the timeout error when trying streaming hashing.

    * What is the value of max_execution_time?
    1800 seconds

    * What is the error message?
    on php 5.1.6 after running for about a minute (checked with a
    stopwatch): Fatal error: Maximum execution time of 1800 seconds
    exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    on php 5.2 after running for 1800 seconds (checked with a stopwatch):
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.


    My totally naive guess is that during the while loop the eof might not
    be properly recognised (on both versions) or that the loop itself has
    some counter which for some reason signals to php that the script timed
    out even if it didnt.

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

    [2006-09-26 14:24:44] [email]tony2001@php.net[/email]

    Reproduce what? What is the value of max_execution_time? What is the
    error message? What is the real amount of time spent and how did you
    measure it?

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

    [2006-09-26 14:19:35] pavel dot stratil-jun at fenix dot cz

    I cant find the rule in the problem. I was able to reproduce it always
    on files > 1.2GB. I could reproduce it sometimes on files ranging from
    70MB to 1.2GB and I havent been able to reproduce on files < 70MB.

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

    [2006-09-26 12:59:18] [email]tony2001@php.net[/email]
    >but streaming hashing still fails on large files (the
    >script timeouts for real after max_execution_time even on
    > relatively small files, compared to the first tests - i.e.
    >200MB)
    Please elaborate.
    >many compile failures when trying to build with some
    > common extensions such as imap (against imap2006) or
    > mysqli (5.1.11).
    Please report them as separate issues.

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/38950[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    pavel dot stratil-jun at fenix dot cz Guest

  11. #10

    Default #38950 [Opn->Csd]: script times out long befor reaching max. execution time

    ID: 38950
    Updated by: [email]tony2001@php.net[/email]
    Reported By: pavel dot stratil-jun at fenix dot cz
    -Status: Open
    +Status: Closed
    Bug Type: *Encryption and hash functions
    Operating System: gentoo (amd64smp)
    PHP Version: 5.1.6
    New Comment:

    200MB file is hashed in 3 seconds using hash_file() and in 7 seconds
    using streams. The difference is expected because hash_file() uses
    static buffer, while hash_update()/fgets() use dynamic buffers.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 15:28:00] pavel dot stratil-jun at fenix dot cz

    on 5.2? well yes and no. the timeout problem disappeared, but the
    timeout itself is still there.

    file_hash() does a 200MB file on my machine in about 4 seconds the
    checksum

    stream hashing times out after half an hour!

    and i am not sure if its a performance issue because on smaller files
    (anything from bytes to tens of MB) the stream hashing has 60% the
    speed of file_hash(), so extrapolating this i would expect a 200MB file
    to be hashed in say max 10 seconds, a timeout after 30 minutes is not ok

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

    [2006-09-26 15:17:42] [email]tony2001@php.net[/email]
    >on php 5.2 after running for 1800 seconds (checked with a
    > stopwatch): Fatal error: Maximum execution time of 1800
    > seconds exceeded
    So it does work fine, right?

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

    [2006-09-26 15:14:54] pavel dot stratil-jun at fenix dot cz

    * Reproduce what?
    reproduce the timeout error when trying streaming hashing.

    * What is the value of max_execution_time?
    1800 seconds

    * What is the error message?
    on php 5.1.6 after running for about a minute (checked with a
    stopwatch): Fatal error: Maximum execution time of 1800 seconds
    exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.

    on php 5.2 after running for 1800 seconds (checked with a stopwatch):
    Fatal error: Maximum execution time of 1800 seconds exceeded in
    /opt/apache/htdocs/hashtest.php on line 58.


    My totally naive guess is that during the while loop the eof might not
    be properly recognised (on both versions) or that the loop itself has
    some counter which for some reason signals to php that the script timed
    out even if it didnt.

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

    [2006-09-26 14:24:44] [email]tony2001@php.net[/email]

    Reproduce what? What is the value of max_execution_time? What is the
    error message? What is the real amount of time spent and how did you
    measure it?

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

    [2006-09-26 14:19:35] pavel dot stratil-jun at fenix dot cz

    I cant find the rule in the problem. I was able to reproduce it always
    on files > 1.2GB. I could reproduce it sometimes on files ranging from
    70MB to 1.2GB and I havent been able to reproduce on files < 70MB.

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/38950[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=38950&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139