Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone it! Fatal Error: Maximum execution time #903

Closed
bdolor opened this issue Aug 25, 2017 · 4 comments

Comments

@bdolor
Copy link
Contributor

commented Aug 25, 2017

Prerequisites

Check the boxes below by changing them from [ ] to [x].

Description

Clone feature makes it through cloning most of a book but dies with a 500 error.

Steps to Reproduce

  1. clone Mike Caufields CC-BY book 'webliteracy' at https://webliteracy.pressbooks.com/ from outside the pressbooks.com domain.
  2. tail -f wp-content/debug.log file during import
  3. watch for PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/ssl/pressbooks/wp-includes/class-wp-image-editor-gd.php on line 190 - either imagecopyresampled or wp_imagecreatetruecolor
  4. browser returns a 500 error.
  5. Half of the book is created, the last page to import is https://webliteracy.pressbooks.com/chapter/finding-a-journals-impact-factor/

The next page, which doesn't import is https://webliteracy.pressbooks.com/chapter/using-google-scholar-to-check-author-expertise/

image

Expected behavior:
Whole book should be cloned. No Fatal Error.

Actual behavior:
Fatal Error.

image

System Information

Pressbooks: tested on both 4.1.0 and latest dev branch
WordPress: 4.8.1
PHP: same behaviour with both 5.6 and 7.1

@greatislander

This comment has been minimized.

Copy link
Collaborator

commented Aug 25, 2017

You will likely need to increase your maximum execution time. We found that this was necessary for some books with lots of media/large media to import. I’d suggest bumping it up to 60 seconds and see where you get.

@greatislander

This comment has been minimized.

Copy link
Collaborator

commented Aug 25, 2017

(Ideally we should catch this error, exit the clone and delete the partial book, informing the user that they may need to make a configuration change. CC: @connerbw.)

@bdolor

This comment has been minimized.

Copy link
Contributor Author

commented Aug 25, 2017

60 seconds max_execution_time works. Thank you also for considering a graceful degradation path.

@connerbw

This comment has been minimized.

Copy link
Member

commented Aug 25, 2017

(Ideally we should catch this error, exit the clone and delete the partial book, informing the user that they may need to make a configuration change. CC: @connerbw.)

PHP Fatals are not really catchable. They imply that PHP died and that the operator should do something about it. For example, if PHP runs out of memory, then it will give a Fatal error, and since there's no more memory to do anything else, it's unlikely we can continue.

There is a discussion, with different points of view, on how to deal with (some) fatals: https://stackoverflow.com/questions/277224/how-do-i-catch-a-php-fatal-error

Maybe a quick fix is like how we do in Exports?

set_time_limit( 300 );

This won't work with our Nginx infra, but for typical use cases it will probably extend the limit.

I'll add it now.

connerbw added a commit that referenced this issue Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.