我们将k8s部署用作laravel队列工作器。运行时是laravel 5.6的阿尔卑斯山3.10和php 7.3 fpm。我们的资源限制是请求:512MB和1Gi限制。
我们正在运行8个副本来卸载来自SQS的传入消息,并且我们正在使用。通过kubernetes cron作业调度要排队的消息
php /var/www/artisan queue:work ${CHANNEL} -vvv --tries=3 --sleep=3 --timeout=3600 --memory=${MEMORY}
其中CHANNEL是队列名称(SQS),MEMORY是传递给laravel worker的内存限制。平均而言,每个Pod始终会处理170多个消息,这些消息与各种第三方api和其他内容进行对话。
问题:
间歇地,我们的Pod重新启动,错误代码为139,
SIGSEGV, Segmentation fault.
这会影响我们的生产系统,因为有消息正在处理时,我们的容器会重新启动。
最佳答案
这是社区维基的答案,因为它仅从Docker容器方面解决了该问题。随意扩展您的意愿。
您看到的错误代码表明容器收到了SIGSEGV:
SIGSEGV indicates a segmentation fault. This occurs when a program attempts to access a memory location that it’s not allowed to access, or attempts to access a memory location in a way that’s not allowed. From the Docker container standpoint, this either indicates an issue with the application code or sometimes an issue with the base images used by the container.
在这种情况下,您应该确保您没有使用某些旧的Docker版本,然后尝试使用调试器在容器内测试代码。我对该主题还不够熟悉,无法进一步指导您,但this SO question可能对您有用。
关于php - Laravel Worker在带有139错误代码SIGSEGV的K8s Pod中运行时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62998697/