Skip to content
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

Mounted dir file's not being sync #1148

Closed
codenoid opened this issue Apr 25, 2024 · 10 comments
Closed

Mounted dir file's not being sync #1148

codenoid opened this issue Apr 25, 2024 · 10 comments
Labels
t/bug Something isn't working
Milestone

Comments

@codenoid
Copy link

Describe the bug

I basically mount a directory contains zerolog's Log file to a fluentbit container

when I see on the host version of the file, It's updated

but when I open fluentbit Directory (via OrbStack GUI), the file is not being sync with the host file

unless...

I close the program on the host that are writing to the file, then orbstack will update the file, and fluentbit will syncronize it

To Reproduce

No response

Expected behavior

the file should be being sync in realtime

Diagnostic report (REQUIRED)

OrbStack info:
Version: 1.5.1
Commit: 4cfac15e1080617c70eb163966e1cb2009dac1c2 (v1.5.1)

System info:
macOS: 14.4 (23E214)
CPU: arm64, 10 cores
CPU model: Apple M1 Max
Model: MacBookPro18,2
Memory: 32 GiB

Full report: https://orbstack.dev/_admin/diag/orbstack-diagreport_2024-04-25T12-35-42.017309Z.zip

Screenshots and additional context (optional)

No response

@codenoid codenoid added the t/bug Something isn't working label Apr 25, 2024
@codenoid codenoid changed the title Mounted dir's File not being sync ? Mounted dir file's not being sync Apr 25, 2024
@codenoid
Copy link
Author

sorry, I just removed OrbStack installation to try using Docker Desktop, and the Docker Desktop is updating the file in Real Time

@kdrag0n
Copy link
Member

kdrag0n commented Apr 26, 2024

Please share a sample project to reproduce this.

@liamja
Copy link

liamja commented May 2, 2024

I faced a similar issue. In my case, I found that a bunch of commands I was running in a container watching for file changes weren't receiving events.

I tested this with inotifywait in a container running under OrbStack and then on Docker Desktop (VirtioFS) using - inotifywait didn't receive any events under OrbStack - but worked as expected in Docker Desktop.

I switched back to Docker Desktop for now and it works.

I'll try and get a sample project to demonstrate.

OrbStack info:
Version: 1.5.1
Commit: 4cfac15e1080617c70eb163966e1cb2009dac1c2 (v1.5.1)

System info:
macOS: 14.4.1 (23E224)
CPU: arm64, 8 cores
CPU model: Apple M1 Pro
Model: MacBookPro18,3
Memory: 32 GiB

Full report: https://orbstack.dev/_admin/diag/orbstack-diagreport_2024-05-02T11-45-05.303485Z.zip

@lieut-data
Copy link

Here's sample reproduction steps. First, run an Alpine container that tails a file in a volume mounted from the host:

docker run --init -v ./:/host alpine:3.19.1 tail -F /host/test.log

Then in the same directory run some tool to generate output, such as:

go run github.com/intuit/go-loadgen@latest random-strings --duration 10 --lines-per-second 1 --line-length 50 --multi-line-percent 0 --line-count 100 --output test.log

In Docker Desktop, the changes stream consistently:

CleanShot 2024-05-13 at 11 36 26

Whereas in OrbStack, the first write or two is detected, after which nothing appears in the volume until the writing process terminates:

CleanShot 2024-05-13 at 11 38 38

@rgasper
Copy link

rgasper commented May 14, 2024

I attempted what @lieut-data demonstrated and I'm unable to replicate the bug there - however I am encountering this issue in my development work containers based on ubuntu and debian quite often. I have webservers that should hot-reload on code changes, and they don't restart on code change as it never gets pulled into the container despite being mounted in a volume.

OrbStack info:
Version: 1.5.1
Commit: 4cfac15e1080617c70eb163966e1cb2009dac1c2 (v1.5.1)

System info:
macOS: 14.1.1 (23B81)
CPU: amd64, 12 cores
CPU model: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Model: MacBookPro16,1
Memory: 32 GiB

@kdrag0n
Copy link
Member

kdrag0n commented May 14, 2024

tail -f not working and hot reload not working are different issues. We can reproduce the former and are working on it, but please share a reproducer so we can look into the latter.

@rgasper
Copy link

rgasper commented May 14, 2024

Okay extremely simple replication using python3: the key problem here seems to be what @codenoid mentioned around "closing the program that writes the file". Using two test scripts, the one where I open/close the file handler around each write successfully syncs into the orbstack-driven container. The one where I leave the file handler open, but use flush() to force writing to disk does not.

Shows volume sync bug:

from time import sleep
with open('test.log', 'a') as fh:
    for s in range(100):
        sleep(0.25)
        fh.write(str(s))
        fh.flush()

Does not show volume sync bug:

for s in range(100):
    with open('test.log', 'a') as fh:
        sleep(0.25)
        fh.write(str(s))
        fh.flush()

Then using

docker run --init -v ./:/host alpine:3.19.1 tail -F /host/test.log

to tail inside the container and

tail -F test.log

outside the container, you can clearly see data synchronizing or not after running python3 test.py

@kdrag0n
Copy link
Member

kdrag0n commented May 14, 2024

Yes, to clarify: we have no trouble reproducing that. It's the hot reload issues that we haven't been able to replicate.

@kdrag0n
Copy link
Member

kdrag0n commented May 17, 2024

tail -f fixed for the next version.

inotify issues are different; please open a new issue with steps to reproduce if you run into them again.

@kdrag0n kdrag0n closed this as completed May 17, 2024
@kdrag0n kdrag0n added this to the v1.6.0 milestone May 17, 2024
@kdrag0n
Copy link
Member

kdrag0n commented May 22, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants