-
Notifications
You must be signed in to change notification settings - Fork 1.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
fs9p read_file strange behavior (How to detect if ready to read?) #1044
Comments
Did you try run v86/tools/docker/debian/boot-9p Lines 15 to 16 in c69cbd7
|
I have not tried to run sync yet, but I will try that soon. I am currently using the v86/tools/docker/debian to create my image, so I will also try changing
I also write run the line above when initializing my v86 instance, but I'm notsure where I got from. Is it possible that this is causing issues? var emulator = new V86({
screen_container: document.getElementById("screen_container"),
wasm_path: "./libs/v86.wasm",
bios: { url: `${V86_ROOT}/bios/seabios.bin` },
vga_bios: { url: `${V86_ROOT}/bios/vgabios.bin` },
autostart: true,
memory_size: 512 * 1024 * 1024,
vga_memory_size: 8 * 1024 * 1024,
bzimage_initrd_from_filesystem: true,
cmdline: "rw init=/bin/systemd root=host9p console=ttyS0 spectre_v2=off pti=off",
filesystem: {
basefs: {
url: `${V86_ROOT}/images/debian-base-fs.json`,
},
baseurl: `${V86_ROOT}/images/debian-9p-rootfs-flat/`,
},
autostart: true,
});```
|
Sorry for the late reply, that's weird that for you file is opened after 30 seconds, for example, I got maximum 5 seconds timeout on Arch and Buildroot Linux. I have some ideas about This can be checked with:
Probably no, |
I made a mistake in the previous message: 5 seconds = 500 centiseconds, and seems that your value is set to default I wrote a small script to check the availability of a file by time: var testInterval, timer, hasError, filePath;
var test9PFS = function() {
window.emulator.read_file(filePath).catch((e) => {
console.error(`File not available on ${++timer} seconds`);
hasError = true;
}).then(() => {
if (!hasError) {
console.log("File available");
clearInterval(testInterval);
} else {
hasError = false;
}
});
};
var startTest = function() {
testInterval = null, timer = 0, hasError = false, filePath = "/root/testfile";
window.emulator.keyboard_send_text(`echo testdata > ${filePath} # AUTOMATED\n`);
testInterval = setInterval(test9PFS, 1000);
}; First test: all default settings, as you said, there is over 30 seconds timeout. And I had a some attention about vm.dirty_expire_centiseconds, which value is 3000 centiseconds = 30 seconds, https://stackoverflow.com/questions/11884650/small-file-not-committed-to-disk-for-over-a-minute Second test: reduced Third test: remount 9p as sync filesystem (or you can use a Some ideas:
|
I'll close this, as the time the guest OS decides to buffer writes is not related to v86 (but feel free to reopen if you think anything in v86 could be changed). Also, I'd probably accept a PR that changes |
Whenever I create a file in a debian container mountain fs9p, the v86.prototype.read_file function displays some weird behavior.
For the first 30 seconds after a file is created this function doesn't work, it'll return a bad promise
but then after a little bit of waiting the function works fine. I was wondering if there was someway of checking if a file is ready to be read from v86.
Using Chrome's debugger I found the following:
In the fs9p.read_file:
Then in fs9p.Read:
I think this is where the issues occurs, here b and c are both 0 so the empty/null list is copied and returned.
Is there someway I can check if a file is ready for download instead of just setting a timeout to an arbitrary time?
The text was updated successfully, but these errors were encountered: