Resolved Bug


This bug has been marked as resolved.

File Manager: Edit Image doesn't work when JS/CSS cache is on, because Minifier.php loops endlessly

Permalink 26 24 Browser Info Environment
When JS/CSS cache is on, clicking Edit Image in File Manager doesn't bring the edit dialog on. In the logs, we see the following error:

FastCGI sent in stderr: "PHP message: PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /<our path>/concrete/vendor/tedivm/jshrink/src/JShrink/Minifier.php on line 182" while reading response header from upstream


It looks like Minifier.php locks in an endless loop trying to minimize the File Manager's javascript... Which is strange as the request /index.php/tools/required/files/edit?fID=<file-id> does not actually return any minified JS - it returns HTML with a bunch of <script> tags instead.

Please, could this bug be treated as high priority? Because now it's impossible to edit images on a production site with JS/CSS cache on. And disabling cache would of course penalize visitors with a multitude of separate HTTP requests because of unconcatenated scripts.


Status: Resolved
snobo
locojohn replied on at Permalink Reply
locojohn
Confirmed. The same $hit here. Once I switch JS/CSS cache off, it is working properly and I can edit file.
snobo replied on at Permalink Reply 1 Attachment
snobo
I debugged the code out of curiosity to see if there is any specific file Minifier.php gets stuck at... and I saw something which doesn't seem right to me (dunno if that's the actual cause, but could as well be). The $assets that JavascriptAsset->process() loops over consists of 24 entries, with nothing else as the same two files, image-editor.js and kinetic.js, and the URL to /ccm/assets/localization/imageeditor/js contained repeatedly 8 times. See attached screenshot.

I guess that's not how it is supposed to be. Shouldn't there be image-editor.js, kinetic.js, localization/imageeditor/js (once) and then all the plugins like filter.js, position.js, gaussian_blur.js etc?

Anyway, with the debugger I only see that after successfully minifying those two JS files over and over multiple times Minifier.php finally gets stuck at some point. Probably not its fault though.
snobo replied on at Permalink Reply
snobo
UPDATE: apparently, after a few failed attempts Minifier.php finally gets its work done and gets out of its loop, after which Edit Image starts to open normally - until the next Clear Cache, when the history repeats.

But the endlessly looping processes keep hanging, eating CPU...
mlocati replied on at Permalink Reply
mlocati
This change could fix this problem:https://github.com/concrete5/concrete5/pull/3884...
snobo replied on at Permalink Reply
snobo
Thank you very much! We will install the patch when possible, and let you know if it helped.

concrete5 Environment Information

# concrete5 Version
Core Version - 5.7.5.8
Version Installed - 5.7.5.8
Database Version - 20160412000000

# concrete5 Packages
ExchangeCore Dev Tools (1.0.1), GalleryES (2.5.1), Page Child Redirect (0.9.1), Page Selector Attribute (2.0), Read More (1.0).

# concrete5 Overrides
blocks/switch_language/view.php, blocks/switch_language, blocks/image_slider/view.php, blocks/image_slider, blocks/gallery_e_s_gallery/view-willnotwork.php, blocks/gallery_e_s_gallery, blocks/page_list/templates/home-videos.php, blocks/page_list/templates/home-musicians.php, blocks/page_list/templates/news_list_ajax/view.php, blocks/page_list/templates/news_list_ajax/view.css, blocks/page_list/templates/news_list_ajax/view.js, blocks/page_list/templates/news_list_ajax, blocks/page_list/templates/musician-list.php, blocks/page_list/templates/gallery-list.php, blocks/page_list/templates, blocks/page_list/home-item-list.inc.php, blocks/page_list/view.php, blocks/page_list/typical-item-list.inc.php, blocks/page_list/controller.php, blocks/page_list, blocks/application_form/add.php, blocks/application_form/edit-form.php, blocks/application_form/edit.php, blocks/application_form/view.php, blocks/application_form/icon.png, blocks/application_form/db.xml, blocks/application_form/view.js, blocks/application_form/mail.tpl, blocks/application_form/controller.php, blocks/application_form, blocks/content/view.php, blocks/content/auto.js, blocks/content, authentication/concrete/form.php, authentication/concrete, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/site/gsw_CH.po, languages/site/de_CH.po, languages/site/gsw_CH.mo, languages/site/de_CH.mo, languages/site, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_CH/LC_MESSAGES/messages.mo, languages/de_CH/LC_MESSAGES, languages/de_CH, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/gsw_CH/LC_MESSAGES/messages.mo, languages/gsw_CH/LC_MESSAGES, languages/gsw_CH, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, themes/bron/gallery_single.php, themes/bron/admission.php, themes/bron/home.php, themes/bron/teacher.php, themes/bron/calendar_article.php, themes/bron/default.php, themes/bron/templates/home.inc.php, themes/bron/templates/admission.inc.php, themes/bron/templates/generic-page-list.inc.php, themes/bron/templates/gallery-single.inc.php, themes/bron/templates/masterclass.inc.php, themes/bron/templates/teacher-list.inc.php, themes/bron/templates/article.inc.php, themes/bron/templates/gallery-list.inc.php, themes/bron/templates/news-list.inc.php, themes/bron/templates/teachers.inc.php, themes/bron/templates/layout.php, themes/bron/templates/contacts.inc.php, themes/bron/templates, themes/bron/news.php, themes/bron/css/_size_tablet_land.scss, themes/bron/css/_close-icon.scss, themes/bron/css/_size_tablet.scss, themes/bron/css/_grid.scss, themes/bron/css/_size_tablet_port.scss, themes/bron/css/bron-ie8.css, themes/bron/css/_form.scss, themes/bron/css/_config.scss, themes/bron/css/_c5_fixes.scss, themes/bron/css/bron.scss, themes/bron/css/_size_mobile_port.scss, themes/bron/css/bron-ie8.scss, themes/bron/css/_size_960up.scss, themes/bron/css/_define_grid_tablet.scss, themes/bron/css/bron.css, themes/bron/css/_navigation_responsive.scss, themes/bron/css/_size_desktop.scss, themes/bron/css/_base.scss, themes/bron/css/_menu_desktop.scss, themes/bron/css/_size_mobile_land.scss, themes/bron/css/_normalize.scss, themes/bron/css, themes/bron/calendar.php, themes/bron/teachers.php, themes/bron/description.txt, themes/bron/page_theme.php, themes/bron/thumbnail.png, themes/bron/students.php, themes/bron/pic/default_page_image.jpg, themes/bron/pic/logo-school.svg, themes/bron/pic/location.svg, themes/bron/pic/admin_background.jpg, themes/bron/pic/nota.svg, themes/bron/pic/attach.svg, themes/bron/pic, themes/bron/page_not_found.php, themes/bron/news_article.php, themes/bron/gallery.php, themes/bron/press.php, themes/bron/bron.js, themes/bron/masterclass.php, themes/bron/press_article.php, themes/bron/article.php, themes/bron/contacts.php, themes/bron, src/Localization/LocalizationServiceProvider.php, src/Localization/Service/Date.php, src/Localization/Service, src/Localization, blocks/switch_language/view.php, blocks/switch_language, blocks/image_slider/view.php, blocks/image_slider, blocks/gallery_e_s_gallery/view-willnotwork.php, blocks/gallery_e_s_gallery, blocks/page_list/templates/home-videos.php, blocks/page_list/templates/home-musicians.php, blocks/page_list/templates/news_list_ajax/view.php, blocks/page_list/templates/news_list_ajax/view.css, blocks/page_list/templates/news_list_ajax/view.js, blocks/page_list/templates/news_list_ajax, blocks/page_list/templates/musician-list.php, blocks/page_list/templates/gallery-list.php, blocks/page_list/templates, blocks/page_list/home-item-list.inc.php, blocks/page_list/view.php, blocks/page_list/typical-item-list.inc.php, blocks/page_list/controller.php, blocks/page_list, blocks/application_form/add.php, blocks/application_form/edit-form.php, blocks/application_form/edit.php, blocks/application_form/view.php, blocks/application_form/icon.png, blocks/application_form/db.xml, blocks/application_form/view.js, blocks/application_form/mail.tpl, blocks/application_form/controller.php, blocks/application_form, blocks/content/view.php, blocks/content/auto.js, blocks/content, authentication/concrete/form.php, authentication/concrete, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/site/gsw_CH.po, languages/site/de_CH.po, languages/site/gsw_CH.mo, languages/site/de_CH.mo, languages/site, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_CH/LC_MESSAGES/messages.mo, languages/de_CH/LC_MESSAGES, languages/de_CH, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/gsw_CH/LC_MESSAGES/messages.mo, languages/gsw_CH/LC_MESSAGES, languages/gsw_CH, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, themes/bron/gallery_single.php, themes/bron/admission.php, themes/bron/home.php, themes/bron/teacher.php, themes/bron/calendar_article.php, themes/bron/default.php, themes/bron/templates/home.inc.php, themes/bron/templates/admission.inc.php, themes/bron/templates/generic-page-list.inc.php, themes/bron/templates/gallery-single.inc.php, themes/bron/templates/masterclass.inc.php, themes/bron/templates/teacher-list.inc.php, themes/bron/templates/article.inc.php, themes/bron/templates/gallery-list.inc.php, themes/bron/templates/news-list.inc.php, themes/bron/templates/teachers.inc.php, themes/bron/templates/layout.php, themes/bron/templates/contacts.inc.php, themes/bron/templates, themes/bron/news.php, themes/bron/css/_size_tablet_land.scss, themes/bron/css/_close-icon.scss, themes/bron/css/_size_tablet.scss, themes/bron/css/_grid.scss, themes/bron/css/_size_tablet_port.scss, themes/bron/css/bron-ie8.css, themes/bron/css/_form.scss, themes/bron/css/_config.scss, themes/bron/css/_c5_fixes.scss, themes/bron/css/bron.scss, themes/bron/css/_size_mobile_port.scss, themes/bron/css/bron-ie8.scss, themes/bron/css/_size_960up.scss, themes/bron/css/_define_grid_tablet.scss, themes/bron/css/bron.css, themes/bron/css/_navigation_responsive.scss, themes/bron/css/_size_desktop.scss, themes/bron/css/_base.scss, themes/bron/css/_menu_desktop.scss, themes/bron/css/_size_mobile_land.scss, themes/bron/css/_normalize.scss, themes/bron/css, themes/bron/calendar.php, themes/bron/teachers.php, themes/bron/description.txt, themes/bron/page_theme.php, themes/bron/thumbnail.png, themes/bron/students.php, themes/bron/pic/default_page_image.jpg, themes/bron/pic/logo-school.svg, themes/bron/pic/location.svg, themes/bron/pic/admin_background.jpg, themes/bron/pic/nota.svg, themes/bron/pic/attach.svg, themes/bron/pic, themes/bron/page_not_found.php, themes/bron/news_article.php, themes/bron/gallery.php, themes/bron/press.php, themes/bron/bron.js, themes/bron/masterclass.php, themes/bron/press_article.php, themes/bron/article.php, themes/bron/contacts.php, themes/bron, src/Localization/LocalizationServiceProvider.php, src/Localization/Service/Date.php, src/Localization/Service, src/Localization

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
nginx/1.11.0

# Server API
fpm-fcgi

# PHP Version
5.6.21

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, geoip, gettext, hash, iconv, imagick, intl, json, libxml, mbstring, mcrypt, memcache, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, Reflection, session, shmop, SimpleXML, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xdebug, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib.

# PHP Settings
max_execution_time - 60
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 512M
post_max_size - 128M
sql.safe_mode - Off
upload_max_filesize - 250M
memcache.max_failover_attempts - 20
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
xdebug.max_nesting_level - 100
xdebug.max_stack_frames - -1
xdebug.var_display_max_children - 128
xdebug.var_display_max_data - 512
xdebug.var_display_max_depth - 2
opcache.max_accelerated_files - 4000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36