Netcore2.2应用程序在Linux机器上的发布配置中中止

也已登录:https://github.com/dotnet/coreclr/issues/27734

附加的代码:https://github.com/dotnet/coreclr/files/3820061/Program.zip

我们针对以netcoreapp2.2为目标的附加(严重缩减)项目存在问题。

我们以发布和调试配置来构建和发布该应用。

在Windows上运行时,发布和调试均成功完成。

在Linux上运行时,调试成功完成,但是Release终止并出现以下错误之一:

  • System.accessViolationException:'试图读取或写入受保护的内存。这通常表明其他内存已损坏。'
  • 分段错误

程序非常简单,不包含任何非托管代码,没有第三方依赖性,并且几乎没有逻辑。

Linux机器详细信息(但是这会在我们可用的所有不同Linux机器/操作系统上发生):

Unu(xx)

dotnet --info:

if inp==0:
    print('***')
    print('0 Is not acceptable ')
    print('***')
else:
    nu_list = []
    Unu_list = []
    for xx in range(1,819):
        ...# lines of code
        if inp<0:
            if lim > 1:
                pass
            else:
                nu_list.append(dfimppara.iloc[xx,1] *115)
                Unu_list.append(Unu(xx))
            plt.plot(Unu_list,nu_list)
        else:
            ...
plt.show() 

我们已经尽可能地削减了程序的数量(显然,在我们的实际程序中,方法参数是必需的)。

有人看到过这个问题,或者可以提出不涉及删除参数或删除接口的前进方法吗?

cahdj123 回答:Netcore2.2应用程序在Linux机器上的发布配置中中止

对此的简短回答是,升级到Net Core 3.0将解决大多数问题(仍然存在难以复制的Microsoft正在调查的边缘情况)。

对于这个错误,在网络核心clr github页面上的答案很长,但是下面是janvorli的摘要:

“该问题是由JIT错误引起的。当Thing1 :: DoWork1调用Thing2.DoWork2并将相同的参数传递给它时(第一个除外是Thing2),它错误地将传入参数中的参数改组寄存器和堆栈槽添加到DoWork2的参数寄存器和槽中。根据Unix AMD64调用约定,将DoWork1的参数传递如下:

            this in RDI  
            IThing2 thing2 in RSI  
            double[][] array1 in RDX  
            double[] array2 in RCX  
            int[] array3 in R8  
            int[] array4 in R9  
            double[] array5 in stack slot 0  
            int integer1 in stack slot 1  
            int integer2 in stack slot 2  
            int integer3 in stack slot 3  
            double double1 in XMM0

调用thing2.DoWork2(array1,double1,array3,array4,array5,integer1,integer2,integer3);时,参数应按以下方式传递:

            thing2 in RDI (was in RSI)  
            array1 in RSI (was in RDX)  
            double1 in XMM0 (was in XMM0)  
            int[] array3 in RDX (was in R8)  
            array4 in RCX (was in R9)  
            array5 in R8 (was in stack slot 0)  
            int integer1 in R9 (was in stack slot 1)  
            int integer2 in stack slot 0 (was in stack slot 2)  
            int integer3 in stack slot 1 (was in stack slot 3)  

因此,如您所见,JIT需要执行以下参数移动:

RSI->RDI
RDX->RSI
R8->RDX
R9->RCX
Stack slot 0->R8
Stack slot 1->R9
Stack slot 2->stack slot 0
Stack slot 3->Stack slot 1

但是在.NET 2.2中,JIT中存在一个错误,该错误以不正确的顺序进行了移动。在将堆栈插槽0移至R8之前,它已将32位从堆栈插槽2移至堆栈插槽0。因此R8(应该包含对array5的引用)最终的值被破坏并且对其进行访问导致测试应用程序崩溃。

不幸的是,我找不到解决此问题的PR。”

本文链接:https://www.f2er.com/3144253.html

大家都在问