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

File size of source and destination do not match #125

Open
oguilleux opened this issue Sep 29, 2021 · 19 comments
Open

File size of source and destination do not match #125

oguilleux opened this issue Sep 29, 2021 · 19 comments

Comments

@oguilleux
Copy link

Hi there,

I know this is the free version but this bug might help other people searching for the same error. I get this error on a simple index.php (in uploads directory) while downloading assets locally :

File size of source and destination do not match:
/wp-content/uploads/index.php
Destination size: 0, Local size: 13

I've tried deleting the file but it's logically downloaded again and I still get the error. What am I doing wrong ?

Thanks for your help.

WP v5.8.1
WP Migrate DB Pro v2.1.2
WP Migrate DB Pro Media Files v2.0.3
WP Migrate DB Pro Theme & Plugin Files v1.1.2

@kevinwhoffman
Copy link

Hey @oguilleux, we have a doc for troubleshooting this kind of error available here: https://deliciousbrains.com/wp-migrate-db-pro/doc/theme-plugin-files-errors/

In some instances, there may be a PHP file in the uploads directory, which can cause errors when migrating media files. This often happens when an empty index.php file is used to prevent the web server from listing the contents of the directory (also known as directory listing).
If this happens with media files, or if you have problems with theme and plugin files, try the troubleshooting steps below.

If you go through that doc and still experience the error, please use Help > Email Support to send us diagnostic info so we can look into it further.

@ethanclevenger91
Copy link

ethanclevenger91 commented Nov 5, 2021

@kevinwhoffman Imagify adds a bunch of webp files alongside the original uploads if you have that setting enabled. Could that also cause issues? Running into the same thing but the only PHP file I can find is the one wp-migrate-db creates in the uploads directory.

@kevinwhoffman
Copy link

@ethanclevenger91 We've seen a few different reports of this error from customers, but I've not been able to determine a clear cause. Sometimes the file mentioned is an index.php file but I have also seen other reports mentioning third-party plugin files in the uploads directory. This sounds like it might be the case for you with Imagify.

You should be able to find a record of the error at Tools > Migrate DB Pro > Help. If you are also seeing this error, would you mind copying and pasting it here?

@alexandre-tobia
Copy link

Hi @kevinwhoffman Same error here, but its for png image uploaded through Formidable's form plugin.

Intent: pull
Action: wpmdb_migrate_table
WPMDB Error: File size of source and destination do not match: <br>/Sites/neoen/web/app/uploads/formidable/3/téléchargement-160x250.png<br>Destination size: 0, Local size: 85212

I'm trying to pull the remote site from my local environnement.

I don't know why its happening.

Do you have any idea ?

Thanks a lot

@jefffassnacht
Copy link

Hi @kevinwhoffman I'm seeing this error, too.
Intent: pull Action: wpmdb_migrate_table WPMDB Error: File size of source and destination do not match: <br>/nas/content/live/fernstage/wp-content/uploads/wc-logs/fatal-errors-2022-03-10-037e1f9b8014a5c30506a01f786b50ff.log<br>Destination size: 2455894, Local size: 2454053

@kevinwhoffman
Copy link

kevinwhoffman commented Mar 10, 2022

Hey @jefffassnacht and @alexandre-tobia (apologies for the delayed response), we're still trying to get to the bottom of this. Thanks for sharing the error reports.

Would you also be able to tell us a bit about the server environments for the source and destination? Is this happening between a local and a production site on a specific host, or two local sites, or two production sites on the same server?

We're trying to find some commonality among the reports that might explain the small differences in local and destination sizes. Thanks.

@jefffassnacht
Copy link

@kevinwhoffman Thank you for the quick response. The transfer originates on a staging server, pulling from a production server. Both hosted on WPEngine.

@kevinwhoffman
Copy link

@jefffassnacht Thanks. You're not the first one to report this when both servers are on WP Engine, so we may have found a common thread.

I have a few follow-up questions if you don't mind:

  1. Are you able to migrate the same site to or from a local environment without error? If you don't have a local environment, could you test the migration between another server that's not on WP Engine? This might help us nail down if it's an issue specific to WP Engine.

  2. Do you get the same error with the same file if you try that exact migration again?

  3. If you remove the file mentioned in the error (/nas/content/live/fernstage/wp-content/uploads/wc-logs/fatal-errors-2022-03-10-037e1f9b8014a5c30506a01f786b50ff.log), does that allow the migration to complete successfully on the next try, or does it still fail? This might help us understand if there's something specific about the files that are triggering the error.

@jefffassnacht
Copy link

@kevinwhoffman I'm glad there's a common thread to follow. Here's what I found:

  1. Unfortunately, I can't migrate to or from local right now b/c of where we are in the project. I'll try it as soon as its possible and post here.

  2. Yes, same error with the same file.

  3. I removed the file and got an error for a different .log file in the same directory. Removed that one and pulled successfully - no error.

@kevinwhoffman
Copy link

@jefffassnacht I wanted to follow up with you here since you seem to be our strongest lead on this issue.

Unfortunately, I can't migrate to or from local right now b/c of where we are in the project. I'll try it as soon as its possible and post here.

We're still trying to determine if this error is specific to the server environment, so if you get a chance to test a migration to or from an environment other than WP Engine, please let us know.

I removed the file and got an error for a different .log file in the same directory. Removed that one and pulled successfully - no error.

If you are comfortable sharing the .log files that are triggering the error, then we can take a closer look to see if there is something specifically about those files that is the problem. The best way to do that would be to open a new support ticket within the plugin's Help tab and then reply to that ticket with the logs.

@mike-kelley-fruition
Copy link

I'm also having a similar issue pushing from my local docker environment to a k8's staging environment.

WP Version: 5.9.2
WP Migrate DB Pro v2.2.2
WP Migrate DB Pro Media Files v2.1.0

I'm also seeing these warnings in my logs right as the error show up in the admin:
PHP Warning: fopen(/var/www/html/docroot/app/.82856e09-9e6b-43bd-836d-2e09ed84076b-tmpchunk): failed to open stream: No such file or directory in /var/www/html/docroot/app/plugins/wp-migrate-db-pro/class/Pro/Transfers/Files/Payload.php on line 90, referer: http://localhost/wp/wp-admin/tools.php?page=wp-migrate-db-pro

PHP Warning: stream_copy_to_stream() expects parameter 1 to be resource, bool given in /var/www/html/docroot/app/plugins/wp-migrate-db-pro/class/Pro/Transfers/Files/Payload.php on line 93, referer: http://localhost/wp/wp-admin/tools.php?page=wp-migrate-db-pro

@kevinwhoffman
Copy link

@mike-kelley-fruition Thank you for passing along those warnings. Can you also let me know what error you are seeing in WP Admin when a migration fails?

@mike-kelley-fruition
Copy link

@kevinwhoffman It gets to 1% completed and then says

The Push to [remote site] failed during the Media stage.
File size of source and destination do not match:
/var/www/html/docroot/app/uploads/2022/03/original_Highway_201_20Big_20Sur.jpg
Destination size: 0, Local size: 1661307

@agileware-justin
Copy link

Just chiming in that am seeing the same problem as: File size of source and destination do not match:

Which I guess would be because Migrate DB (Pro) is syncing a production website and files like log files are changing, during the sync. This in turn causes the sync to fail. IMHO the migration process should throw a warning, rather than a fatal error for the file size check. Because for some files it does not matter and logging a warning can be dealt with by other means after the sync process is completed.

@Fidelity88
Copy link

Fidelity88 commented Aug 18, 2022

I've had the same issues. The solution seems to be simple. Add this to your 'exclude files' settings:

*.log
wc-logs/*

My total file looks like this:

.DS_Store
.git
node_modules
*.log
wc-logs/*
wp-content/uploads/wc-logs
wp-content/uploads/wc-logs/*
wp-content/uploads/backup/*

@jefffassnacht
Copy link

jefffassnacht commented Oct 11, 2022 via email

@alexandre-tobia
Copy link

I've had the same issues. The solution seems to be simple. Add this to your 'exclude files' settings:

*.log
wc-logs/*

My total file looks like this:

.DS_Store
.git
node_modules
*.log
wc-logs/*
wp-content/uploads/wc-logs
wp-content/uploads/wc-logs/*
wp-content/uploads/backup/*

Had to do the same with /formidable/ (folder created by Formidable Form when uploading file through form)

@dsuryadi
Copy link

@kevinwhoffman It gets to 1% completed and then says

The Push to [remote site] failed during the Media stage.
File size of source and destination do not match:
/var/www/html/docroot/app/uploads/2022/03/original_Highway_201_20Big_20Sur.jpg
Destination size: 0, Local size: 1661307

I have pretty much the same issue with one JPG. Any solutions so far?

@kevinwhoffman
Copy link

Hi all, I'll try to add a summary of our latest understanding of this issue.

How and why we check the file size in the first place

At the beginning of a migration, files are scanned and the sizes are stored so we know the overall size of that particular stage in the migration (e.g. media_files, theme_files, plugin_files). When an individual file transfer occurs, the size of the file at the destination is compared to the scanned file size at the source to ensure that the entire file arrived safely.

What causes this error

  1. When this error occurs for files such as logs, caches, or other temporary files, then it is usually because the size of the file has actually changed in the time period between the file scanning and the file transfer. For large sites, that time period can be several minutes. For example, if a log is written to during the migration, then the file size after the file transfer will differ from the scanned file size, and the error is thrown.
  2. When this error occurs for media files, we are less certain of the cause because, unlike log files or caches, media files do not typically change between the start of the migration and the file transfer.
    • Destination size: 0 is particularly strange because the file should obviously have a size greater than 0 bytes. When this type of error occurs, please check your server's error log and pass along any relevant info.

Steps we're taking to mitigate the error

  1. When a file size mismatch is detected between the source and destination, we are going to recheck the file size on the spot, thus reducing the elapsed time between the size check and the transfer.
  2. We are also getting more opinionated with our default excludes to ensure that .log files and known cache directories are excluded by default. These files are the most likely to change during a migration but rarely need to be included as they will be regenerated at the destination.

Existing workaround

When the error occurs, excluding the file in question can allow the migration to succeed.

For example, if the error mentions /uploads/2023/12/my-image.jpg, then add my-image.jpg to the Excluded Files list of the Media Uploads panel and start the migration again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants