natecavanaugh / convert-bootstrap-2-to-3

Convert Bootstrap 2 variables, class names and HTML to Bootstrap 3
MIT License
3 stars 9 forks source link

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #9

Closed iampulkittiwari closed 7 years ago

iampulkittiwari commented 7 years ago

Hi all, I am upgrading liferay 6.2 theme to liferay 7 theme using "gulp upgrade" command and i am getting

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

I have tried increasing memory but still the problem persists.

I am providing full logs while upgrading theme.

[22:25:18] Using gulpfile ~/PrivateExchange-A+-theme/gulpfile.js [22:25:18] Starting 'upgrade'... [22:25:18] Starting 'upgrade:create-backup-files'... ? Would you like to overwrite the existing _backup directory and it's contents? No [22:25:26] Finished 'upgrade:create-backup-files' after 7.67 s [22:25:26] Starting 'upgrade:black-list'... [22:25:26] Finished 'upgrade:black-list' after 36 ms [22:25:26] Starting 'upgrade:replace-compass'... [22:25:26] Finished 'upgrade:replace-compass' after 33 ms [22:25:26] Starting 'upgrade:convert-bootstrap'...

<--- Last few GCs --->

10107 ms: Mark-sweep 1370.5 (1434.6) -> 1368.8 (1434.6) MB, 9.6 / 0.0 ms (+ 15.6 ms in 24 steps since start of marking, biggest step 2.2 ms) [allocation failure] [GC in old space requested]. 10128 ms: Mark-sweep 1368.8 (1434.6) -> 1368.7 (1434.6) MB, 21.3 / 0.0 ms [allocation failure] [GC in old space requested]. 10159 ms: Mark-sweep 1368.7 (1434.6) -> 1372.1 (1403.6) MB, 31.0 / 0.0 ms [last resort gc]. 10189 ms: Mark-sweep 1372.1 (1403.6) -> 1375.6 (1403.6) MB, 29.6 / 0.0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2bd78493fa99 1: exec [native regexp.js:~116] (this=0x2c5528b78f01 ,D=0x4c5597e3089 <Very long string[460281]>) 2: _extractRecursive [/root/.npm-packages/lib/node_modules/liferay-theme-tasks/node_modules/convert-bootstrap-2-to-3/lib/formatters/css.js:245] (this=0x2c5528b73ea9 <a constructor with map 0x1b5fe2eebca9>,str=0x4c5597e3089 <Very long string...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 1: node::Abort() 2: 0xff008c 3: v8::Utils::ReportApiFailure(char const, char const) 4: v8::internal:emoticon8::FatalProcessOutOfMemory(char const*, bool) 5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal:emoticonretenureFlag) 6: v8::internal::String::SlowFlatten(v8::internal::Handle, v8::internal:emoticonretenureFlag) 7: v8::internal::RegExpImpl::IrregexpPrepare(v8::internal::Handle, v8::internal::Handle) 8: v8::internal::RegExpImpl::IrregexpExec(v8::internal::Handle, v8::internal::Handle, int, v8::internal::Handle) 9: v8::internal::RegExpImpl::Exec(v8::internal::Handle, v8::internal::Handle, int, v8::internal::Handle) 10: v8::internal::Runtime_RegExpExec(int, v8::internal:emoticonbject*, v8::internal::Isolate) 11: 0x3db704d060c7 Aborted (core dumped)

I am working on 64 bit RedHat Linux Environment with 4 gb ram. Please help me in resolving this exception.

iampulkittiwari commented 7 years ago

This problems comes at Line 245 of "/root/.npm-packages/lib/node_modules/liferay-theme-tasks/node_modules/convert-bootstrap-2-to-3/lib/formatters/css.js" as the string on which it is applying regex pattern is very very long.I have tried to log input string on console and it seems to be the content of the one of the .css file present in the project.

natecavanaugh commented 7 years ago

Hi @Warcraft2 Thanks for reporting this and looking into it. Do you have an example of the file that causes this that you could attach? Also, what node version are you using?

I'm going to guess that it's maybe it's running over a file that's been minified? That's the only way I can think of a string being so long as to cause V8 to run out of memory. But if that is the case, then the converter shouldn't run against it, since the next time the file is generated it will be overwritten anyways.

One thing we can change, but not sure if it would necessarily help your exact case, but we can add an exclusion into the formatter to ignore any files with a .min. in their name. So if you named that file something like bundle.min.css or file.min.scss it would be skipped.

However, I don't know if you're able to rename the file, or if it is in fact a minified and generated file.

Let me know if any of this applies, and any files you can attach, and we can try to go from there.

iampulkittiwari commented 7 years ago

Hi natecavanaugh, The file was "custom.css" present in /root/workspace/PrivateExchange-A+-theme(Modified)/docroot/_diffs/css folder . When i changed it to custom.min.css converting bootstrap 2 to 3 was skipped and other processes following that file. I am attaching the file for your reference. I have renamed the file to .txt as github doesnt allow uploading .css extension files.

custom.txt

iampulkittiwari commented 7 years ago

Hi natecavanaugh, The file was custom.css present in /src/css/ folder in newly migrated project and present in /src/diffs/css/ folder in old project. When i changed it to custom.min.css ,converting bootstrap 2 to 3 step was skipped and other steps following this step.

So i think it would interrupt our gulp upgrade process if we rename this file to custom.min.css . And yes this file is auto-generated file and gets generated during build .

What should i do now ?

I am attaching the file for your reference and snapshot of gulp upgrade command executed on terminal. screenshot-2

iampulkittiwari commented 7 years ago

Also when i am migrating my theme project using yo liferay-theme:import it is not copying all the css files present in older project folder to new migrated project folder. For Ex:- I my older project i have files under /root/workspace/PrivateExchange-A+-theme(Modified)/docroot/css , which are application.css,aui.css,_aui_custom.scss,_aui_variables.scss,_aui_custom.scss,base.css,custom.css,dockbar.css,extras.css,layout.css,_liferay_custom.scss,main.css,navigation.css and portlet.css. But in new migrated project folder all i can find under /css/ is only custom.css . I cannot understand why it is happening, am i missing something or it is bug of yo liferay-theme:import script.

Logs of migrating liferay theme using yo liferay-theme:import " [root@localhost workspace]# yo liferay-theme:import

 _-----_
|       |    .--------------------------.
|--(o)--|    |  Welcome to the splendid |

---------´ | Liferay Theme Importer | ( _´U_ ) | generator! | /A\ '--------------------------' | ~ |
__'._.'
´ |° ´ Y

? What theme would you like to import? /root/workspace/PrivateExchange-A+-theme( Modified) create package.json create .gitignore create gulpfile.js create src/css/custom.scss create src/css/custom.scss~ create src/fonts/fontawesome-webfont.eot create src/fonts/fontawesome-webfont.svg create src/fonts/fontawesome-webfont.ttf create src/fonts/fontawesome-webfont.woff create src/fonts/fontawesome-webfont.woff2 create src/fonts/FontAwesome.otf create src/fonts/Montserrat-regular/LICENSE.txt create src/fonts/Montserrat-regular/Montserrat-regular.eot create src/fonts/Montserrat-regular/Montserrat-regular.svg create src/fonts/Montserrat-regular/Montserrat-regular.ttf create src/fonts/Montserrat-regular/Montserrat-regular.woff create src/fonts/Montserrat-regular/Montserrat-regular.woff2 create src/images/common/arrow-benefit.png create src/images/common/color-picker.png create src/images/common/cross.png create src/images/common/custom-multi-selectfieldcta.png create src/images/common/glyphicons-11-envelope.png create src/images/common/hps-circle-contentbg.png create src/images/common/hps-headermain-navnav-itemsdown-arrow.png create src/images/common/hps-headermain-navnav-itemsseparator.png create src/images/common/hps-hero-bannercontentdown-arrow.png create src/images/common/hps-quoteafter.png create src/images/common/hps-quotebefore.png create src/images/common/icon-cart.png create src/images/common/icon-chat.png create src/images/common/icon-email.png create src/images/common/icon-login.png create src/images/common/icon-pe-reports.png create src/images/common/info.png create src/images/common/nav-back.png create src/images/common/nav-front.png create src/images/common/nav-middle.png create src/images/common/nav-not-selected.png create src/images/common/nav-selected.png create src/images/common/payment-icons.png create src/images/common/pdf-icon.png create src/images/common/phone.png create src/images/common/plan-type-navbg.png create src/images/common/preloader.gif create src/images/common/range-component/range-slider.png create src/images/common/tick.png create src/images/common/toggle-component/toggle-component-bg.png create src/images/common/toggle-component/toggle-component-toggler-bg.png create src/images/favicon.ico create src/images/home-page-content.jpg create src/images/hps/accordion-sprite.png create src/images/hps/color-picker-close.png create src/images/hps/create-pedefault-logo.png create src/images/hps/create-peheading-bg.png create src/images/hps/create-pestep1bg.jpg create src/images/hps/create-pestep3bg.png create src/images/hps/create-pestep3colorbg.png create src/images/hps/create-pe-sprites.png create src/images/hps/date-picker-sprite.png create src/images/hps/global-logo.png create src/images/hps/harbor-america.jpg create src/images/hps/hps-footercontact-detail.jpg create src/images/hps/hps-quote-sprite.png create src/images/hps/quote-edit-icon.png create src/images/hps/quote-table-gradient.png create src/images/pe/accident-icon.png create src/images/pe/affordable-care-act.jpg create src/images/pe/arrow-header.png create src/images/pe/background-blue.png create src/images/pe/background-green.png create src/images/pe/bg_blue-narrow.png create src/images/pe/calendar.png create src/images/pe/chevron-right.png create src/images/pe/chrome.png create src/images/pe/close-icon.png create src/images/pe/Dental-icon.png create src/images/pe/Dental-Icons.png create src/images/pe/Disability-Icon.png create src/images/pe/Disability-Icons.png create src/images/pe/edit-icon.svg create src/images/pe/employee-contribution.png create src/images/pe/employer-contribution.png create src/images/pe/enable-disable-old.png create src/images/pe/enable-disable.png create src/images/pe/enrollmentlinks.png create src/images/pe/enrollment-sprite.png create src/images/pe/excel-export.png create src/images/pe/eye.png create src/images/pe/Family-Icons.png create src/images/pe/Family.png create src/images/pe/familyinsure.jpg create src/images/pe/familyinsure.png create src/images/pe/firefox.png create src/images/pe/full-time-employees.png create src/images/pe/full-time-employees1.png create src/images/pe/GirlAndBooks.png create src/images/pe/global-logo-large.png create src/images/pe/graph-rate.png create src/images/pe/GroupLife-Icons.png create src/images/pe/hero-aca.png create src/images/pe/hero-avma.png create src/images/pe/hero-benefit.png create src/images/pe/HIP-Icons.png create src/images/pe/hps-alterlogo.png create src/images/pe/hps-content-check.png create src/images/pe/hps-content-heart.png create src/images/pe/hps-content-money.png create src/images/pe/hps-content-people.png create src/images/pe/icon-close.png create src/images/pe/icons2x.png create src/images/pe/icons.png create src/images/pe/individual-remove-undo-icons.png create src/images/pe/internet-explorer.png create src/images/pe/legend-first.png create src/images/pe/legend-second.png create src/images/pe/legend-third.png create src/images/pe/Life-icon.png create src/images/pe/Life-Icons.png create src/images/pe/loading-gif.gif create src/images/pe/logo-aetna.png create src/images/pe/logo-assurant.png create src/images/pe/logo-coventry.png create src/images/pe/logo-humana.png create src/images/pe/logo-united.png create src/images/pe/LTC-icon.png create src/images/pe/LTC-Icons.png create src/images/pe/Medical-icon.png create src/images/pe/Medical-Icons.png create src/images/pe/Medicare-icon.png create src/images/pe/Medicare-Icons.png create src/images/pe/nonsubsidy-eligible-employees.png create src/images/pe/nonsubsidy-eligible-employees1.png create src/images/pe/opera.png create src/images/pe/page-title-benefit.html create src/images/pe/part-time-employees.png create src/images/pe/part-time-employees1.png create src/images/pe/pe-circle-green.png create src/images/pe/pe-circle.png create src/images/pe/pe-no-search.png create src/images/pe/pe-owner.jpg create src/images/pe/pe-warning.png create src/images/pe/pencil.svg create src/images/pe/pencil2.png create src/images/pe/POE-Icons.png create src/images/pe/product-nav__bg.png create src/images/pe/Protection-Icons.png create src/images/pe/safari.png create src/images/pe/sample-cheque.png create src/images/pe/SeniorsOnBench.png create src/images/pe/shortterm-Icons.png create src/images/pe/social-icons.png create src/images/pe/step1.png create src/images/pe/step2.png create src/images/pe/step3.png create src/images/pe/subsidy-cart.png create src/images/pe/subsidy-eligible-employees.png create src/images/pe/subsidy-eligible-employees1.png create src/images/pe/supplemental-icon.png create src/images/pe/tooltipimg.png create src/images/pe/usd.png create src/images/pe/user-md.png create src/images/pe/vision-icon.png create src/images/pe/Vision-Icons.png create src/images/screenshot.png create src/images/thumbnail.png create src/js/main.js create src/templates/cart.ftl create src/templates/footer-navigation.ftl create src/templates/footer.ftl create src/templates/header.ftl create src/templates/help-navigation.ftl create src/templates/init_custom.ftl create src/templates/logo.ftl create src/templates/navigation.ftl create src/templates/page-title.ftl create src/templates/portal_normal.ftl create src/templates/theme_css.ftl create src/WEB-INF/lib/commons-logging.jar create src/WEB-INF/lib/log4j.jar create src/WEB-INF/lib/util-bridges.jar create src/WEB-INF/lib/util-java.jar create src/WEB-INF/lib/util-taglib.jar create src/WEB-INF/liferay-look-and-feel.xml create src/WEB-INF/liferay-plugin-package.properties create src/WEB-INF/src/rebel.xml create src/WEB-INF/src/resources-importer/readme.txt create src/WEB-INF/src/resources-importer/sitemap.json

I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.

npm WARN Invalid name: "PrivateExchange-A+-theme(Modified)-theme" npm WARN PrivateExchange-A+-theme(Modified)-theme No description npm WARN PrivateExchange-A+-theme(Modified)-theme No repository field. npm WARN PrivateExchange-A+-theme(Modified)-theme No README data npm WARN PrivateExchange-A+-theme(Modified)-theme No license field. [01:16:08] Using gulpfile ~/workspace/PrivateExchange-A+-theme(Modified)-theme/gulpfile.js [01:16:08] Starting 'plugin:init'... ? Enter the path to your app server directory: /root/Downloads/liferay-dxp-digit al-enterprise-7.0-sp3 (2)/tomcat-8.0.32 ? Enter the url to your production or development site: /hpsa- [01:16:34] Finished 'plugin:init' after 25 s [01:16:34] Starting 'init'... [01:16:34] Finished 'init' after 11 μs

"

natecavanaugh commented 7 years ago

Hi @Warcraft2 Sorry for the delay in responding. I'm not 100% sure what happened in your migration task, but could file a ticket over at the repository for the generator for the last issue you mentioned? That would be the best place to diagnose that issue. I think something might have gone wrong during the import, but I can't be 100% sure.

As for this one, I'll leave it open for now, but I'll look into how to prevent the out of memory issue for long strings.

Thanks!