Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
ee1ec67c
Commit
ee1ec67c
authored
Sep 11, 2025
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reapply "Another approach"
This reverts commit
0afed19c
.
parent
0afed19c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
17 deletions
+33
-17
generated-native.d.ts
packages/next/src/build/swc/generated-native.d.ts
+0
-6
next-rs-api.test.ts
test/development/basic/next-rs-api.test.ts
+1
-1
mod.rs
turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
+23
-10
storage.rs
turbopack/crates/turbo-tasks-backend/src/backend/storage.rs
+9
-0
No files found.
packages/next/src/build/swc/generated-native.d.ts
View file @
ee1ec67c
...
@@ -34,12 +34,6 @@ export declare class ExternalObject<T> {
...
@@ -34,12 +34,6 @@ export declare class ExternalObject<T> {
[
K
:
symbol
]:
T
[
K
:
symbol
]:
T
}
}
}
}
export
interface
TransformOutput
{
code
:
string
map
?:
string
output
?:
string
diagnostics
:
Array
<
string
>
}
export
declare
function
mdxCompile
(
export
declare
function
mdxCompile
(
value
:
string
,
value
:
string
,
option
:
Buffer
,
option
:
Buffer
,
...
...
test/development/basic/next-rs-api.test.ts
View file @
ee1ec67c
...
@@ -236,7 +236,7 @@ describe('next.rs api writeToDisk multiple times', () => {
...
@@ -236,7 +236,7 @@ describe('next.rs api writeToDisk multiple times', () => {
const route = entrypoints.routes.get('/app-nodejs')
const route = entrypoints.routes.get('/app-nodejs')
if (route.type === 'app-page') {
if (route.type === 'app-page') {
for (let i = 0; i <
100
; i++) {
for (let i = 0; i <
Infinity
; i++) {
console.log(i)
console.log(i)
await route.pages[0].htmlEndpoint.writeToDisk()
await route.pages[0].htmlEndpoint.writeToDisk()
}
}
...
...
turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
View file @
ee1ec67c
...
@@ -2022,7 +2022,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
...
@@ -2022,7 +2022,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
};
};
let
InProgressState
::
InProgress
(
box
InProgressStateInner
{
let
InProgressState
::
InProgress
(
box
InProgressStateInner
{
done_event
,
done_event
,
once_task
,
once_task
:
_
,
stale
,
stale
,
session_dependent
,
session_dependent
,
done
:
_
,
done
:
_
,
...
@@ -2138,15 +2138,6 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
...
@@ -2138,15 +2138,6 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
task
.shrink_to_fit
(
CachedDataItemType
::
CollectiblesDependency
);
task
.shrink_to_fit
(
CachedDataItemType
::
CollectiblesDependency
);
drop
(
task
);
drop
(
task
);
// ✅ ADD: Remove Once tasks from transient_tasks after completion
if
once_task
&&
!
stale
{
self
.transient_tasks
.remove
(
&
task_id
);
// CRITICAL: Return the task ID to the factory for reuse
unsafe
{
self
.transient_task_id_factory
.reuse
(
task_id
);
}
}
false
false
}
}
...
@@ -2575,6 +2566,12 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
...
@@ -2575,6 +2566,12 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
let
mut
ctx
=
self
.execute_context
(
turbo_tasks
);
let
mut
ctx
=
self
.execute_context
(
turbo_tasks
);
let
mut
task
=
ctx
.task
(
task_id
,
TaskDataCategory
::
All
);
let
mut
task
=
ctx
.task
(
task_id
,
TaskDataCategory
::
All
);
// Check if this is a Once task by examining the root type
let
is_once_task
=
get!
(
task
,
Activeness
)
.map
(|
activeness
|
matches!
(
activeness
.root_ty
,
Some
(
RootType
::
OnceTask
)))
.unwrap_or
(
false
);
let
is_dirty
=
get!
(
task
,
Dirty
)
.map_or
(
false
,
|
dirty
|
dirty
.get
(
self
.session_id
));
let
is_dirty
=
get!
(
task
,
Dirty
)
.map_or
(
false
,
|
dirty
|
dirty
.get
(
self
.session_id
));
let
has_dirty_containers
=
get!
(
task
,
AggregatedDirtyContainerCount
)
let
has_dirty_containers
=
get!
(
task
,
AggregatedDirtyContainerCount
)
.map_or
(
false
,
|
dirty_containers
|
{
.map_or
(
false
,
|
dirty_containers
|
{
...
@@ -2591,6 +2588,22 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
...
@@ -2591,6 +2588,22 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
// we notify it anyway
// we notify it anyway
activeness_state
.all_clean_event
.notify
(
usize
::
MAX
);
activeness_state
.all_clean_event
.notify
(
usize
::
MAX
);
}
}
// ✅ PROPER FIX: Once tasks should be completely cleaned up when disposed
if
is_once_task
{
// Drop the task and context to release locks before cleanup
drop
(
task
);
drop
(
ctx
);
// Remove from transient_tasks tracking
self
.transient_tasks
.remove
(
&
task_id
);
// Completely remove all storage data for this task
self
.storage
.remove_task
(
task_id
);
// Return the task ID to the factory for reuse
unsafe
{
self
.transient_task_id_factory
.reuse
(
task_id
);
}
}
}
}
#[cfg(feature
=
"verify_aggregation_graph"
)]
#[cfg(feature
=
"verify_aggregation_graph"
)]
...
...
turbopack/crates/turbo-tasks-backend/src/backend/storage.rs
View file @
ee1ec67c
...
@@ -812,6 +812,15 @@ impl Storage {
...
@@ -812,6 +812,15 @@ impl Storage {
)
)
}
}
/// Completely removes a task from storage, including all its data and metadata.
/// This should only be called for tasks that are guaranteed to never be accessed again.
pub
fn
remove_task
(
&
self
,
task_id
:
TaskId
)
{
// Remove from the main storage map
self
.map
.remove
(
&
task_id
);
// Remove from the modified tracking
self
.modified
.remove
(
&
task_id
);
}
pub
fn
drop_contents
(
&
self
)
{
pub
fn
drop_contents
(
&
self
)
{
drop_contents
(
&
self
.map
);
drop_contents
(
&
self
.map
);
drop_contents
(
&
self
.modified
);
drop_contents
(
&
self
.modified
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment