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

use a lock to ensure atomic invalidation from file changes #5461

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

sokra
Copy link
Member

@sokra sokra commented Jul 5, 2023

Description

fixes "app_dir must be a directory" error

Co-authored-by: Alex Kirszenberg <alexkirsz@users.noreply.github.com>
@sokra sokra requested a review from a team as a code owner July 5, 2023 10:23
@vercel
Copy link

vercel bot commented Jul 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-vite-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 5, 2023 1:17pm
10 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Jul 5, 2023 1:17pm
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2023 1:17pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2023 1:17pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2023 1:17pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2023 1:17pm
examples-native-web ⬜️ Ignored (Inspect) Jul 5, 2023 1:17pm
examples-nonmonorepo ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2023 1:17pm
examples-svelte-web ⬜️ Ignored (Inspect) Jul 5, 2023 1:17pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2023 1:17pm
turbo-site ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2023 1:17pm

@sokra sokra requested a review from alexkirsz July 5, 2023 10:23
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

✅ This change can build next-swc

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

Linux Benchmark for 2b0ed98

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 7583.81µs ± 54.15µs 7463.33µs ± 183.01µs -1.59%
bench_hmr_to_eval/Turbopack CSR/1000 modules 6559.14µs ± 63.04µs 6867.95µs ± 269.22µs +4.71%
bench_startup/Turbopack CSR/1000 modules 923.22ms ± 1.58ms 928.30ms ± 3.86ms +0.55%

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

MacOS Benchmark for 2b0ed98

Test Base PR % Significant %
bench_hmr_to_eval/Turbopack CSR/1000 modules 26.61ms ± 0.55ms 24.30ms ± 0.45ms -8.69% -1.27%
bench_startup/Turbopack CSR/1000 modules 3552.34ms ± 70.54ms 15.50s ± 2.34s +336.26% +192.70%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 28.16ms ± 0.21ms 28.28ms ± 0.11ms +0.45%
bench_hmr_to_eval/Turbopack CSR/1000 modules 26.61ms ± 0.55ms 24.30ms ± 0.45ms -8.69% -1.27%
bench_startup/Turbopack CSR/1000 modules 3552.34ms ± 70.54ms 15.50s ± 2.34s +336.26% +192.70%

/// watcher invalidation and a read lock during other operations.
#[turbo_tasks(debug_ignore, trace_ignore)]
#[serde(skip)]
invalidation_lock: Arc<RwLock<()>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels wrong that this should be a lock on (). Can we use the type system to ensure we can't do this wrong instead? e.g. by having this lock condition access to the other locks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're suggesting that we have RwLock<InvalidatorMap>? Which I was going to suggest, too.

Co-authored-by: Alex Kirszenberg <alexkirsz@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

Linux Benchmark for 4b74b2a

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.65ms ± 0.04ms 11.76ms ± 0.08ms +0.96%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.71ms ± 0.07ms 11.57ms ± 0.70ms +8.05%
bench_startup/Turbopack CSR/1000 modules 1149.82ms ± 5.99ms 1144.18ms ± 4.46ms -0.49%

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

MacOS Benchmark for 4b74b2a

Test Base PR % Significant %
bench_hmr_to_eval/Turbopack CSR/1000 modules 27.92ms ± 0.19ms 22.95ms ± 1.14ms -17.80% -8.37%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 27.81ms ± 0.18ms 27.47ms ± 0.06ms -1.21%
bench_hmr_to_eval/Turbopack CSR/1000 modules 27.92ms ± 0.19ms 22.95ms ± 1.14ms -17.80% -8.37%
bench_startup/Turbopack CSR/1000 modules 4189.13ms ± 145.00ms 4260.65ms ± 124.55ms +1.71%

@sokra sokra requested a review from alexkirsz July 5, 2023 15:00
@sokra sokra enabled auto-merge (squash) July 5, 2023 15:00
@sokra sokra merged commit ed9a5c6 into main Jul 6, 2023
46 of 48 checks passed
@sokra sokra deleted the sokra-alex/atomic-watch-invalidation branch July 6, 2023 08:21
feedthejim pushed a commit to vercel/next.js that referenced this pull request Jul 6, 2023
Depends on vercel/turbo#5398 (and downstack) on
the Turbo side.

This PR makes it so the output path of Node.js entry chunks for pages is
determined solely from the pathname. This isn't actually necessary for
pages, but it makes for easier debugging anyway. See the Turbo PR for
more details.

This also changes the page structure so it also works if there is no
`pages` directory. In this case, we still want to use pages' default
_app, _document, and _error pages, even with existing app routes. So an
empty page structure should still have an effect.

## Turbopack updates

* vercel/turbo#5415 <!-- Will Binns-Smith -
Turbopack: Execution tests in node.js -->
* vercel/turbo#5461 <!-- Tobias Koppers - use a
lock to ensure atomic invalidation from file changes -->
* vercel/turbo#5398 <!-- Alex Kirszenberg -
Configure the path of the Node.js entry chunk -->
* vercel/turbo#5469 <!-- Tobias Koppers - allow
hmr tests to correctly detect hmr event -->
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

Successfully merging this pull request may close these issues.

None yet

3 participants