-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Cancel file operations from opening an editor when closing it #57585
Comments
@solesensei do you still run into this issue when you run |
@rebornix no, 4096 is okay for huge files, i talk about opening process, i have no needs in opening that file. For me problem is: |
@rebornix |
@solesensei thanks for helping nail down the root cause ;) |
@bpasero may I have some help from your Electron expertise? |
Unluckily I can't reproduce this issue on my Windows box. |
We are reading the file async and not sync so I would think that closing VSCode stops node.js from reading the file but if that is not true the only fix I can see is pushing down a cancellation token all the way (which seems like a workaround for node.js doing the right thing though). |
By reading https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback and IMHO the potential fix is sending const controller = new AbortController();
const signal = controller.signal;
fs.readFile(fileInfo[0].name, { signal }, (err, buf) => {
// ...
});
// When you want to abort the request
controller.abort(); Though I'm not sure if it will really kill the OS process as it's OS dependent. There isn't anything we can do in the text buffer so leave to @bpasero or @deepak1556 to decide if we want to have any fix for it.; |
This requires cancellation support on the level of the //cc @jrieken |
Updated the title from the duplicate #146912. If we could introduce a setting for the maximum file size a user can open, we should use that information here:
To cancel the reading and throw an error so that upstream component can show a generic editor. |
This is a big issue for me because I am creating JSON files that have binary blobs that are large. If I click on the file in Explorer the editor will try to preview the file. There is no way to cancel the process of trying to preview/open the file and VSCode eventually displays a dialog asking if I want to close the editor or continue waiting. I cannot open the Developer Tools or the Process Explorer to terminate the tab that is trying to preview/open the file. I have waited for up to 30 minutes, and the file never finishes and the editor is unusable. It would be nice if I could cancel/abort the preview/open process. |
The setting |
Thank-you. I had already changed that setting to save myself the trouble from this issue, however, I feel that it would be a valuable addition to VSCode to allow for the cancellation of a long running preview/open process. |
this setting doesn't help on custom editors |
Issue Type: Bug
Found a bug.
When you clicked to open huge file, for ex. 1.5 GB txt, and then immediately closed it - VS Code will try to open it anyway, RAM will be overflow, and Studio crashes.
VS Code version: Code 1.26.1 (493869e, 2018-08-16T18:38:57.434Z)
OS version: Windows_NT x64 10.0.17134
The text was updated successfully, but these errors were encountered: