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

Unexpected error on Windows #17

Open
colinrotherham opened this issue Jan 30, 2024 · 4 comments
Open

Unexpected error on Windows #17

colinrotherham opened this issue Jan 30, 2024 · 4 comments
Assignees

Comments

@colinrotherham
Copy link

colinrotherham commented Jan 30, 2024

Since @prettier/sync introduced make-synchronized we've seen unexpected errors thrown on Windows

This doesn't happen all the time and re-running build steps will temporarily resolve the issue

Hope this is helpful for others

Log output

Here's stack trace we've seen regularly but see more examples in alphagov/govuk-frontend#4695

D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:187
        throw new Error(
              ^

Error: Unexpected error, most likely caused by syntax error in 'D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\worker.mjs'
    at #createWorker (D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:187:15)
    at ThreadsWorker.sendAction (D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:163:40)
    at D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:273:26
    at cacheResult (D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:226:25)
    at cachePathResult (D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:230:52)
    at _Synchronizer.ownKeys (D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:270:12)
    at _Synchronizer.createModule (D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:321:29)
    at makeModuleSynchronized (D:\a\govuk-frontend\govuk-frontend\node_modules\make-synchronized\index.cjs:359:59)
    at createSynchronizedPrettier (D:\a\govuk-frontend\govuk-frontend\node_modules\@prettier\sync\index.cjs:6:10)
    at Object.<anonymous> (D:\a\govuk-frontend\govuk-frontend\node_modules\@prettier\sync\index.cjs:9:18)

Node.js v20.11.0
@fisker
Copy link
Owner

fisker commented Feb 3, 2024

Thanks for reporting this, I tried to

  1. clone the repo
  2. upgrade @prettier/sync to v0.5.0 in packages/govuk-frontend-review/
  3. Run yarn jest --color --coverage=false --maxWorkers=2 --selectProjects "Accessibility tests"

But I can't see any error. Did I do something wrong?

@fisker
Copy link
Owner

fisker commented Feb 3, 2024

After cleaning .cache and run tests on Node.js 20.9.0, still can't get an error.

@colinrotherham
Copy link
Author

colinrotherham commented Feb 5, 2024

Thanks @fisker

Looks like your PR + a few re-runs didn't get the error either today

If we take a look at the GitHub Actions runs that failed last week:

The npm package lines in make-synchronized/index.cjs (compiled from threads-worker.js) throw at:

try {
  lock.lock(1e3);
} catch (error) {
  if (error instanceof atomics_wait_timeout_error_default) {
    throw new Error(
      `Unexpected error, most likely caused by syntax error in '${WORKER_FILE}'`
    );
  }
  throw error;
}

Perhaps on GitHub Actions, under some loads, we're seeing the 1000ms timeout is too slow?

Rather than syntax error

@fisker
Copy link
Owner

fisker commented Feb 6, 2024

Removed that check in #25, you can try @prettier/sync v0.5.1. https://github.com/prettier/prettier-synchronized/releases/tag/v0.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants