fix(ext/net): update moka cache to avoid potential panic in Deno.resolveDns
on some laptops with Ryzen CPU
#27572
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #27534
This PR updates the
moka
crate inCargo.lock
from v0.12.7 to v0.12.10 (by runningcargo update -p moka
). This should prevent potential panic inDeno.resolveDns
on some laptops with Ryzen CPU.No test case, as the changes does not affect the behavior of Deno itself.
Some background information
Deno v2.1.4 started using the
moka
crate via thehickory-resolver
crate. WhenDeno.resolveDns
is called,hickory-resolver
usesmoka
to cache DNS lookup results in memory. However,moka
v0.12.8 or older may panic on some laptops with Ryzen CPUs when using some specific features ofmoka
. Deno v2.1.4 usesmoka
v0.12.7.The latest version of the
moka
crate (v0.12.10) has a fix for this problem.The root cause of the problem is that some laptops with Ryzen CPUs seem to have a problem with the BIOS that causes the TSC (Time Stamp Counter) to become unsynchronized across CPU cores.
moka
depends on thequanta
crate, which uses TSC on x86_64 CPUs to get the current time. If TSC is not synchronized across cores,moka
may panic because of the inconsistency of the time. (The time may jump back a few seconds.)moka
v0.12.10 addressed the problem by makingquanta
crate optional. If thequanta
crate is not used,moka
will usestd::time::Instant
instead of TSC. If thequanta
crate is used,moka
(v0.12.10) only usesquanta
where time accuracy is not critical, and (v0.12.9 or later) uses saturated arithmetic to avoid panic. This PR uses the default of themoka
crate, which is not to use thequanta
crate.Note that I am the creator of
moka
and I do not have such a laptop to reproduce the problem. I received a report from ahickory-resolver
user thatmoka
(v0.12.8) occasionally panics on his laptop with Ryzen CPU. He confirmed that upgradingmoka
to v0.12.9 fixed the problem.Change log of
moka
crate(shows only relevant changes)
https://github.com/moka-rs/moka/blob/main/CHANGELOG.md#version-01210