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

unhandledRejection resulting in crash when compressing jpg #51

Open
DanielBailey-web opened this issue May 30, 2020 · 3 comments
Open

Comments

@DanielBailey-web
Copy link

DanielBailey-web commented May 30, 2020

The .jpg file that it crashes with is attached. Before hitting this error, it had compressed approximately 100-125 images successfully. This could be a problem on my side of things, I am only using a try catch block as my error handling as there is no documentation that I could find that explained how else I should attempt this.
item-1gxfo9

This is my server output (pm2 logs) when mozjpeg crashes (using asterisks in place of relative paths and pm2 server names):

0|* | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
0|* | Error: Command was killed with SIGKILL (Forced termination):
0|* | �����JFIF�������ExifII*
�2��� ���� � i�� � �����]SONY�DSC-HX80^� ^� � GIMP 2.10.182020:05:30 17:04:59PrintIM0300� � � ��� $����������"�� � � '����0�� � � 2������0230��������� � ���� � ��� �������/home///node_modules/mozjpeg/vendor/cjpeg -quality 40 -maxmemory 20000000
0|* | at makeError (/home///node_modules/imagemin-mozjpeg/node_modules/execa/lib/error.js:59:11)
0|* | at handlePromise (/home///node_modules/imagemin-mozjpeg/node_modules/execa/index.js:114:26)
0|* | at runMicrotasks ()
0|* | at processTicksAndRejections (internal/process/task_queues.js:97:5)
0|* | at async /home///node_modules/imagemin-mozjpeg/index.js:109:19
0|* | at async /home///node_modules/p-pipe/index.js:12:19
0|* | at async handleFile (/home///node_modules/imagemin/index.js:21:9)
0|* | at async /home///node_modules/imagemin/index.js:54:13
0|* | at async Promise.all (index 0)
0|* | at async /home///routes/admin.js:56:29

After this error, it begins logging binary (well the ascii interpretation of it at least)

And finally it fataly crashes the pm2 server to the point where I need to restart it using my ecosystem.config file (pm2 is not able to restart itself)

Other files this happens to appear to all have been edited with GIMP (including this one). This issue does not appear to occur when using a computer with gimp installed on it.

This image successfully compressed to webp using imagemin-webp, so I do believe that the error occurred in this package.

The server that is running (and crashing) is using Ubuntu 18.04 LTS and the most up to date nodejs LTS release. These are my dependencies from my package.json:

"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"co": "^4.6.0",
"cookie-parser": "^1.4.5",
"cropperjs": "^1.5.7",
"dotenv": "^8.2.0",
"ejs": "^3.1.3",
"express": "^4.17.1",
"express-validator": "^6.5.0",
"imagemin": "^7.0.1",
"imagemin-mozjpeg": "^9.0.0",
"imagemin-pngquant": "^8.0.0",
"imagemin-webp": "^6.0.0",
"jsonwebtoken": "^8.5.1",
"lazysizes": "^5.2.2",
"method-override": "^3.0.0",
"multer": "^1.4.2",
"mysql2": "^2.1.0",
"path": "^0.12.7"
}

@frossi85
Copy link

I am experiencing the same using the same libs versions while running on Linux Alpine but not on Mac OSX. Does anyone have an idea of how to make this library work with Alpine Linux? I tried everything that I read on the different issues but nothing helped. I always got some error (different for each solution that I found on previous issues)

@SMKH-PRO
Copy link

I am facing some problem on Windows 10.
happening with pngs too.

Working perfectly on MacOSX

@dudeful
Copy link

dudeful commented Dec 21, 2020

I was probably having the same issue yesterday, here is a possible solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants