boost::filesystem not working in Google Cloud Run (using gVisor)

107 Views Asked by At

I've created a docker container (ubuntu:focal) with a C++ application that is using boost::filesystem (v1.76.0) to create some directories while processing data. It works if I run the container locally, but it fails when deployed to Cloud Run.

A simple statement like

boost::filesystem::exists(boost::filesystem::current_path())

fails with "Invalid argument '/current/path/here'". It doesn't work in this C++ application, but from a Python app running equivalent statements, it does work.

Reading the docs I can see Cloud Run is using gVisor and not all the system calls are fully supported (link: https://gvisor.dev/docs/user_guide/compatibility/linux/amd64/), nevertheless I would expect simple calls to work: check if a directory exists, create a directory, remove,...

Maybe I'm doing something wrong when deploying my container. Is there any way to work around it? Any boost configuration I can use to prevent it from using some syscalls?

Thanks for your help!

1

There are 1 best solutions below

0
On

I have run into the same issue when running SlideIO (which use boost::filesystem) in google cloud function. It works fine locally but always returns "boost::filesystem::status: Invalid argument [system:22]" on google cloud.

I switched to second generation execution env for Cloud Run which provides full Linux compatibility rather than system call emulation. And the code works fine again.