Skip to content

[SPA Services] Investigate reliability for the start script for the react development server #13641

@javiercn

Description

@javiercn

I've been looking at this as part of the work on infrastructure and there are failures like https://dnceng.visualstudio.com/internal/_test/analytics?definitionId=21&contextType=build that might be due to reliability issues in the start script.

When looking at the logs for the build above I see the following:

info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished in 18818.387300000002ms 200 text/html; charset=UTF-8
npmfail: Microsoft.AspNetCore.SpaServices[0]
      npm ERR! code ELIFECYCLE

npmnpm ERR!npm ERR!npm fail: Microsoft.AspNetCore.SpaServices[0]
      npm ERR! errno 1
npm ERR! [email protected] start: `rimraf ./build && react-scripts start`

fail: Microsoft.AspNetCore.SpaServices[0]
      npm ERR! Exit status 1
npm ERR! 

fail: Microsoft.AspNetCore.SpaServices[0]
      npm ERR! Failed at the [email protected] start script.

fail: Microsoft.AspNetCore.SpaServices[0]
      npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I believe it comes from the start script in here. I don't think we can tell whether rimraf ./build or react-scripts start is the one causing the issue.

Should we consider a product change here to improve reliability for development scenarios? We could do a couple of things:

  • Add retries;
  • Support multiple NPM script commands and separate rimraf ./build from react-scripts start
  • Switch the command to use ; instead of && which will execute react-scripts start regardless of whether rimraf ./build succeeds or fails.
  • Execute rimraf twice in the script.
  • Execute rimraf before until it succeeds in the tests to give it a better chance of success.

https://github.com/aspnet/AspNetCore/blob/master/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json#L34

Ultimately this seems like a product issue our customers might run into while developing. I can't tell from the logs what is causing rimraf to fail (maybe something is holding on to a file, or the OS if bugging out (it also rarely happens)).

Although small, this is impacting the E2E tests. We need to choose whether we address the product issue (reliability) or we change the test to be more reliable there.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions