serverless-chrome icon indicating copy to clipboard operation
serverless-chrome copied to clipboard

Help with running under AWS ECS

Open tspiva opened this issue 8 years ago • 3 comments

Hopefully someone else has seen this and can help me. I'm trying to run this as a docker image under AWS ECS. I'm using chrome-remote-interface to have it load a webpage so I can screen shot it using Page.navigate({url}). This use to work fine with https://github.com/adieuadieu/serverless-chrome/releases/download/v1.0.0-38/stable-headless-chromium-amazonlinux-2017-03.zip but with the later versions when I send the command to chrome I get a stack trace similar to:

Received signal 7 BUS_ADRERR 7fa8bc903000 #0 0x0000035d34fc #1 0x0000035d3061 #2 0x7fa8cefef5a0 #3 0x00000231eb50 #4 0x000003ac1f91 #5 0x000003b3fbb6 #6 0x000003b3f4bc #7 0x000003ab2e07 #8 0x000003a9ffbb #9 0x000003a9a632 #10 0x000003a985b9 #11 0x000003b56cf8 #12 0x000003a985b9 #13 0x0000040be46e #14 0x0000040bd27d #15 0x0000040bd203 #16 0x0000043d9079 #17 0x0000043d852f #18 0x0000043d8450 #19 0x000004406d9c #20 0x000004418570 #21 0x0000043d7937 #22 0x000005b41aec #23 0x000005b40c3a #24 0x00000362f05b #25 0x00000362b50d #26 0x7fa8cefe7de5 start_thread #27 0x7fa8cda3a30d __clone r8: 00000000000000f8 r9: 00000000000000f8 r10: 0000000000000100 r11: 00007fa8cdac5a50 r12: 0000000000000101 r13: 0000000000000400 r14: 0000000000000100 r15: 00000000ffffffff di: 00007fa8bc903000 si: 00000000ffffffff bp: 00007fa8c2803f60 bx: 00007fa8bc903000 dx: 0000000000000100 ax: 00007fa8bc903000 cx: 0000000000000140 sp: 00007fa8c2803f28 ip: 000000000231eb50 efl: 0000000000010202 cgf: 002b000000000033 erf: 0000000000000006 trp: 000000000000000e msk: 0000000000000000 cr2: 00007fa8bc903000 [end of stack trace] Calling _exit(1). Core file will not be generated.

Docker file is very basic. Just based on adieuadieu/headless-chromium-for-aws-lambda

Has anyone experienced anything similar and know how to fix it?

tspiva avatar May 15 '18 21:05 tspiva

Hi tspiva, I might have a solution for you since I have been struggling with something similar today.

Version 38 is the last version based on chromium 64. In chromium 65 this important change happened.

They have finally added an official flag for shared memory management. The flag is --disable-dev-shm-usage.

I think @adieuadieu will have to adjust his automatic build to incorporate this change. The memory hack described in How to get headless Chrome running on AWS Lambda should not be needed anymore and this flag should be included in preset chrome flags.

To sum up, make sure to run chromium with this flag.

Hope it helps, Jan

vernjan avatar May 16 '18 13:05 vernjan

That worked perfectly! Thanks for the help.

tspiva avatar May 16 '18 15:05 tspiva

--disable-dev-shm-usage was added in v1.0.0-45. Future Chromium builds will no longer include the /dev/shm hack.

adieuadieu avatar May 16 '18 21:05 adieuadieu