Repository navigation
Fix: NotSameFileSystem at clonefile - #546
Merged
Merged
Conversation
Fixes issue oven-sh#531 Before this, using 'bun install' on a directory in different filesystem such as tmpfs (/tmp) would have caused "Error: NotSameFileSystem". This commit fixes that by handling this error, and at end of function it will fall back to use copyfile (same as --backend=copyfile)
Collaborator
|
I don't think this actually fixes it because the |
Contributor
|
FYI this just broke the build |
Jarred-Sumner
added a commit
that referenced
this pull request
Jul 11, 2022
This reverts commit 2659feb.
Jarred-Sumner
added a commit
that referenced
this pull request
Jul 11, 2022
This was referenced Sep 1, 2026
Jarred-Sumner
added a commit
that referenced
this pull request
Sep 1, 2026
) Stacked on #40987 (WebKit upgrade) and pins WebKit to oven-sh/WebKit `491b5cc236e9` — fork `main` with oven-sh/WebKit#542 / #546 / #547 (MarkedBlock page release, CodeBlock aging that reaches optimized code), #543 / #548 (module loader), #545, #529. ### What `GarbageCollectionController`'s repeating timer (1 s while the heap is changing, 30 s once it isn't) already issues one `collectAsync` per tick and reads `blockBytesAllocated`. This makes that one request a **full** collection on two ticks per quiet period: when the JS heap hasn't grown (by more than 2 MB) for `BUN_IDLE_RELEASE_SECONDS` (default 30; `0` = off; main thread only; not while a debugger is attached), and again 65 s of quiet later. The first also `MADV_PAGEOUT`s a standalone executable's embedded module graph (Linux; clean file-backed pages that fault back on demand; honours `BUN_FEATURE_FLAG_DISABLE_STANDALONE_MADVISE`). One `u32` of state, no new timer, no syscalls or clock reads per tick; when an idle collection is due before the next 30 s tick, that tick is pulled forward. ### Why Full collections are where JSC ages out CodeBlocks that no longer run and releases the memory behind them (WebKit#542/#546). JSC's own `FullGCActivityCallback` is allocation-paced — it fires at most once after the last allocation burst and never again without new allocation — so a process waiting for input never gets there. Two are the minimum with sampled execution counters: the first records which code is still running, the second (a lease later) frees what hasn't run since. ### Numbers Large `--compile --bytecode` TUI app, 100 scripted turns, then 150 s hands-off; same binary, three interleaved pairs: | after 150 s idle | `BUN_IDLE_RELEASE_SECONDS=0` | default | |---|---|---| | RSS | 460 / 477 / 491 MB | **373 / 380 / 365 MB** | With the feature on, RSS is ~400–440 MB after the first idle collection (~50 s) and ~365–380 MB after the second (~110 s); JIT memory 45 → ~14 MB. Cost while busy: none. Cost while idle: two concurrent full GCs per quiet period. ### Tests `test/js/bun/gc/gc-controller-cadence.test.ts`: with `BUN_JSC_logGC=1`, a `FullCollection` appears while a script sits idle with `BUN_IDLE_RELEASE_SECONDS=2`, and none with `=0`. --------- Co-authored-by: robobun <117481402+robobun@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #531
Before this, using 'bun install' on a directory in different filesystem
such as tmpfs (/tmp) would have caused "Error: NotSameFileSystem".
This commit fixes that by handling this error, and at end of function it
will fall back to use copyfile (same as --backend=copyfile).
The discussion is in #531 (comment).
Credit due to @Beamnawap, who suggested me about --backend=copyfile as a fix.