php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75373 Warning Internal error: wrong size calculation
Submitted: 2017-10-13 17:37 UTC Modified: 2017-10-20 18:56 UTC
From: tm8544 at hotmail dot com Assigned: ab (profile)
Status: Closed Package: opcache
PHP Version: 7.2.0RC4 OS: Windows 10 x64
Private report: No CVE-ID: None
 [2017-10-13 17:37 UTC] tm8544 at hotmail dot com
Description:
------------
7.2.0RC4 and also 7.2.0RC3 caused following lines in Apache error.log after server or Apache service (re)start.

In this case, on Thursday evening after updating to 7.2.0RC4 + Apache restart,
and on Friday Morning after scheduled server restart.

Line 491: Thu Oct 12 22:25:05 2017 (4844): Warning Internal error: wrong size calculation: D:\-folder-name-replaced-\kauppa\includes\classes\seo.class.php start=0x0000000021275750, end=0x00000000212c4b70, real=0x00000000212c4a50
Line 493: Thu Oct 12 22:25:05 2017 (4844): Warning Internal error: wrong size calculation: D:\-folder-name-replaced-\kauppa\includes\functions\information.php start=0x0000000021308bd0, end=0x000000002130cea0, real=0x000000002130ce80
Line 495: Thu Oct 12 22:53:46 2017 (4844): Warning Internal error: wrong size calculation: D:\HTTPS-SERVER-D\mysqladm1n007\libraries\core.lib.php start=0x0000000021c23ce0, end=0x0000000021c39480, real=0x0000000021c39460

Line 515: Fri Oct 13 05:53:52 2017 (7392): Warning Internal error: wrong size calculation: D:\-folder-name-replaced-\kauppa\includes\classes\seo.class.php start=0x0000000021264278, end=0x00000000212b3698, real=0x00000000212b3578
Line 517: Fri Oct 13 05:53:53 2017 (7392): Warning Internal error: wrong size calculation: D:\-folder-name-replaced-\kauppa\includes\functions\information.php start=0x00000000212f76f8, end=0x00000000212fb9c8, real=0x00000000212fb9a8
Line 519: Fri Oct 13 05:54:11 2017 (7392): Warning Internal error: wrong size calculation: D:\HTTPS-SERVER-D\mysqladm1n007\libraries\core.lib.php start=0x0000000021abfc30, end=0x0000000021ad53d0, real=0x0000000021ad53b0



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-13 18:14 UTC] spam2 at rhsoft dot net
I faced this "internal size error" randomly after upgrade to php 7.1.x in production but can't trigger it reliable - when it happens it is always after replace a already cached script
 [2017-10-15 06:28 UTC] tm8544 at hotmail dot com
In this case, I believe it is not a about replacing an already cached script. It happens even when the server is restarted, so there should be no cached scripts in memory.
It is always those three scripts, values for 'start', 'end' and 'real' change from time to time
 [2017-10-15 11:17 UTC] tm8544 at hotmail dot com
The first comment led me thinking that after all, what if it is about an already cached script?

I my PHP.ini some opcache config options were commented out, so they were in their default values.
I changed this so that I specifically gave those options the default value.
For opcache.file_cache_consistency_checks I also changed the value, even though file_cache is not used.

Here are all config options, changed lines are marked with ***, left is the new value / right is the old value.

opcache.enable=1 / opcache.enable=1
opcache.enable_cli=0 / opcache.enable_cli=0
opcache.memory_consumption=128 / opcache.memory_consumption=128
opcache.interned_strings_buffer=8 / opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000 / opcache.max_accelerated_files=4000
*** opcache.max_wasted_percentage=5 / ;opcache.max_wasted_percentage=5
*** opcache.use_cwd=1 / ;opcache.use_cwd=1
opcache.validate_timestamps=1 / opcache.validate_timestamps=1
opcache.revalidate_freq=60 / opcache.revalidate_freq=60
opcache.file_update_protection=3600 / opcache.file_update_protection=3600
opcache.revalidate_path=1 / opcache.revalidate_path=1
opcache.save_comments=1 / opcache.save_comments=1
opcache.load_comments=1 / opcache.load_comments=1
opcache.fast_shutdown=0 / opcache.fast_shutdown=0
*** opcache.enable_file_override=0 / ;opcache.enable_file_override=0
opcache.optimization_level=0xffffffff / opcache.optimization_level=0xffffffff
*** opcache.inherited_hack=1 / ;opcache.inherited_hack=1
*** opcache.dups_fix=0 / ;opcache.dups_fix=0
opcache.blacklist_filename=c:\PHP\php.ini.opcache_blacklist.txt / opcache.blacklist_filename=c:\PHP\php.ini.opcache_blacklist.txt
*** opcache.max_file_size=0 / ;opcache.max_file_size=0
*** opcache.consistency_checks=0 / ;opcache.consistency_checks=0
opcache.force_restart_timeout=15 / opcache.force_restart_timeout=15
*** opcache.error_log="" / ;opcache.error_log=
opcache.log_verbosity_level=2 / opcache.log_verbosity_level=2
*** opcache.preferred_memory_model="" / ;opcache.preferred_memory_model=
*** opcache.protect_memory=0 / opcache.protect_memory=0
*** opcache.restrict_api="" / ;opcache.restrict_api=
opcache.mmap_base=0x20000000 / opcache.mmap_base=0x20000000
*** opcache.file_cache="" / ;opcache.file_cache=
*** opcache.file_cache_only=0 / ;opcache.file_cache_only=0
*** opcache.file_cache_consistency_checks=0 / ;opcache.file_cache_consistency_checks=1
*** opcache.file_cache_fallback=0 / ;opcache.file_cache_fallback=1
*** opcache.huge_code_pages=0 / ;opcache.huge_code_pages=1
*** opcache.validate_permission=0 / ;opcache.validate_permission=0
*** opcache.validate_root=0 / ;opcache.validate_root=0

After this, I have not seen any warning of wrong size calculation in Apache log.

Could it be that PHP7.2.0 handles opcache config option default values differently than e.g. 7.1 or previous versions?
 [2017-10-15 12:53 UTC] tm8544 at hotmail dot com
Eventually 'Warning Internal error: wrong size calculation' appered into the log again, so it was not about config options.
 [2017-10-15 17:02 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2017-10-15 17:02 UTC] ab@php.net
Thanks for the report. @tm8544, please provide a reproduce code snippet and the relevant ini options.

Thanks.
 [2017-10-16 16:40 UTC] tm8544 at hotmail dot com
Relevant ini options (opcache)
------------------------------
zend_extension=php_opcache.dll
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=60
opcache.file_update_protection=900
opcache.revalidate_path=1
opcache.save_comments=1
opcache.load_comments=1
opcache.fast_shutdown=0
opcache.enable_file_override=0
opcache.optimization_level=0xffffffff
opcache.inherited_hack=0
opcache.dups_fix=0
opcache.blacklist_filename=c:\PHP\php.ini.opcache_blacklist.txt
opcache.max_file_size=0
opcache.consistency_checks=0
opcache.force_restart_timeout=15
opcache.error_log=""
opcache.log_verbosity_level=2
opcache.preferred_memory_model=""
opcache.protect_memory=0
opcache.restrict_api=""
opcache.mmap_base=0x20000000
opcache.file_cache=""
opcache.file_cache_only=0
opcache.file_cache_consistency_checks=0
opcache.file_cache_fallback=0
opcache.huge_code_pages=0
opcache.validate_permission=0
opcache.validate_root=0

Reproduce code
-----------------

Batch file that runs once every hour to refresh the Opcache. Actual server name and username + password are replaced.

"C:\curl\curl.exe" https://_SERVERNAME_/index.php?ei_laskuria=1 -k --user un:pw
"C:\curl\curl.exe" https://kauppa._SERVERNAME_/index.php -k --user un:pw
"C:\curl\curl.exe" https://forum._SERVERNAME_/index.php -k --user un:pw
"C:\curl\curl.exe" https://_SERVERNAME_/mysqladm1n007/index.php -k --user un:pw
 [2017-10-16 17:24 UTC] ab@php.net
Hi @tm8544,

thanks for the further info. The INI is there, but a PHP code to run is still needed. Perhaps you could extract it from your application, otherwise - if it's an opensource project, please point to a repo. A small PHP snippet were preferable.

Thanks.
 [2017-10-16 18:11 UTC] tm8544 at hotmail dot com
file 1: information.php
----------------

<?php
/*
Module: Information Pages Unlimited
         File date: 2007/02/17
         Based on the FAQ script of adgrafics
         Adjusted by Joeri Stegeman (joeri210 at yahoo.com), The Netherlands

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Released under the GNU General Public License
*/

////
/************************************************
Modified by Robert Fisher aka Thunderace
23 March 2006
Information_children mod
This file now shows highlights and children
in the same manner as osCommerce
************************************************/
function tep_information_show_category($information_group_id = 1) {
   global $sitemapString, $languages_id;
   $information_tree = array();
   $informationString = '';
   $parent_child_selected = '';

   // Retrieve information from db
   // ID set by module for Information box
   $child_information = array();
   $information_query = tep_db_query("SELECT information_id, information_title, parent_id FROM " . TABLE_INFORMATION . " WHERE visible='1' and language_id='" . $languages_id ."' and information_group_id = '" . $information_group_id . "' ORDER BY sort_order");
   while($information = tep_db_fetch_array($information_query)) {
      $information_tree[$information['information_id']] = array(
      'info_title' 	=> $information['information_title'],
      'parent_id' 	=> $information['parent_id'],
      'info_next_id' 	=> 0
      );
      if ($information_tree[$information['information_id']]['parent_id'] != '0') {
         $child_information[] = array (
         'parent_info_id' => $information['parent_id'],
         'child_info_id'  => $information['information_id']
         );
      }
   }
   $count_child = count($child_information);

   // Test if a child has been requested and set $parent_child_selected
   for ( $i = 1; $i < ($count_child+1); $i++ ) {
      if ((isset($_GET['info_id'])) && ($child_information[$i]['child_info_id'] == $_GET['info_id'])) {
         $parent_child_selected = $child_information[$i]['parent_info_id'];
      }
   }

   // Run through the $information_tree to find all pages
   // while ($element = each*($information_tree)) {
   foreach($information_tree as $key => $element) {
      // if (!isset($information_tree[$element['_key_']]['parent_id']) || ($information_tree[$element['_key_']]['parent_id'] == 0)) {
      if (!isset($element['parent_id']) || ($element['parent_id'] == 0)) {

         //Set the main title to bold if it was selected or one of its children were selected
         if (((isset($_GET['info_id'])) && ($_GET['info_id'] == $key)) || ($parent_child_selected == $key)) {
            $informationString .= '<a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $key) . '"><b>•' . $information_tree[$key]['info_title'] . '</b></a><br />';
         } else {
            $informationString .= '<a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $key) . '">' . $information_tree[$key]['info_title'] . '</a><br />';
            //Sitemap only
            $sitemapString .= '<li><a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $key) . '">' . $information_tree[$key]['info_title'] . '</a></li>' . "\n";
         }

         //Just for sitemap
         $ul = false;
         for ( $i = 1; $i < ($count_child+1); $i++ ) {
            if ($child_information[$i]['parent_info_id'] == $key) {
               if ($ul == false) {
                  $sitemapString .= '<ul>' . "\n";
                  $ul = true;
               }
               $sitemapString .= '<li><a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $child_information[$i]['child_info_id']) . '">' . $information_tree[$child_information[$i]['child_info_id']]['info_title'] . '</a></li>' . "\n";
            }
            if (($i == $count_child) && ($ul == true)) {
               $sitemapString .= '</ul>' . "\n";
            }
         }
         //End just for sitemap

         //Show children if they exist
         if (((isset($_GET['info_id'])) && ($_GET['info_id'] == $key)) || ($parent_child_selected == $key)) {
            for ( $i = 0; $i < ($count_child); $i++ ) {
               if ($child_information[$i]['parent_info_id'] == $key)

               //Show a child as bold if it was selected
               if ((isset($_GET['info_id'])) && ($_GET['info_id'] == $child_information[$i]['child_info_id'])) {
                  $informationString .= '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $child_information[$i]['child_info_id']) . '"><b>' . $information_tree[$child_information[$i]['child_info_id']]['info_title'] . '</b></a><br />';
               } else {
                  $informationString .= '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $child_information[$i]['child_info_id']) . '">' . $information_tree[$child_information[$i]['child_info_id']]['info_title'] . '</a><br />';
               }
            }
         }
      }
   }
   return $informationString;
}


////
// Define customer greetings
function tep_information_customer_greeting_define() {
   global $customer_id, $customer_first_name, $languages_id, $category_depth;

   if ( $category_depth == 'top' ) {

      // Retrieve information from db
      $information_group_id = 2; // ID set by module for Entrance messages
      $information_query = tep_db_query("select information_title, information_description from " . TABLE_INFORMATION . " where language_id = '" . (int)$languages_id . "' and information_group_id = '" . (int)$information_group_id . "'");
      while ($information = tep_db_fetch_array($information_query)) {
         //		if($information['information_title'] == 'HEADING_TITLE')
         define($information['information_title'], $information['information_description']);
      }
   }
}

////
// Return a customer greeting
function tep_information_customer_greeting() {
   global $customer_id, $customer_first_name;

   if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {
      $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name), tep_href_link(FILENAME_PRODUCTS_NEW));
   } else {
      $greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
   }

   return $greeting_string;
}
?>
 [2017-10-16 18:14 UTC] tm8544 at hotmail dot com
file 2: core.lib.php

Download from phpmyadmin version 4.7.4, https://www.phpmyadmin.net/

Extract from folder 'libarries'
 [2017-10-16 18:16 UTC] tm8544 at hotmail dot com
File 3: seo.class.php

I'd have to paste it in here, but file size is 96 kB.

Files 1 and 2 are available, shall I paste file 3?
 [2017-10-17 16:26 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2017-10-17 16:26 UTC] cmb@php.net
> File 3: seo.class.php
> 
> I'd have to paste it in here, but file size is 96 kB.

96 kB is quite a lot. Can you make it available by other means, e.g. pastebin?
 [2017-10-18 03:57 UTC] tm8544 at hotmail dot com
File 3: seo.class.php

https://pastebin.com/6AgAEs5A
 [2017-10-18 08:52 UTC] cmb@php.net
-Status: Feedback +Status: Open -Assigned To: cmb +Assigned To:
 [2017-10-18 08:52 UTC] cmb@php.net
Thanks!
 [2017-10-18 17:36 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2017-10-18 17:36 UTC] ab@php.net
Some fixes was merged into 7.0+. Please check the latest snapshots for whichever applicable branch.

Thanks.
 [2017-10-18 19:43 UTC] tm8544 at hotmail dot com
Testing with 7.2-ts-windows-vc15-x64-r2b76520.

I will report after a few days.
 [2017-10-20 14:47 UTC] tm8544 at hotmail dot com
In two days there have been no log entries with "Warning Internal error: wrong size calculation".
As far as I can see, this issue can be closed.
 [2017-10-20 18:56 UTC] ab@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: ab
 [2017-10-20 18:56 UTC] ab@php.net
Huge thanks for the permanent tests! Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC