Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn Test task hangs #17

Closed
IamAndyW opened this issue Jun 23, 2017 · 24 comments
Closed

Yarn Test task hangs #17

IamAndyW opened this issue Jun 23, 2017 · 24 comments
Assignees
Milestone

Comments

@IamAndyW
Copy link

IamAndyW commented Jun 23, 2017

If you face the same issue, please refer to known issues : https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Known-Issues

We have the following workflow...

yarn install
yarn test
yarn build

Intermittently the build will hang on the 'yarn test' task. The build will eventually timeout.
The build only ever hangs on the test task. We are using the Jest testing framework.

I've reverted back to using NPM to see if this is more reliable.

@sandorfr
Copy link
Member

sandorfr commented Jul 3, 2017

Hi,

I'm really sorry to hear that. What's the outcome of your tests with NPM?

@IamAndyW
Copy link
Author

Hi,

The builds do appear to be more reliable using NPM.

@sandorfr sandorfr marked this as a duplicate of #20 Jul 26, 2017
@sandorfr
Copy link
Member

#20 seems to have a similar issue. I think there might be something going wrong with yarn and angular cli. Can you provide a minimal project which would allow me to reproduce the issue?

@jrr
Copy link

jrr commented Aug 15, 2017

This is affecting me too, with an ember-cli project. Is there a way I can run the gl-vsts-tasks-yarn code locally, to try to create a simple repro without the overhead of setting up a new repo and VSTS build?

@sandorfr
Copy link
Member

I don't think there's an easy way to do that. You'll have to create the repo to share it with us anyway.

If you can share a repro it would be greatly appreciated.

@sandorfr
Copy link
Member

I wonder if for some reason the yarn or the cli is hanging waiting on some user input which would be the same issue as when there is a version conflict (tracked here #21).

If it's yarn there is an undocumented --non-interactive argument we can pass to it to disable user prompts.

Would you mind trying to add this flag to the argument in your build and see if something changes?

@jrr
Copy link

jrr commented Aug 16, 2017

--non-interactive seems to have no effect. (the hang occurs intermittently, both with and without the option)

Here's an example of a hang with --non-interactive on (after a ~1-hour VSTS build timeout).

2017-08-16T13:29:21.3495659Z ##[debug]Evaluating condition for step: 'Test'
2017-08-16T13:29:21.3495659Z ##[debug]Evaluating: succeeded()
2017-08-16T13:29:21.3495659Z ##[debug]Evaluating succeeded:
2017-08-16T13:29:21.3495659Z ##[debug]=> (Boolean) True
2017-08-16T13:29:21.3495659Z ##[debug]Expanded: True
2017-08-16T13:29:21.3495659Z ##[debug]Result: True
2017-08-16T13:29:21.3495659Z ##[section]Starting: Test
2017-08-16T13:29:21.3495659Z ==============================================================================
2017-08-16T13:29:21.3495659Z Task         : Yarn task
2017-08-16T13:29:21.3505662Z Description  : Executes Yarn
2017-08-16T13:29:21.3505662Z Version      : 1.1.1001
2017-08-16T13:29:21.3505662Z Author       : Geek Learning
2017-08-16T13:29:21.3505662Z Help         : [More Information](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn) (Version 1.1.1001)
2017-08-16T13:29:21.3505662Z ==============================================================================
2017-08-16T13:29:21.5605661Z ##[debug]agent.workFolder=d:\a
2017-08-16T13:29:21.5625661Z ##[debug]loading inputs and endpoints
2017-08-16T13:29:21.5635661Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2017-08-16T13:29:21.5645665Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2017-08-16T13:29:21.5645665Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2017-08-16T13:29:21.5645665Z ##[debug]loading INPUT_ARGUMENTS
2017-08-16T13:29:21.5645665Z ##[debug]loading INPUT_CUSTOMREGISTRY
2017-08-16T13:29:21.5645665Z ##[debug]loading INPUT_PRODUCTIONMODE
2017-08-16T13:29:21.5655656Z ##[debug]loading INPUT_PROJECTDIRECTORY
2017-08-16T13:29:21.5655656Z ##[debug]loaded 7
2017-08-16T13:29:21.7855669Z ##[debug]which 'yarn'
2017-08-16T13:29:21.8105652Z ##[debug]not found
2017-08-16T13:29:21.8105652Z ##[debug]Arguments=run ci --non-interactive
2017-08-16T13:29:21.8115665Z ##[debug]ProjectDirectory=d:\a\1\s
2017-08-16T13:29:21.8115665Z ##[debug]customRegistry=useNpmrc
2017-08-16T13:29:21.8115665Z ##[debug]customFeed=null
2017-08-16T13:29:21.8115665Z ##[debug]customEndpoint=null
2017-08-16T13:29:21.8135661Z ##[debug]AGENT_WORKFOLDER=d:\a
2017-08-16T13:29:21.9305663Z ##[debug]d:\a\yarn
2017-08-16T13:29:21.9305663Z ##[debug]["dist"]
2017-08-16T13:29:21.9305663Z ##[debug]d:\a\yarn\dist\bin\yarn.cmd
2017-08-16T13:29:21.9305663Z ##[debug]Build.BuildId=10117
2017-08-16T13:29:21.9305663Z ##[debug]Agent.BuildDirectory=d:\a\1
2017-08-16T13:29:21.9315664Z ##[debug]testing directory 'd:\a\1\npm'
2017-08-16T13:29:21.9315664Z ##[debug]testing directory 'd:\a\1'
2017-08-16T13:29:21.9315664Z ##[debug]mkdir 'd:\a\1\npm'
2017-08-16T13:29:21.9315664Z ##[debug]Build.BuildId=10117
2017-08-16T13:29:21.9315664Z ##[debug]Agent.BuildDirectory=d:\a\1
2017-08-16T13:29:21.9325663Z ##[debug]Using registries in .npmrc
2017-08-16T13:29:21.9325663Z ##[debug]customEndpoint=null
2017-08-16T13:29:21.9325663Z ##[debug]which 'd:\a\yarn\dist\bin\yarn.cmd'
2017-08-16T13:29:21.9335665Z ##[debug]found: 'd:\a\yarn\dist\bin\yarn.cmd'
2017-08-16T13:29:21.9335665Z ##[debug]which 'd:\a\yarn\dist\bin\yarn.cmd'
2017-08-16T13:29:21.9335665Z ##[debug]found: 'd:\a\yarn\dist\bin\yarn.cmd'
2017-08-16T13:29:21.9335665Z ##[debug]ProductionMode=false
2017-08-16T13:29:21.9335665Z ##[debug]d:\a\yarn\dist\bin\yarn.cmd arg: run ci --non-interactive
2017-08-16T13:29:21.9345660Z ##[debug]exec tool: d:\a\yarn\dist\bin\yarn.cmd
2017-08-16T13:29:21.9345660Z ##[debug]arguments:
2017-08-16T13:29:21.9345660Z ##[debug]   run
2017-08-16T13:29:21.9345660Z ##[debug]   ci
2017-08-16T13:29:21.9345660Z ##[debug]   --non-interactive
2017-08-16T13:29:21.9355662Z [command]C:\Windows\system32\cmd.exe /D /S /C "d:\a\yarn\dist\bin\yarn.cmd run ci --non-interactive"
2017-08-16T13:29:22.1745659Z yarn run v0.27.5
2017-08-16T13:29:22.2715662Z $ ember test --config-file testem_ci.js
2017-08-16T14:26:52.1130247Z ##[debug]Re-evaluate condition on job cancellation for step: 'Test'.
2017-08-16T14:26:52.1755351Z ##[error]The operation was canceled.
2017-08-16T14:26:52.1755351Z ##[debug]System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Microsoft.VisualStudio.Services.Agent.ProcessInvoker.<ExecuteAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.<RunAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.<RunAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.<RunStepAsync>d__1.MoveNext()
2017-08-16T14:26:52.1755351Z ##[section]Finishing: Test

I'll try to create a simplified repro from scratch some time in the next few days.

@sandorfr
Copy link
Member

I'll try to create a simplified repro from scratch some time in the next few days.

Thanks, it would be much appreciated

@jrr
Copy link

jrr commented Aug 17, 2017

@sandorfr okay, got it! https://github.com/jrr/vsts-yarn-issue-repro

A successful build takes ~2 minutes, with the test step taking ~30 seconds of that. (so, if you see it stuck for more than 3 minutes, it's probably hung)

It's intermittent, so you may need to try a few times before it happens.

Here are my task configs, in case they're relevant:

yarn install

          {
            "environment": {},
            "enabled": true,
            "continueOnError": false,
            "alwaysRun": false,
            "displayName": "yarn",
            "timeoutInMinutes": 0,
            "condition": "succeeded()",
            "refName": "Yarn_4",
            "task": {
              "id": "0888c9a9-d1b2-4567-aae2-beadcb2059b3",
              "versionSpec": "1.*",
              "definitionType": "task"
            },
            "inputs": {
              "ProjectDirectory": "",
              "Arguments": "",
              "ProductionMode": "false",
              "customRegistry": "useNpmrc",
              "customFeed": "",
              "customEndpoint": ""
            }
          },

yarn test (intermittently hangs)

          {
            "environment": {},
            "enabled": true,
            "continueOnError": false,
            "alwaysRun": false,
            "displayName": "Test",
            "timeoutInMinutes": 0,
            "condition": "succeeded()",
            "refName": "Yarn_7",
            "task": {
              "id": "0888c9a9-d1b2-4567-aae2-beadcb2059b3",
              "versionSpec": "1.*",
              "definitionType": "task"
            },
            "inputs": {
              "ProjectDirectory": "",
              "Arguments": "test",
              "ProductionMode": "false",
              "customRegistry": "useNpmrc",
              "customFeed": "",
              "customEndpoint": ""
            }
          },

npm test (reliably works)

          {
            "environment": {},
            "enabled": false,
            "continueOnError": false,
            "alwaysRun": false,
            "displayName": "Test (workaround)",
            "timeoutInMinutes": 0,
            "condition": "succeeded()",
            "refName": "Npm7",
            "task": {
              "id": "fe47e961-9fa8-4106-8639-368c022d43ad",
              "versionSpec": "1.*",
              "definitionType": "task"
            },
            "inputs": {
              "command": "custom",
              "workingDir": "",
              "verbose": "false",
              "customCommand": "run test",
              "customRegistry": "useNpmrc",
              "customFeed": "",
              "customEndpoint": "",
              "publishRegistry": "useExternalRegistry",
              "publishFeed": "",
              "publishEndpoint": ""
            }
          },

Let me know if there's anything else I can do to help. Thanks!

@schei1
Copy link

schei1 commented Aug 18, 2017

We're experiencing this issue as well. We're using Yarn, and Jest as test runner.

Using the yarn task within VSTS just hangs, with no feedback. We were running an old version of Yarn vsts task (0.7.xx), and upgrading to 0.28.xx did not change anything, it still hangs. Using the --non-interactive flag did not have any effect, as mentioned in earlier posts.

I've ran a couple of builds, and terminating the ones that took ~20 secs or more to complete. Only testing a subset right now to get this up and running.

Yarn 0.28.4 (same with 0.7.xx)

017-08-18T11:56:54.6123117Z [command]C:\Program Files (x86)\Yarn\bin\yarn.cmd run test:prod
2017-08-18T11:56:54.8466578Z yarn run v0.28.4
2017-08-18T11:56:54.9560131Z $ jest -u
2017-08-18T11:57:16.6350299Z ##[error]The operation was canceled.

With npm it works well:

2017-08-18T12:02:47.1228810Z > [email protected] test:prod C:\agent\_work\3\s\Frontend\Portal
2017-08-18T12:02:47.1228810Z > jest -u
2017-08-18T12:02:47.1228810Z 
2017-08-18T12:02:51.5313300Z  PASS  test\unit\xx.spec.ts
-- omitted for brevity --
2017-08-18T12:02:53.4383407Z  PASS  test\unit\yy\yy.spec.ts
2017-08-18T12:02:53.4383407Z 
2017-08-18T12:02:53.4383407Z Test Suites: 6 passed, 6 total
2017-08-18T12:02:53.4383407Z Tests:       21 passed, 21 total
2017-08-18T12:02:53.4383407Z Snapshots:   0 total
2017-08-18T12:02:53.4383407Z Time:        5.093s, estimated 12s
2017-08-18T12:02:53.4383407Z Ran all test suites.

Using npm: the small test set starts right away, and completes in an expected timeframe, not much more than what it use on my dev machine.
Using yarn: Does not matter how long its running, it never displays anything else than "jest -u", and seems to hang.

@sandorfr
Copy link
Member

sandorfr commented Sep 4, 2017

Thanks for the repro @jrr, I can confirm that I reproduce the issue :)

I can see the node process invoked by ember cli hanging literally doing nothing. It's really strange. Trying to figure out what's going on.

@sandorfr
Copy link
Member

sandorfr commented Sep 4, 2017

It seems to be a windows only issue. I can't reproduce it on Linux hosted agents.

@sandorfr sandorfr self-assigned this Sep 4, 2017
@sandorfr sandorfr added this to the 2.1.0 milestone Sep 30, 2017
@sandorfr
Copy link
Member

Still happening with 1.x versions of Yarn. I wonder if it could be related to symlinks and UAC https://ember-cli.com/user-guide/#windows

@sandorfr
Copy link
Member

I just realized I'm not facing this issue and this is apparently related to the fact that I'm using a more recent version of node (8.x) thanks to nuget tools installer. @jrr would you give a try to see if it mitigates your issue?

@jrr
Copy link

jrr commented Oct 11, 2017

Looks like it does! Specifically:

  • I can still get the hang with node 6 and vsts-yarn-issue-repro.
  • Switching to node 8 via the Node Tool Installer (Preview) task fixes it.
  • I also switched to node 8 in our app, and ~5 builds later the hang hasn't occurred.

@schei1 how about you? (does node 8 fix it for you?)

So, I think it's resolved, but I'll be more confident after another week or so of builds. As far as I'm concerned you can close the issue and I'll reopen if it recurs.

@sandorfr
Copy link
Member

sandorfr commented Oct 11, 2017 via email

@rexkenley
Copy link

sandorfr

Any updates to this issue? The hang also occurs for node 10.

Thanks!

@Weffe
Copy link

Weffe commented Dec 10, 2018

I am on node 8.11.1 and getting the same result that it hangs on yarn test

Edit: Nevermind, I had to provide an env variable to my test script as I was using create-react-app. More details are here https://facebook.github.io/create-react-app/docs/running-tests#on-your-own-environment

2nd Edit: I should mention that I had to add the CI env variable as a pipeline variable to my build agent.
I don’t know how you would define this in a config file because I primarily just use the UI.

Here’s a screenshot of what I am talking about:

Screenshot of CI pipeline variable

@sandorfr
Copy link
Member

Oh thanks for that information @Weffe, I need to add that to some trouble shooting steps.

@pdemro
Copy link

pdemro commented Dec 14, 2018

yarn ng build --prod in angular 6 takes over 20 minutes in Azure Devops, if it completes at all. Any update here would be appreciated!

EDIT: I have tried both mitigation suggestions on the wiki. Neither seems to improve performance of the build on Angular 6.

image

@sandorfr
Copy link
Member

@pdemro what do you expect yarn ng build --prod to do ?

Either you have a script named scripts in your package.json and you do something like yarn build or you use a simple command line task to start ng build --prod.

@pdemro
Copy link

pdemro commented Dec 18, 2018

@sandorfr I'm not sure if it is what you were getting at, but I removed the Yarn task from the build and replaced with a command line task for ng build --prod. The build still takes 2-3 times as long for Angular 6 as opposed to Angular 5. This leans blame more to Devops agents rather than vsts-tasks-yarn. Thanks for your input!

@sandorfr
Copy link
Member

yes @pdemro it's more likely a environmental issue with angular cli. That said ng build --prod has always been quite slow from my experience, even on good hardware.

@sandorfr
Copy link
Member

sandorfr commented Jun 2, 2019

It seems that the original issue is not happening anymore. To people facing similar issues please open a new issue with repro and traces.

@sandorfr sandorfr closed this as completed Jun 2, 2019
@geeklearningio geeklearningio locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants