2

I have a node server application using Fastify. I can build and run the image locally without a trouble. But when I deploy to the cloud, it fails to start and gives Uncaught signal: 11 - Segmentation fault. After doing some digging I found that it's due to a 3rd party library and problem goes away when I remove it. Library is https://www.npmjs.com/package/@transmute/vc.js

Not using the library is not an option unfortunately. Everything works fine locally but fails in the cloud. I tried different node versions from 14.18 to latest. Also I tried increasing container memory limit up to 1024Mi but no luck.

Anyone have an idea?

SanLW
  • 91
  • 7
  • You have to deep dive into the library and the part that creates the issue. IMO, it's a low level access to CPU instruction that fail. Keep in mind that with Cloud Run 1st gen, your runtime is sandboxed, and therefore limit special CPU instruction. Can you try with the 2nd gen execution runtime? The environment is not sandboxed: https://cloud.google.com/run/docs/configuring/execution-environments#setting – guillaume blaquiere Oct 05 '22 at 07:36
  • @guillaumeblaquiere Thanks for the info but it's not working with 2nd gen either. – SanLW Oct 05 '22 at 10:48
  • No specific clues in the logs? I mean in Cloud Logging, not in Cloud Run log tab (it's not enough detailed) – guillaume blaquiere Oct 05 '22 at 13:17
  • I increased the memory to 2 gigs and it started working. So it seems to be the lack of enough memory but the error message is not explicit. – SanLW Oct 06 '22 at 08:18

2 Answers2

4

Solved by increasing the memory limit to 2048Mi.

SanLW
  • 91
  • 7
0

Solved it by downgrading my node version from 18 to 16 (in the functions/package.json file)

Paul
  • 1,349
  • 1
  • 14
  • 26