-
Notifications
You must be signed in to change notification settings - Fork 80
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
How does this work? #18
Comments
Hi, Could you please tell me a bit more about your setup? Your OS, shared device, programs you're trying to bridge. |
Oh, I meant that I wanted to write my own program to do this (so I wanted to understand how you got around the synchronization issue), not that yours was broken on my machine. In any case, I'm communicating between a macOS host and a Linux guest running on QEMU. The block device is a ramdisk shared between the two machines. |
Oh cool. Yes synchronization took the most effort. In the end, the key to it was:
I'm sure .NET is also doing a lot of things under the hood for reading and writing the shared file. If there's a particular use case for your macOS / Linux setup that File Tunnel doesn't support, let me know and I might be able to help. Cheers! |
I guess the main issue would be being able to multiplex multiple connections over the same file --- I saw an issue about the same problem, but I don't know if there's been any work on that. |
Also, in my case, I have access to two shared files, but not folders. Will that be enough? |
If it's for the same destination, the program already supports multiplexing multiple connections using the same files. You just need to use For multiple destinations, I'm currently making an update to support SSH-style args: |
Yes the program only accepts files to read & write from. ie. it doesn't create random files in a directory for each connection. |
When you say a file gets "purged", do you mean it gets deleted or resized? In either case, is it possible for File-Tunnel to work on preallocated files of a certain length without changing its length? |
Initially I purged files by deleting - it worked fine but it was slow. I then tried the Truncate operation - that worked well for SMB and NFS but isn't supported by RDP. In the end I settled on resizing (done here). It works well and is much faster. I did implement preallocated files at one point. When the end of the file was reached, the writer would start writing from byte 0. This worked fine 99% of the time, but occasionally the reader would read from the file, only to get content from the previous pass (even though the writer had explicitly cleared it). It was as though the reader was caching, despite args telling it not to. I guess preallocated files could be made reliable, by signaling when commands are "ready", and when commands have been "processed". This could be done using flag bytes as is done for purging here. But it would likely come with a big impact to performance. |
@fiddyschmitt since you mentioned you'd like to support |
Love it! I'll try to implement that too when I get a chance. I'm also considering adding a SOCKS Proxy feature soon - that would also provide dynamic port forwarding. |
Amazing. While socks is awesome in its own right, it still requires that the client tool supports socks proxies, and needs me to configure it to use it. So being able to add some forwards manually dynamically still has value. Good job so far! |
Okay, summary:
|
Back to you @DUOLabs333. Did you want to discuss anything else or are you happy for this issue to be closed? |
No, I guess not --- it would be nice if preallocated files were supported (I'm not sure how well QEMU supports shrinking and growing drives), but it seems that caching can interfere with that use case (and could probably be its own issue). |
Cool. Thanks for the suggestion. |
I use VirtualBox and use a Shared Folder between the host and guest.
In both cases, File Tunnel works fine over the shared folder, including the file resize it does when it reaches 10 MB. I'm sure QEMU would handle it just as well, over virtiofs or 9p. |
Oh, I was planning to share two files with the guest as drives directly --- I found that 9p (macOS hosts don't have support for virtiofs) introduces too much overhead, and is much slower than sharing block devices directly (I'm hoping for a ~8 Gbps link speed). |
Interesting - what is the mechanism QEMU uses to use a host file as a guest drive? |
You just pass a file in with |
The file that gets passed in using |
No, you can just create another file, and just pass that in without formatting it or mounting it. Example:
|
How does it appear to the guest OS, and how do you interact with it in the guest? |
See my edit. The guest can just use this as a normal file. |
Very interesting. There's a few of things to investigate:
|
Yes to all three --- as a test, I allocated a file, shared it, and wrote "hi" to it on the guest. I tried to read from the file on the host and it worked. I tried the same test in reverse (write on host, read on guest), and it also worked. |
So good!! Okay I'll reimplement preallocated files. |
Haha... no --- I'm aiming for high-throughput for my networked GPU driver, and I found that in almost all cases, the network is the bottleneck. I found that 5 Gbps (achieved using a tap device) is almost good enough, so I inferred that a higher link speed will make it even faster. |
Woah!! Very cool! |
To improve throughput, try giving File Tunnel a higher value, such as This increases bandwidth but it comes at the cost of increased latency. |
I switched back to using singular drives (and using the version with preallocation support), but it seems that File-Tunnel has trouble with it --- on the host, I get |
Thanks. I've just uploaded a new version, which will provide us more detail about why SendPump is returning 'Invalid argument' https://github.com/fiddyschmitt/File-Tunnel/releases/tag/v2.2.0_2024-08-16_2315 |
Never mind --- it turns out I was using the stable version by accident on the guest, so it likely tries to wipe the file; however, since it is a drive, QEMU doesn't allow that. Using the proper version gets past that error, but now I just get "offline" on both sides. On the host, I still have the additional message |
Could you please post both ft commands you're running? |
Host: |
Thanks, so |
Yes. |
If I switch to using regular files on the host, I no longer get the "not established" message, but both sides are still offline. |
Hmm try deleting and recreating the files. The stable and experimental builds use the files quite differently, and the existing content could be interfering. |
I zeroed out the files before starting again --- same problem. |
So the experimental build does not work on the 9p shared files, nor the |
Yes, it does not work. |
Okay I'll set up QEMU on my machine tomorrow. Busy all today |
Hey, On my setup (Debian 12 Host, Debian 12 Guest) both I created the VM using
|
Interesting --- it's the same setup I have (except for the virtiofs --- it's not available on macOS). |
I think the reason the UPDATE: Yeah, that's the problem. There's no good way to fix this other than using OS-specific methods. |
Interesting! I'll take a look tonight. |
I switched back to using 9p (it turns out that trying to use drives directly is a recipe for disaster), and it's interesting that the host does notice when the guest attaches/detaches, but the guest can not detect the host. |
Interesting. 9p had high latency for me (800 ms) whereas virtiofs was fine
(5ms). I'll get bandwidth measurements tonight
…On Thu, 22 Aug 2024, 06:50 DUO Labs, ***@***.***> wrote:
I switched back to using 9p (it turns out that trying to use drives
directly is a recipe for disaster), and it's interesting that the host does
notice when the guest attaches/detaches, but the guest can not detect the
host.
—
Reply to this email directly, view it on GitHub
<#18 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADVA3TCZ5QXKW5T6T4DGQOLZST4QJAVCNFSM6AAAAABMGRRNA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBSHE4DSMZWGY>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Sorry I haven't been responding for a while --- I was writing an alternative POC of the same idea (using files to share data). Now that I have a prototype working (though it's slower than plain TCP), I think I know why FT hasn't been working well with macOS <-> Linux --- it was on Linux's side, or more precisely, it was due to my setup. Since I mounted the files as drives in Linux, if a change is made on the drives by QEMU, Linux is not notified that something changed. Therefore, we have to manually notify the OS to check the file/drive for updates with |
Hi @DUOLabs333, I just released v2.2.3 which adjusts how Linux guests read the shared file. If able, could you please give it a try with your setup which wasn't getting sync? Thanks |
Cool! I'll look at this again. |
Running FileTunnel on Linux gives me |
I don't have that issue. What command are you exactly running?
I have just packaged ft for ArchLinux https://aur.archlinux.org/packages/ft-bin |
@YourSandwich I'm running |
Ok, yeah, it cannot read block devices. |
I'm looking to do something similar (communicate over a shared block device), but I couldn't figure out a way to synchronize reads/writes without using an auxiliary communication channel (like an existing TCP connection).
The text was updated successfully, but these errors were encountered: