我正在用python在AWS硝基飞地中做一些图像识别。但是在导入包(如OpenCV、NumPy和熊猫)时,代码会挂起。用于构建enclave的dockerfile文件将在我的本地机器或EC2中正常工作。生成的enclave控制台将输出一些关于openBLAS缓存大小和进程冻结的L2警告。没有任何类型的错误输出。在enclave中使用包时,是否需要添加其他依赖项,或者与内核有一些冲突?
对接器、shell和py测试代码如下所示:
#amazonlinux still have the import issue
#python:3.7 libs importing crush
FROM amazonlinux
WORKDIR /app
#py 3.7
RUN yum install python3 zip -y
ENV VIRTIAL_ENV=/opt/venv
RUN python3 -m venv $VIRTIAL_ENV
ENV PATH="$VIRTIAL_ENV/bin:$PATH"
#3 libs needed for cv2 import
RUN yum install libSM-1.2.2-2.amzn2.x86_64 -y
RUN yum install libXrender-0.9.10-1.amzn2.x86_64 -y
RUN yum install libXext-1.3.3-3.amzn2.x86_64 -y
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r /app/requirements.txt
#shell script testing
COPY dockerfile_entrypoint.sh ./
COPY test_cv2.py ./
#ENV for shell testing printf loop
ENV HELLO="Hello from enclave side!"
RUN chmod +X dockerfile_entrypoint.sh
#shell script testing
CMD ["/app/dockerfile_entrypoint.sh"]#!/bin/bash
#shell printf loop test in enclave
# go to work dir and check files
cd /app||return
ls
#cv2 imp issue
python3 test_cv2.py
#use shell loop to keep enclave live to see error message output
count=1
while true;do
printf "[%4d] $HELLO\n" $count
echo "$PWD"
ls
count=$((count+1))
sleep 5
doneimport cv2
for i in range(10):
print('testing OpenCV')发布于 2021-08-09 21:22:28
当应用程序或库试图从/dev/random读取数据时,可能会发生这些类型的挂起,但是没有足够的熵,这会导致进程在读取时阻塞。在这个GitHub问题上有一些可能的解决方案:https://github.com/aws/aws-nitro-enclaves-sdk-c/issues/41#issuecomment-792621500
https://stackoverflow.com/questions/68478268
复制相似问题