gpt4 book ai didi

java - 在完全托管的 CloudRun 上使用 micronaut

转载 作者:太空宇宙 更新时间:2023-11-04 09:41:32 24 4
gpt4 key购买 nike

我尝试在 Cloud Run 上运行 micronaut 框架来测试冷启动性能。

当我在命令行中部署时,我遇到了这个问题:

Deploying...
Creating Revision... Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information....failed
Deployment failed
ERROR: (gcloud.beta.run.deploy) Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.

但是,我测试了几个 dockerfile 配置,我认为我的最后一个非常适合将 EnvVar 端口传递给预期的 Micronaut EnvVar:

FROM gradle:jdk11-slim as builder
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle build

FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim
COPY --from=builder /home/gradle/src/build/libs/micronaut-jib-cr*.jar micronaut-jib-cr.jar
ENV MICRONAUT_SERVER_PORT=${PORT}
EXPOSE ${PORT}
CMD java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dcom.sun.management.jmxremote -noverify ${JAVA_OPTS} -jar micronaut-jib-cr.jar

因此,我深入研究了 Cloud Run 日志,发现了此问题的另一个原因

D  Container Sandbox Limitation: Unsupported syscall setsockopt(0x8,0x1,0xc,0x2ae1273fc05c,0x4,0x32) 
D Container Sandbox Limitation: Unsupported syscall setsockopt(0x8,0x6,0x6,0x2ae1273fc03c,0x4,0x3a)
A Error: Could not find or load main class micronaut.jib.cr.Application
A Caused by: java.lang.ClassNotFoundException: micronaut.jib.cr.Application
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753ef50,0x2,0x2ae12753ef50)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753ef50,0x2,0x2ae12753ef50)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)

这真的是端口使用错误吗?在这种情况下,你能帮我处理我的 dockerfile 吗?

如果不是,这是否是已知的 Cloud Run 限制?

micronaut 上有解决方法来解决此系统调用限制吗?

感谢您的帮助

最佳答案

这不是端口问题。您似乎达到了 gvisor 的限制,这是 Cloud Run 使用的沙箱。您的容器正在尝试进行沙箱尚不支持的系统调用,这会导致容器在启动期间崩溃。

关于java - 在完全托管的 CloudRun 上使用 micronaut,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55928205/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com