Open ceefour opened 4 years ago
Hi, getting the same error, when doing the tutorial https://fnproject.io/tutorials/JavaFDKIntroduction/ Is there an easy explanation, fix or workaround? Thanks alot, Georg
I found this log output in the server:
_time="2022-08-12T09:58:19Z" level=debug msg="Exception in thread \"main\" com.fnproject.fn.runtime.exception.FunctionInitializationException: Unable to bind to unix socket in /tmp/iofs/lsnr.sock\n" app_id=01G7C30SYVNG8G00GZJ0000001 container_id=01GA8QV18RNG8G00GZJ000000T fn_id=01G7C753WANG8G00GZJ0000002 image="fndemo/javafn:0.0.11" tag=stderr
time="2022-08-12T09:58:19Z" level=debug msg="\tat com.fnproject.fn.runtime.HTTPStreamCodec.
Obviously, docker (colima) was not started with root user.
So, the fdk version was not the problem...
I am getting the same issue on MacOS when using colima or rancher desktop.
the invoked function that is deployed when the fn container spins up doesn't seem to have a valid iofs on the host machine.
I tested with Docker Desktop and this works as expected.
您好,您的邮件已收到,谢谢。——熊宇飞
I am also having same issue, any solution to it?
Our group recently started experiencing this issue when switching from Docker Desktop to Rancher Desktop. The issue we see applies to all FDK languages. We have included a workaround below.
Specifically we see in our logs:
Unable to connect to unix socket /tmp/iofs/lsnr.sock.tmp Error: listen EPERM: operation not permitted /tmp/iofs/lsnr.sock.tmp
Container failed to initialize, please ensure you are using the latest fdk and check the logs
fn start
will run a docker command that binds to volumes inside a users home directory. Binding volumes inside a users home directory works fine in Docker Desktop, but in Rancher Desktop volumes are mounted with the nodev option. This option prevents unix domain sockets from working—something all the FDKs require!
For example, if using the node-fdk with debug logging turned on—you'll see this issue cause an EPERM error here: (https://github.com/fnproject/fdk-node/blob/master/fn-fdk.js#L336).
Instead of using fn start
, try the command below. It does the same thing but binds volumes under /tmp instead of your home directory. This got us unblocked.
docker run --rm -i --name fnserver \
-v /tmp/iofs:/iofs \
-e FN_IOFS_DOCKER_PATH=/tmp/iofs \
-e FN_IOFS_PATH=/iofs \
-v /tmp/data:/app/data \
-v /var/run/docker.sock:/var/run/docker.sock \
--privileged \
-p 8080:8080 \
--entrypoint ./fnserver \
-e FN_LOG_LEVEL=DEBUG fnproject/fnserver:latest
@ceefour @geroe1 @pcross616 @suneelkandali - Are any of you using Rancher Desktop by chance? If so, does this workaround resolve your issue?
Thanks
Yup, can confirm the issue is nodev on the container mount volume for iofs. I was able to change it to anything not in my home dir path. I feel like it's a security policy issue with rancher desktop when mounting in the user home. The above docker command works great.
The issue was resolved for me after applying above Docker command, ty
I have the same issue on my Mac M1 with Docker and a fresh installation of FN. I am following the Node.js tutorial, and when I reach the part "fn invoke nodeapp nodefn," I encounter the error mentioned above. Here is the command to start FN with debug log level:
fn start --log-level DEBUG
¡¡¡ 'fn start' should NOT be used for PRODUCTION !!! see https://github.com/fnproject/fn-helm/
docker: Error response from daemon: Conflict. The container name "/fnserver" is already in use by container "d7ac23b0f59ed43134dd4e09415bcb0ff261cb23127af791b068474d0b6dd965". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
I'm seeing this exact issue now on my Mac M1 (Ventura 13.2.1).
Docker Desktop version: 4.22.1 FnProject version: 0.6.26
Any workarounds?
Hi All, About : Error invoking function. status: 502 message: Container failed to initialize, please ensure you are using the latest fdk and check the logs
I've faced this problem using my Mac, after 2 hours spend and trying to understand all error logs , I found a config in my docker settings... so , I've updated file sharing implementation of containers from VirtioFs (default) to osxfs legacy
after what then I'm able to invoke my function correctly.
Error invoking function. status: 502 message: Container failed to initialize, please ensure you are using the latest fdk an
Thank you, @mariobustosjmz, for this workaround. It solved the issue for me. I'd like to know whether there will be a fix for that issue soon since I did not find a way to change the sharing implementation only for a group of containers.
您好,您的邮件已收到,谢谢。——熊宇飞
@mariobustosjmz You're my hero. I'm really curious how you pinpointed that setting as the problem. In any event thanks that seems to have done the trick (for now)
In my case the tutorial from the docs would throw
time="2024-09-04T15:01:33Z" level=debug msg=" File \"/python/bin/fdk\", line 8, in <module>\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" sys.exit(main())\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" ^^^^^^\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" File \"/python/fdk/scripts/fdk.py\", line 38, in main\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" fdk.handle(handler)\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" File \"/python/fdk/__init__.py\", line 125, in handle\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" start(handle_code, lsnr, loop=loop)\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" File \"/python/fdk/__init__.py\", line 87, in start\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" raise ex\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" File \"/python/fdk/__init__.py\", line 73, in start\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
time="2024-09-04T15:01:33Z" level=debug msg=" os.chmod(phony_socket_path, 0o666)\n" app_id=01J6YPJJKYNG8G00GZJ0000003 container_id=01J6YRW74YNG8G00GZJ0000002 fn_id=01J6YPNXBBNG8G00GZJ0000004 image="fndemouser/pythonfn:0.0.3" tag=stderr
If this can help anyone in the future.
您好,您的邮件已收到,谢谢。——熊宇飞
Description
fn invoke myapp hello
failed with:Error invoking function. status: 502 message: Container failed to initialize, please ensure you are using the latest fdk and check the logs
Steps to reproduce the issue:
Describe the results you received:
Logs:
Describe the results you expected:
hello
function executed.Additional information you deem important (e.g. issue happens only occasionally):
Always reproducible. Also reproducible with go:
Logs:
Output of
fn version
(CLI command):Additional environment details (OSX, Linux, flags, etc.):
Windows 10 Pro.