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

devspace sync uploads unmodified files #1177

Closed
ComaVN opened this issue Sep 17, 2020 · 2 comments
Closed

devspace sync uploads unmodified files #1177

ComaVN opened this issue Sep 17, 2020 · 2 comments
Labels
area/sync Issues related to the real-time code synchronization kind/enhancement Enhancement of an existing feature / improvement

Comments

@ComaVN
Copy link

ComaVN commented Sep 17, 2020

What happened?
When running devspace dev, it starts a container, and immediatly restarts it because the sync process thinks some files have changed and need to be uploaded, even tho the docker image was just built.

The reason seems to be that the file modification time in the docker image differs from the time on the local file system: this is possible, because docker build layer caching actually checks the content of the files: if only the timestamp changed, docker build will just use the cached layer, and that cached layer obviously has the old modification time. Devspace sync then sees the different modification time, and decides to upload the unmodified file anyway.

What did you expect to happen instead?
I expect a freshly built container with the proper excludePaths defined in devspace.yaml to not require an immediate restart when there have been no actual changes to any files.

I expect the sync process to actually check if a file's content has changed before uploading it, and not just look at the file modification time, in the same way that eg. git or the Docker layer caching do this.

How can we reproduce the bug? (as minimally and precisely as possible)
https://github.com/ComaVN/devspace-sync-poc

Local Environment:

  • DevSpace Version: 5.0.3
  • Operating System: Ubuntu 20.04.1 LTS
  • Deployment method: kubectl apply

Kubernetes Cluster:

  • Cloud Provider: DevSpace Cloud
  • Kubernetes Version: client v1.18.8, server v1.18.6

Anything else we need to know?
The main reason this is problematic for us, is because we're re-compiling our golang code (using delve) every time the container (re)starts.

/kind bug

@FabianKramm
Copy link
Collaborator

FabianKramm commented Sep 21, 2020

@ComaVN thanks for reporting this issue! Yes you are right, currently we only compare modification times and file sizes initially to determine which files have changed. We opted to do this, since it is a lot faster than comparing actual content checksums of the files. I think what we could think about is that before a file is actually synced and devspace thinks that its changed, the content checksum is taken of both files and compared again, so that the described problem does not appear anymore.

EDIT: Another option would be to only sync changes initially where the size has changed. This would have the benefit that it is much easier to implement and would solve your problem as well.

@FabianKramm FabianKramm added area/sync Issues related to the real-time code synchronization kind/enhancement Enhancement of an existing feature / improvement labels Sep 21, 2020
@FabianKramm
Copy link
Collaborator

@ComaVN this is implemented in v5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sync Issues related to the real-time code synchronization kind/enhancement Enhancement of an existing feature / improvement
Projects
None yet
Development

No branches or pull requests

2 participants