Skip to content

SyncFileSystem does not throw when accessing a removed file that has been accessed in an effect/memo/resource #794

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

Open
bigmistqke opened this issue Jun 3, 2025 · 1 comment · May be fixed by #796

Comments

@bigmistqke
Copy link
Contributor

Describe the bug

Given the following testing setup:

const fs = createSyncFileSystem(makeVirtualFileSystem());
fs.writeFile("index.html", "hallo");
fs.writeFile("index2.html", "hallo");

createEffect(() => fs.readFile("index.html"));

test("index.html");
test("index2.html");

function test(path: string){
  try {
    fs.rm(path)
    const result = fs.readFile(path);
    console.error(`FAILURE ${path}: Expected throw but received "${result}"`);
  } catch (error) {
    console.log(`SUCCESS ${path}`);
  }
}

Currently

  • the test for index.html will fail, because it received "hallo" from fs.readFile
  • the test for index2.html will succeed, because fs.readFile threw

Reading the file in an effect seems to cause the file to not be cleaned up when being removed.

Minimal Reproduction Link

https://playground.solidjs.com/anonymous/a4c5374f-9432-4ec1-bf37-e65888e54a8f

@atk
Copy link
Member

atk commented Jun 3, 2025

I currently assume that we keep the data signal in the effect's closure, thus readfile expects it to be there. We need to set the signal to undefined before we drop it from the set.

Update: preparing a fix, but I'm a bit busy right now, so it'll take some time.

@atk atk linked a pull request Jun 4, 2025 that will close this issue
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 a pull request may close this issue.

2 participants