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

Having thousands of browser profiles from previous runs causes Cypress to spawn thousands of subprocesses #30043

Open
WeisSebastian opened this issue Aug 15, 2024 · 2 comments
Labels
OS: windows stage: needs investigating Someone from Cypress needs to look at this type: bug type: performance 🏃‍♀️ Performance related

Comments

@WeisSebastian
Copy link

WeisSebastian commented Aug 15, 2024

Current behavior

On one of our jenkins nodes we currently have an issue that browser profiles do not get deleted (Why that happens is not part of this issue).

Currently we are in the thousands of profiles being located in the App Data directory.
Now everytime we start cypress with cypress run, cypress tries to spawn thousands (highest i've seen was over 2000) Powershell subprocesses, quickly eating all available system memory

Relevant debug log:
cypress.log

Desired behavior

Cypress should not spawn thousands of subprocesses consuming all system resources.

Of course there is an easy work around, delete profiles of previous runs, but if this fails somehow i'd still expect cypress to not behave in this way

Test code to reproduce

No easy reproducer

Cypress Version

13.13.2

Node version

20.16.0

Operating System

Windows 11

Debug Logs

No response

Other

No response

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Aug 15, 2024

@WeisSebastian Oh wow, yah, we haven't actually seen this before. 😬 Relevant logs during cypress run below.

Yah I mean the workaround at the moment would be to manually clear this folder before running this command.

cypress:server:profilecleaner �found 0 root level profile matches: []
cypress:server:profilecleaner �found 1444 profile folders:
..
...printed thousand+ process
...
cypress:server:util:process_profiler error running process profiler: 
  Error: expected to find current pid in process list 73944 
    at i (<embedded>:202:123157) 
    at a (<embedded>:202:123199) 
    at h (<embedded>:2798:30456) 
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Warning: We failed to remove old browser profiles from previous runs.

This error will not affect or change the exit code.

Error: Command 'Get-CimInstance -className win32_process | select Name,ProcessId,ParentProcessId,CommandLine,ExecutablePath' terminated with code: 1�
   at ChildProcess.<anonymous> (<embedded>:1054:59995)�
  at ChildProcess.emit (node:events:514:28)�
  at maybeClose (node:internal/child_process:1091:16)�
  at Socket.<anonymous> (node:internal/child_process:449:11)�
  at Socket.emit (node:events:514:28)�
  at Pipe.<anonymous> (node:net:323:12)�

When you run Cypress, this error is being thrown within this function in our code. This code hasn't been touched in a while.

https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/browsers/utils.ts#L123

Likely there's something about the path to the profiles that is not matching our expected logic. Do you move any files/browser locations or anything around in your machine?

@WeisSebastian
Copy link
Author

No, we are not moving anything around on the machine. All the old profiles are where cypress finds them and they are in the same location on my personal machine where cypress succeeds in deleting them before runs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: windows stage: needs investigating Someone from Cypress needs to look at this type: bug type: performance 🏃‍♀️ Performance related
Projects
None yet
Development

No branches or pull requests

2 participants