纱线安装会消耗TeamCity和Jenkins的所有内存 [英] yarn install consumes all memory on TeamCity and Jenkins

查看:111
本文介绍了纱线安装会消耗TeamCity和Jenkins的所有内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很想与TeamCity或Jenkins合作 yarn install消耗了我所有的构建服务器的cpu&记忆,即使有 一个很小的npm项目.知道为什么吗?

I'd really like to get yarn working with TeamCity or Jenkins, however yarn install consumes all my build server's cpu & memory, even with a tiny npm project. Any idea why?

  • yarn install由TeamCity或Jenkins运行时,会消耗大量CPU/内存,但永远不会完成
  • 在构建服务器上的命令行中运行yarn install可以正常工作(几秒钟内完成)
  • 由TeamCity/Jenkins运行时,
  • npm install会在几秒钟内完成
  • 构建服务器:Windows Server 2012,2核,4GB内存
  • 纱线版本​​1.6.0
  • Jenkins版本2.107.2
  • TeamCity版本2017.2.3
  • 尝试过Node.js版本8.11.1和9.11.1
  • yarn install, when run by TeamCity or Jenkins, consumes most CPU/memory, never finishes
  • running yarn install from the command line on the build server works (finishes in a few seconds)
  • npm install completes in a few seconds when run by TeamCity/Jenkins
  • build server: Windows Server 2012, 2 cores, 4GB mem
  • yarn version 1.6.0
  • Jenkins version 2.107.2
  • TeamCity version 2017.2.3
  • Have tried Node.js versions 8.11.1 and 9.11.1

步骤:

创建一个小型npm项目:

Create a tiny npm project:

mkdir temp
cd temp
yarn init  # all defaults
yarn add dummy-module  # tiny test package

将此操作提交给git,使用单个命令yarn install设置Jenkins或TeamCity构建.

Commit this to git, set up a Jenkins or TeamCity build with a single command yarn install.

构建永远不会结束,控制台输出的最后一行:yarn install v1.6.0. 目前,Node.js进程正在占用服务器上的大部分CPU和内存. 建造机器.将命令更改为npm install使其成功运行.

The build never finishes, with the last line of console output: yarn install v1.6.0. At this time, the Node.js process is consuming most of the CPU and memory on the build machine. Changing the command to npm install makes it run successfully.

由于这是詹金斯(Jenkins)和TeamCity的共同点,因此问题似乎与 从Java运行子进程.我找不到发生问题的任何迹象 在TeamCity或Jenkins日志中.在中止Jenkins构建时, 我在jenkins.err.log中看到以下内容:

Since it's common to Jenkins and TeamCity, it seems like the problem is to do with running sub processes from java. I can't find any indication of what's going wrong in either the TeamCity or Jenkins logs. When aborting the Jenkins build, I see the following in jenkins.err.log:

Apr 22, 2018 8:59:11 AM hudson.model.Run execute
INFO: master-cake #9 aborted
java.lang.InterruptedException
    at java.lang.ProcessImpl.waitFor(Unknown Source)
    at hudson.Proc$LocalProc.join(Proc.java:324)
    at hudson.tasks.CommandInterpreter.join(CommandInterpreter.java:155)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    at hudson.model.Build$BuildExecution.build(Build.java:206)
    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1727)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)

推荐答案

我从最初的问题中遗漏了一些关键信息-我还使用了yarn的脱机镜像,该镜像存储在网络驱动器上.事实证明,TeamCity Windows服务无法访问网络驱动器: https ://confluence.jetbrains.com/display/TCD10/Known+Issues#KnownIssues-AgentrunningasWindowsServiceLimitations

I left some crucial information out of the original question - I'm also using yarn's offline mirror, which was stored on a network drive. It turns out that the TeamCity windows service can't access network drives: https://confluence.jetbrains.com/display/TCD10/Known+Issues#KnownIssues-AgentrunningasWindowsServiceLimitations

将yarn的脱机镜像重新定位到本地目录可以解决TeamCity和Jenkins的问题.

Relocating yarn's offline mirror to a local directory solved the issue for both TeamCity and Jenkins.

这篇关于纱线安装会消耗TeamCity和Jenkins的所有内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