哪些类型的事情会导致 sgen msbuild 任务因访问冲突而间歇性失败?

发布于 2024-08-29 15:35:14 字数 943 浏览 9 评论 0原文

在我们项目的 MSBuild 文件中,我们生成了一个包含 xml 序列化过程中使用的类的程序集。这些类是通过 xsd.exe 生成的。

我们使用以下 SGen 任务配置。

<SGen ToolPath="$(SdkPath)" 
      ShouldGenerateSerializer="true" 
      UseProxyTypes="false" 
      BuildAssemblyName="AssemblyName.dll" 
      BuildAssemblyPath="Outputs" 
      ContinueOnError="false"  />

在我们的构建服务器上执行 msbuild 脚本时,会间歇性地引发以下错误。最初这个错误可能每 50 个 (CI) 构建中就会发生一次,最近频率一直在增加,现在可能每 10 个构建中就会发生 5-6 个。

正在生成的程序集的大小约为 410k(生成的代码约为 35,000 行),成功后序列化程序集的大小约为 1.7M。

当它失败时,输出如下:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
E:\Path_ToBuild_Workspace\SolutionBuild.MSBuild(74,5): error MSB6006: "sgen.exe" exited with code -1073741819.

我们正在使用 Hudson 来管理我们的构建,因此 msbuild 和 sgen 进程由 Hudson.exe 生成。

互联网上关于 SGen 的此类错误的信息并不多。当然没有什么具体的。

In our MSBuild file for our project we sgen an assembly containing classes used during xml serialization. The classes are generated via xsd.exe.

We use the following SGen task configuration.

<SGen ToolPath="$(SdkPath)" 
      ShouldGenerateSerializer="true" 
      UseProxyTypes="false" 
      BuildAssemblyName="AssemblyName.dll" 
      BuildAssemblyPath="Outputs" 
      ContinueOnError="false"  />

Intermittantly the following error is thrown when executing the msbuild script on our build server. Originally this error might have occurred once out of every 50 (CI) builds, recently the frequency has been increasing and it now occurs maybe 5-6 out of every 10 builds.

The size of the assembly that is being Sgenned is about 410k (circa 35,000 lines of generated code), and when successfull the serialization assembly is about 1.7M in size.

When it fails, the output is as follows:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
E:\Path_ToBuild_Workspace\SolutionBuild.MSBuild(74,5): error MSB6006: "sgen.exe" exited with code -1073741819.

We are using Hudson to manage our builds, so the msbuild and sgen processes are therefore spwaned by the Hudson.exe.

There's not much out there on the interwebs regarding this type of error from SGen. Certainly nothing concrete.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红墙和绿瓦 2024-09-05 15:35:14

这似乎是由 32 位版本的 Java 运行时环境生成 sgen.exe 实例引起的。构建服务器在 Windows Server 2003 x64 上运行双 Opterons。

切换到 64 位版本的 JRE 似乎解决了随机 AccessViolationExceptions 的问题。

It appears this was caused by the 32-bit version of the Java Runtime Environment spawning the instance of sgen.exe. The build server is running dual Opterons on Windows Server 2003 x64.

Switching to the 64-bit version of the JRE seems to have fixed the problem with the random AccessViolationExceptions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文