Jump to content

Applications install timeout fix


Numbered

Recommended Posts

,Hello.

Today I got a very strange issue. I install my app update on the pre-production instance for checks and see that my fonts, placed in <my_app>/dev/resources/front/something/fonts/ not saved in storage. I went to research them and found the mistake. It located in file /system/Applications/Applications.php, line 2361:

			if( $maxExecution = @ini_get( 'max_execution_time' ) )
			{
				/* If max_execution_time is set to "no limit" we should add a hard limit to prevent browser timeouts */
				if ( $maxExecution == -1 )
				{
					$maxExecution = 30;
				}
				
				$cutOff	= time() + ( $maxExecution * .5 );
			}

and inside XML reading we have the check of that variable

				if( $cutOff !== null AND time() >= $cutOff )
				{
					break;
				}

Really? If some application contains the huge number of resources (or not powerful storage) - then... just keep what we have in time for? And never try to do the full job by steps or something. Moreover, we tried to save our resources in HALF of max_execution_time. So if you have 20 then 10 seconds is enough. :laugh:

I checked this file in 4.3.4 - same code.

IPS, please fix that! Make steps or background resources import - any way is better than just break import. And browser timeout error (but with finish job in the background) much better than deceiving 'all is fine. app installed successfully'.

Link to comment
Share on other sites

That function does process already in a steps/looping methodology. We break out of the current import cycle if we're approaching the time cutoff, but you'll note the method accepts an $offset parameter, so we return the current offset and then another step/page redirect kicks off using that offset as the start point until all templates are imported.

Link to comment
Share on other sites

Thanks for the answer. But actually, it didn't work all times when I tried them. I am fearful of my mistake. So I created a test application 'appinstallcheck'. I put to that app some resources (fonts and few images) and proceed to install them. It installed successfully, nothing wrong IPS said to me. Ok. I went to SQL instruments (easier way to check) and wrote that query:

SELECT * FROM core_theme_resources where resource_app = 'appinstallcheck';

And I get only 4 files - LICENCE.txt, RobotoCondensed-Regular.eot, RobotoCondensed-Regular.svg and 6.png...

One more potential important moment - I have 8 installed styles. max_execution_time is 30. Checked in VMWare virtual server (PHP 7.0.24) and local docker container (PHP 7.1.7).

I don't know why install process didn't move me to step/page. Just install some part and said 'Install successful'. Test app attached.

appinstallcheck.tar

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...