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

Better error handling when system runs out of memory #192

Open
ErisDS opened this Issue May 3, 2017 · 26 comments

Comments

Projects
None yet
10 participants
@ErisDS
Member

ErisDS commented May 3, 2017

Trying to run ghost install --no-setup I got this error:

$ ghost install --no-setup
$ cat ghost-cli-debug-xxx.log

Debug Information:
    Node Version: v6.10.3
    Ghost-CLI Version: 1.0.0-alpha.16
    Environment: production
    Command: 'ghost install --no-setup'
An error occurred.
Message: 'Command failed: yarn install --no-emoji --no-progress
yarn install v0.21.3
[1/4] Resolving packages...
[2/4] Fetching packages...
'

Stack: Error: Command failed: yarn install --no-emoji --no-progress
yarn install v0.21.3
[1/4] Resolving packages...
[2/4] Fetching packages...

    at Promise.all.then.arr (/usr/lib/node_modules/ghost-cli/node_modules/execa/index.js:210:11)
    at process._tickCallback (internal/process/next_tick.js:109:7)

Not sure what caused this?

Trying to run the installer again results in:

$ ghost install --no-setup

A SystemError occured.

Message: Current directory is not empty, Ghost cannot be installed here.

Debug Information:
    Node Version: v6.10.3
    Ghost-CLI Version: 1.0.0-alpha.16
    Environment: production
    Command: 'ghost install --no-setup'

I understand why this is, but it's not very helpful 😁 - if the installer fails, I should be able to try again I think?

First issue is something I want to get to the bottom of, clean re-installs is something for later.

@acburdine

This comment has been minimized.

Member

acburdine commented May 5, 2017

@ErisDS It looks like something got screwed up with yarn. Have you been able to reproduce this multiple times?

@ErisDS

This comment has been minimized.

Member

ErisDS commented May 5, 2017

I was running the command on a droplet I provisioned. No amount of rerunning it sorted the problem. Not sure what else to do to reproduce.

@acburdine

This comment has been minimized.

Member

acburdine commented May 5, 2017

No amount of rerunning it sorted the problem.

Just to make sure I understand what you're saying - you tried running it in a different folder and it gave the same error?

@ErisDS

This comment has been minimized.

Member

ErisDS commented May 5, 2017

I cleared out the folder, but yes got the same error. I've since destroyed the droplet I think, sorry.

@acburdine

This comment has been minimized.

Member

acburdine commented May 5, 2017

Hmm...well based on the error shown I'm 99% sure this is something do with yarn. I'll try testing on a droplet at somepoint today, but if I can't reproduce it there my feeling is to wait and see if it happens again or if anyone else reports it?

@ErisDS

This comment has been minimized.

Member

ErisDS commented May 5, 2017

Yeah I'll try and reproduce again as well. I realise it's a bit of a crappy report!

@acburdine

This comment has been minimized.

Member

acburdine commented Jun 13, 2017

@ErisDS @chanssl (from the closed duplicate issue): would you both mind trying to reproduce this issue with ghost-cli alpha.18?

I don't know if I've necessarily fixed the issue, but I fixed the error handling so if this particular error does happen again, it will be reported better by the CLI.

Thanks!

@chanssl

This comment has been minimized.

chanssl commented Jun 14, 2017

@acburdine
Thank you. Look like my system was running out of memory. I will try again after I upgrade the vps .

update : It can be successfully installed after I configured the swap. thanks

dd if=/dev/zero of=/var/swap bs=1k count=1024k
mkswap /var/swap
swapon /var/swap
echo '/var/swap swap swap default 0 0' >> /etc/fstab

@kirrg001 kirrg001 added the needs info label Jun 22, 2017

@kirrg001 kirrg001 added this to the 1.0.0-rc.1 milestone Jun 22, 2017

@kirrg001 kirrg001 added the post 1.0.0 label Jun 22, 2017

@kirrg001 kirrg001 removed this from the 1.0.0-rc.1 milestone Jun 22, 2017

@tmack8001

This comment has been minimized.

tmack8001 commented Jun 23, 2017

