You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ansible调用Python.NET执行C#代码时worker进程SIGABRT崩溃问题

Python/Ansible调用.NET C#下载大文件时Worker进程崩溃问题

我尝试在Python/Ansible中调用.NET C#代码,实现100MB级大文件的下载与本地存储功能。本地直接运行Python代码时一切正常,但通过Ansible执行任务时,却抛出错误:error! A worker was found in a dead state。

相关代码

from pythonnet import load
load("coreclr")
import clr

clr.AddReference("yyyyyy.yyyy.yyy")

.....

def doWork(self, x, xx, feedUrl, xxx, xxxx):
          
        from xxxxx import Repository, PackageId, PackageVersion
        from System import Uri, Exception
       
     
        feedUri = Uri(str(feedUrl))           
        pi = PackageId(str(x))
        pv = PackageVersion(str(xx))

        repo = Repository(feedUri,str(xxx), "", str(xxxx))
       
        info= repo.GetPackage(pi, pv)
     
        return info

错误抛出在Ansible的strategy/__init__.py文件第799行。


疑问

  • 为何worker进程会以exitcode=-SIGABRT退出?
  • 本地测试与Ansible执行的差异是什么?
  • 如何进一步排查该错误?

环境

  • 虚拟机 Ubuntu 22.04
  • 12GB 内存

已尝试的排查步骤

  • 将C#代码改为严格同步执行
  • 为C#类添加调试代码,追踪到错误发生在var response = httpClient.Send(request);处
  • 为Ansible添加调试代码,得到错误详情:worker: <WorkerProcess name='WorkerProcess-15' pid=16145 parent=16069 stopped exitcode=-SIGABRT>
  • 增加内存并监控内存使用,未发现异常

补充信息

  • HttpClient发起的HTTP请求因'TCP Zero Window'消息终止,表示客户端处理数据缓慢
  • 模拟测试发现问题与Python multiprocessing相关:Thread执行正常,Process执行异常,而Ansible采用进程模式执行任务,目前仍未明确根源。

内容的提问来源于stack exchange,提问作者Chris

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 01:04:52