You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discovered by @ehuss in rust-lang/cargo#10120, a Cargo test is intermittently failing on Windows because a source file generated by Rustdoc is not being written before the process exits. The suspected issue is that Rustdoc spawns asynchronous writes here:
panic!("failed to send error on \"{}\"", path.display())
})
});
});
However, Rustdoc never checks that the writes are completed. We should add a mechanism that prevents the process from exiting before these write tasks are completed.
One possible solution:
Add a field outstanding_writes: Arc<AtomicUsize> to DocFS.
Increment outstanding_writes at the start of DocFS::write, and decrement at the end of the spawned Rayon task.
Add a method DocFS::wait_for_outstanding_writes(&self) that spin-loops until outstanding_writes is zero. (Alternatively: use a condition variable, and have write notify the condvar when outstanding_writes is decremented.)
Either call wait_for_outstanding_writes explicitly in the end of the Rustdoc process, or add it as a Drop implementation to DocFS.
…t-for-write, r=notriddle
rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets
Fixesrust-lang#109060.
Switching to `threadpool` makes it a bit simpler for us to wait for all tasks in `DocFS` directly in the `Drop` implementation. I'm also curious if making all the writes into a thread pool could improve run time for rustdoc on all other platforms than Windows as well.
I'll run a perf check to see.
cc `@ehuss`
r? `@notriddle`
…t-for-write, r=notriddle
rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets
Fixesrust-lang#109060.
Switching to `threadpool` makes it a bit simpler for us to wait for all tasks in `DocFS` directly in the `Drop` implementation. I'm also curious if making all the writes into a thread pool could improve run time for rustdoc on all other platforms than Windows as well.
I'll run a perf check to see.
cc ``@ehuss``
r? ``@notriddle``
As discovered by @ehuss in rust-lang/cargo#10120, a Cargo test is intermittently failing on Windows because a source file generated by Rustdoc is not being written before the process exits. The suspected issue is that Rustdoc spawns asynchronous writes here:
rust/src/librustdoc/docfs.rs
Lines 62 to 68 in f41927f
However, Rustdoc never checks that the writes are completed. We should add a mechanism that prevents the process from exiting before these write tasks are completed.
One possible solution:
outstanding_writes: Arc<AtomicUsize>
toDocFS
.outstanding_writes
at the start ofDocFS::write
, and decrement at the end of the spawned Rayon task.DocFS::wait_for_outstanding_writes(&self)
that spin-loops untiloutstanding_writes
is zero. (Alternatively: use a condition variable, and havewrite
notify the condvar whenoutstanding_writes
is decremented.)wait_for_outstanding_writes
explicitly in the end of the Rustdoc process, or add it as aDrop
implementation toDocFS
.cc @GuillaumeGomez
The text was updated successfully, but these errors were encountered: