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

[BUG] Backup fails across mount points #548

Open
j1elo opened this issue Nov 30, 2023 · 1 comment
Open

[BUG] Backup fails across mount points #548

j1elo opened this issue Nov 30, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@j1elo
Copy link

j1elo commented Nov 30, 2023

Describe the bug

The backup feature (backup_storage) fails if the destination path is in a different mount point than the files (e.g. a different Docker bind mount or volume).

This happens because os.Rename as used here is just a call to the renameat syscall, which doesn't allow moving across partitions.

The error is EXDEV, which Go translates into "invalid cross-device link". See os.Rename between different partitions:

You can't "move" a file on different partitions, because you have to copy bytes around. If you want to move or rename a file, you are talking about a file system just pointing to the same bytes, just from a different location. Thus if you get that error you should just copy and delete the file.

Thus I guess the error could be captured and a different move method attempted, kind of

if e, ok := err.(*os.LinkError); ok && e.Err == syscall.EXDEV {
    // Retry with a different way of moving.
}

But as it is right now, such a move will cause the error posted below, regardless of having correct write permissions on the destination path.

Egress Version
https://hub.docker.com/r/livekit/egress/
v1.8.0

Egress Request
N/A

Additional context
/backup_storage/ is a Docker bind-mount to the host system, where recording backups should be stored.

Logs

rename /home/egress/tmp/<file.webm> /backup_storage/<file.webm>: invalid cross-device link
@j1elo j1elo added the bug Something isn't working label Nov 30, 2023
@a-marchenko
Copy link

a-marchenko commented Jan 26, 2024

We ran into a similar problem

It seems worth checking the backup folder on application startup as it is done with cpu cost

2024-01-26T06:04:44.211Z	DEBUG	egress	sink/file.go:72	removing temporary directory	{"nodeID": "NE_cuiBEQs2wyZS", "handlerID": "EGH_KkLSksr5NuNW", "clusterID": "", "egressID": "EG_Fn6z3ZbmtRYf", "path": "/home/egress/tmp/EG_Fn6z3ZbmtRYf/"}

2024-01-26T06:04:44.276Z	WARN	egress	service/handler.go:229	egress failed	{"nodeID": "NE_cuiBEQs2wyZS", "handlerID": "EGH_KkLSksr5NuNW", "clusterID": "", "egressID": "EG_Fn6z3ZbmtRYf", "egressID": "EG_Fn6z3ZbmtRYf", "requestType": "room_composite", "outputType": "file", "error": "rename /home/egress/tmp/EG_Fn6z3ZbmtRYf/2024-01-26T045922.mp4 /stucked/fa5cc19b-6c7e-4f18-95b6-695fc0bc5b1c/2024-01-26T045922.mp4: no such file or directory"}

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

No branches or pull requests

3 participants