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

Windows+WSL2: npm process is very slow in Docker Compose #83

Closed
akauppi opened this issue Sep 16, 2021 · 6 comments
Closed

Windows+WSL2: npm process is very slow in Docker Compose #83

akauppi opened this issue Sep 16, 2021 · 6 comments
Assignees
Labels
bug Something isn't working packages/back-end Involves the back-end

Comments

@akauppi
Copy link
Owner

akauppi commented Sep 16, 2021

Preparation:

  • normal npm install in the root and ´packages/backend`
  • add this line in backend/docker-compose.yml, after the warm-up npm command:
   npm run dc:warm-up &&
   echo "[DEBUG] Warmed up, opening port 6768" &&

Steps:

  • within packages/backend:
$ docker compose up warm-up --abort-on-container-exit

Expectation:

  • The warm-up tests should pass, the echo should be seen
  • Port 6768 should be opened

Actual:

  • Execution does not proceed from the npm command

This means warmed-up times out, npm test doesn't work etc.

Docker Desktop for Windows 4.0.1

@akauppi akauppi self-assigned this Sep 16, 2021
@akauppi akauppi added bug Something isn't working packages/back-end Involves the back-end labels Sep 16, 2021
@akauppi
Copy link
Owner Author

akauppi commented Sep 16, 2021

Between Jest having written "Ran all the tests", and it returning the process to npm is where there's a WEIRD 30+ s pause on Windows+WSL2. It does eventually return. Likely some timeout within Jest, but which???

Docker Desktop for Windows 4.0.1
Jest 27.2.0 (also happens with 27.1.1)

Work-around for now: increased warm-up timeout to 2 min in DC.

  • Report this to Jest, with reproducible instructions (could also test on another Windows machine)

@akauppi akauppi changed the title Windows+WSL2: npm process does not return in Docker Compose Windows+WSL2: npm process is very slow in Docker Compose Sep 17, 2021
@akauppi
Copy link
Owner Author

akauppi commented Jul 19, 2022

There still is the strange pause (next.jun22 branch).

$ LOGS_PATH=./logs FUNCTIONS_PORT=5002 docker compose up warm-up --abort-on-container-exit

..seems to start warm-up normally.

$ npm test

# 20s: "backend-warm-up-1 Started"
# 3m17s: tests start
# 3m30s: tests end; success

What goes on within that 3 min?

Once/if solved, reduce start_period in packages/backend/docker-compose.yml and remove a comment there.

Note: This only affects cold starts (all Docker containers are down).

@akauppi
Copy link
Owner Author

akauppi commented Oct 11, 2022

  •  What's the current situation?

@akauppi
Copy link
Owner Author

akauppi commented Nov 9, 2022

The strange behaviour still seems to be there, though the above instructions no longer apply for reproduction.

Looks like a Jest exit timeout. (Jest 29.3.0)

@akauppi
Copy link
Owner Author

akauppi commented Nov 9, 2022

Adding --forceExit to the Jest flags helps. Note that --detectOpenHandles gives no indication what the problematic resources would be. likely keeping the work-around, because it makes for a better initial developer experience.

@akauppi
Copy link
Owner Author

akauppi commented Nov 9, 2022

The Jest issue is this.

Complex. The current gut feeling is, it has to do with firebase-prime and could be counteracted by the snippet in that issue here.

Immediate work-around

Adding --forceExit to the calling of the Jest works, cutting Jest process execution from 1:26s to 15s (measured by time preceding the Jest command). Tempting to leave it ... but solving it within the tests would be nicer!

@akauppi akauppi closed this as completed Nov 9, 2022
akauppi added a commit that referenced this issue Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working packages/back-end Involves the back-end
Projects
None yet
Development

No branches or pull requests

1 participant