I'm getting this exact same experience even on 1.0.0.alpha-19. My installation of ghost 1.0 in on a raspberrypi 3 (understood not a supported platform), which has been running my ghost pre-1.0 installation for a while with no problems.

Here is the related logs I see with the issue highlighting the problems faced (was also a similar or exact same problem on 1.0.0.alpha-18). Below is logs from --verbose as the logs from non verbose weren't very useful.

[04:05:32] Installing dependencies [started]
[04:05:34] → yarn install v0.24.5

[04:05:39] → [1/4] Resolving packages...

[04:05:45] → [2/4] Fetching packages...

[04:05:54] → info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

[04:05:54] Installing dependencies [failed]
[04:05:54] → Command failed: yarn install --no-emoji --no-progress
error Error parsing JSON at "/home/pi/.cache/yarn/v1/npm-ajv-4.11.7-8655a5d86d0824985cc471a1d913fb6729a0ec48/package.json", "/home/pi/.cache/yarn/v1/npm-ajv-4.11.7-8655a5d86d0824985cc471a1d913fb6729a0ec48/package.json: Unexpected token � in JSON at position 0".

yarn install v0.24.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

[04:05:54] Downloading and installing Ghost v1.0.0-beta.1 [failed]
[04:05:54] → Command failed: yarn install --no-emoji --no-progress
error Error parsing JSON at "/home/pi/.cache/yarn/v1/npm-ajv-4.11.7-8655a5d86d0824985cc471a1d913fb6729a0ec48/package.json", "/home/pi/.cache/yarn/v1/npm-ajv-4.11.7-8655a5d86d0824985cc471a1d913fb6729a0ec48/package.json: Unexpected token � in JSON at position 0".

yarn install v0.24.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

A ProcessError occured.

Error occurred running command: 'yarn install --no-emoji --no-progress'

Exit code: 1

Also the versions of various software being used is below:

Debug Information:
    Node Version: v6.11.0
    Ghost-CLI Version: 1.0.0-alpha.19
    Environment: production
    Command: 'ghost install --no-stack --verbose'
$ yarn --version
0.24.6
@evilpilaf

This comment has been minimized.

evilpilaf commented Jun 27, 2017

I'm also having the same issue when attempting to create a new blog with the cli

�[?25l[19:26:35] Checking for latest Ghost version [started]
[19:26:38] Checking for latest Ghost version [completed]
[19:26:38] Running system checks [started]
[19:26:38] Checking system node version [started]
[19:26:38] Checking current folder permissions [started]
[19:26:38] Checking system node version [completed]
[19:26:38] Checking current folder permissions [completed]
[19:26:38] Running system checks [completed]
[19:26:38] Setting up install directory [started]
[19:26:38] Setting up install directory [completed]
[19:26:38] Downloading and installing Ghost [started]
[19:26:38] Downloading and installing Ghost v1.0.0-beta.2 [title changed]
[19:26:38] Getting download information [started]
[19:26:40] Getting download information [completed]
[19:26:40] Downloading [started]
[19:26:46] Downloading [completed]
[19:26:46] Installing dependencies [started]
[19:26:47] → yarn install v0.24.5

[19:26:48] → [1/4] Resolving packages...

[19:26:49] → [2/4] Fetching packages...

[19:26:51] → [3/4] Linking dependencies...

[19:27:40] → [4/4] Building fresh packages...

[19:27:45] → Done in 58.23s.

[19:27:45] Installing dependencies [completed]
[19:27:45] Downloading and installing Ghost v1.0.0-beta.2 [completed]
[19:27:45] Moving files [started]
[19:27:45] Summoning Casper [started]
[19:27:45] Linking things [started]
[19:27:45] Linking things [completed]
[19:27:45] Summoning Casper [completed]
[19:27:45] Moving files [completed]
�[?25h√ Finishing setup
�[?25l[19:27:45] Validating config [started]
[19:27:45] Validating config [completed]
�[?25hAn error occurred.
Message: 'The server has encountered an error.'

Stack: InternalServerError: The server has encountered an error.
    at new KnexMigrateError (C:\Users\mauri\AppData\Local\Yarn\config\global\node_modules\knex-migrator\lib\errors.js:7:26)
    at new KnexMigrator (C:\Users\mauri\AppData\Local\Yarn\config\global\node_modules\knex-migrator\lib\index.js:26:15)
    at Listr.run.then (C:\Users\mauri\AppData\Local\Yarn\config\global\node_modules\ghost-cli\lib\commands\start.js:39:28)

Error: Your content path does not exist! Please double check `paths.contentPath` in your custom config file e.g. config.production.json.
    at doesContentPathExist (c:\dv\myOtherBlog\versions\1.0.0-beta.2\core\server\config\utils.js:78:15)
    at Object.loadNconf (c:\dv\myOtherBlog\versions\1.0.0-beta.2\core\server\config\index.js:61:11)
    at Object.<anonymous> (c:\dv\myOtherBlog\versions\1.0.0-beta.2\core\server\config\index.js:78:27)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (c:\dv\myOtherBlog\versions\1.0.0-beta.2\MigratorConfig.js:1:76)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Debug Information:
    Node Version: v6.9.5
    Ghost-CLI Version: 1.0.0-alpha.19
    Environment: development
    Command: 'ghost install local --verbose'
[?25h
@acburdine

This comment has been minimized.

Member

acburdine commented Jun 27, 2017

@evilpilaf your error is actually a different one - it's the same as being reported in #228

@acburdine

This comment has been minimized.

Member

acburdine commented Jun 27, 2017

My thought is that this problem was originally related to an out-of-memory issue. The error handling around this has been fixed, so I'm going to go ahead and close this. If this does turn out to be something other than an out-of-memory issue then we can either reopen this issue or create a new one 😄

@acburdine acburdine closed this Jun 27, 2017

@tmack8001

This comment has been minimized.

tmack8001 commented Jun 29, 2017

@acburdine

This comment has been minimized.

Member

acburdine commented Jun 29, 2017

@tmack8001 can you post your ghost-cli-debug-<timestamp>.log file? That will contain some more contextual info as to why Yarn is exiting.

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Jul 5, 2017

Happened for me on ghost install local.

A ProcessError occured.

Error occurred running command: 'yarn install --no-emoji --no-progress'

Exit code: 1


Debug Information:
    Node Version: v6.10.3
    Ghost-CLI Version: 1.0.0-beta.3
    Environment: development
    Command: 'ghost install local'

Additional log info available in: /root/.ghost/logs/ghost-cli-debug-2017-07-05T10_08_17_269Z.log
root@dev-kate-01:~/tests/2# cat  /root/.ghost/logs/ghost-cli-debug-2017-07-05T10_08_17_269Z.log
Debug Information:
    Node Version: v6.10.3
    Ghost-CLI Version: 1.0.0-beta.3
    Environment: development
    Command: 'ghost install local'
Error occurred running command: 'yarn install --no-emoji --no-progress'

Exit code: 1

--------------- stdout ---------------
yarn install v0.24.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info This module is OPTIONAL, you can safely ignore this error
info If you think this is a bug, please open a bug report with the information provided in "/root/tests/2/versions/1.0.0-beta.2/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


--------------- stderr ---------------
warning Error running install script for optional dependency: "/root/tests/2/versions/1.0.0-beta.2/node_modules/dtrace-provider: spawn ENOMEM"
error An unexpected error occurred: "/root/tests/2/versions/1.0.0-beta.2/node_modules/jsonpath: spawn ENOMEM".

@kirrg001 kirrg001 reopened this Jul 5, 2017

@acburdine

This comment has been minimized.

Member

acburdine commented Jul 5, 2017

@kirrg001 that looks like an out of memory exception.

@kirrg001

This comment has been minimized.

Contributor

kirrg001 commented Jul 5, 2017

@acburdine Yes. Can we improve the output?

@kirrg001 kirrg001 added enhancement and removed post 1.0.0 labels Jul 5, 2017

@tmack8001

This comment has been minimized.

tmack8001 commented Jul 5, 2017

@kirrg001 kirrg001 added the post 1.0.0 label Jul 10, 2017

@arvindvenkataramani

This comment has been minimized.

arvindvenkataramani commented Jul 17, 2017

Definitely an out of memory exception (Ubuntu 16.04.2 with node 6.11.1 installing Ghost 1 RC); I have 512M on a droplet – adding a 1G swap file fixed it.

@acburdine acburdine changed the title from Install failure with stack error to Better error handling when system runs out of memory Jul 21, 2017

@acburdine acburdine added UI and removed needs info labels Jul 21, 2017

@acburdine acburdine added this to the 1.1.0 milestone Jul 23, 2017

@millerone

This comment has been minimized.

millerone commented Aug 1, 2017

I'm getting the same error message but i'm on Win 10 (surface laptop) using ghost-cli version 1.0.3
Is there an easy way to fix it?
Thanks!

@tmack8001

This comment has been minimized.

tmack8001 commented Aug 2, 2017

Here is the contents of my error log.

$ more /home/pi/.ghost/logs/ghost-cli-debug-2017-08-02T03_52_44_600Z.log
Debug Information:
    Node Version: v6.11.0
    Ghost-CLI Version: 1.0.3
    Environment: production
    Command: 'ghost install'
Error occurred running command: 'yarn install --no-emoji --no-progress'

Exit code: 1

--------------- stdout ---------------
yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info If you think this is a bug, please open a bug report with the information p
rovided in "/var/www/ghost/trevor-mack.com/versions/1.3.0/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this
command.


--------------- stderr ---------------
error An unexpected error occurred: "/home/pi/.cache/yarn/v1/npm-ajv-4.11.7-8655
a5d86d0824985cc471a1d913fb6729a0ec48/package.json: Unexpected token � in JSON at
 position 0".

let me know what else might be of help in debugging further down this path

@tmack8001

This comment has been minimized.

tmack8001 commented Aug 2, 2017

understanding that I'm on a unsupported platform, but I like others have been using my raspberry pi for hosting ghost at home for years so would like to see / help get this working with 1.0.x releases again

attempting to install ghost via yarn directly bypassing the ghost-cli gives me the same/similar error

@acburdine

This comment has been minimized.

Member

acburdine commented Aug 2, 2017

@tmack8001 your error looks different than the original error for this issue. It looks like something in your Yarn cache might be corrupted. My suggestion is to try clearing your yarn cache (ghost buster is a convenient alias for this 😛 ) and installing again to see if that fixes it.

@tmack8001

This comment has been minimized.

tmack8001 commented Aug 3, 2017

After going through my running process list and issuing a kill -9 <> on non pertinent stuff that was taking up system memory (xorg, webserver, mysql, python, java, etc) I was able to successfully get a ghost installation and setup completed. Most importantly I believe was xorg, booting straight to command line opened a lot of free memory. Nothing I did ever enabled swap (which is very bad to do on a SD card anyways), but removing programs using majority of memory to open up some helped to resolve the issues faced.

From talking with @acburdine today we believe the above error log I posted was from a follow on installation after a OOM issue with yarn which then had a corrupted / invalid cached file under the ~/.cache/yarn directory. I had seen this on multiple different npm modules, but the error messages looked like the above. If I ever run into failures in the future I'll try and post here or in another issue depending on cause.

@millerone

This comment has been minimized.

millerone commented Aug 3, 2017

I can confirm that the command 'yarn cache clean' solved the problem.
Now it works like a charm.
Thanks

@acburdine acburdine added this to Next Release in Ghost-CLI Aug 3, 2017

@acburdine acburdine moved this from Next Release to Backlog in Ghost-CLI Sep 2, 2017

@Nopzen

This comment has been minimized.

Nopzen commented Oct 14, 2017

can confirm OP was mem issue for me, I was running a Droplet 512mb ram, resized it and it seemed to make it work.

@kirrg001 kirrg001 removed this from the 1.1.0 milestone Jan 12, 2018

@kirrg001 kirrg001 removed this from Backlog in Ghost-CLI Jan 13, 2018

@acburdine acburdine referenced this issue Jan 13, 2018

Open

Ghost Doctor improvements #47

9 of 18 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment