ShareX / ShareX

ShareX is a free and open source program that lets you capture or record any area of your screen and share it with a single press of a key. It also allows uploading images, text or other types of files to many supported destinations you can choose from.
https://getsharex.com
GNU General Public License v3.0
28.28k stars 3.11k forks source link

FTP uploads images partly #1383

Closed pilovali closed 8 years ago

pilovali commented 8 years ago

Sometimes when I upload an image via FTP to my own server, it only uploads the image partly. Sometimes only 30% or 80% of the image gets uploaded. I tried different FTP servers (proFTPd and FileZilla server), both have the issue.

It's really random and I'm unable to reproduce it. After a few attempts, it uploads correctly.

Jaex commented 8 years ago

ShareX have FTP support for very long time and only two person reported this issue. So I'm not sure what causing it. Also it is not certain is ShareX causing this or not. Because problem could be to do with FTP library.

pilovali commented 8 years ago

I didn't had this issue in the beginning. Do you have somewhere a list with older versions?

Jaex commented 8 years ago

https://github.com/ShareX/ShareX/releases

FrozenHaxor commented 8 years ago

I'm having exactly the same problem, it must be a recent change, never had this issue before. If I attempt to upload a larger screenshot that's almost the size of my entire screen, only 8640 bytes of it get uploaded. Sometimes more. Sometimes it actually will upload the image, but it's rare.

Jaex commented 8 years ago

FTP codes for years nearly not changed at all. So I'm not sure how it can be recent issue.

FrozenHaxor commented 8 years ago

I'm fairly sure something must have had been changed recently which is affecting the FTP uploads, I've been using this feature since 2013 but this problem only appeared just now. First time I've got a corrupt picture upload was 23.02.2016 and all the corrupted pictures were exactly 8640 bytes of size. Here's an example of one: http://frozenhaxor.pl/fh_as/D2016-02-23_T19-17-21.png

I have 534 screenshots total on my server, never had any problems before.

vtexperts commented 8 years ago

Having the same issue, had it for about a month now. Start happened after the update about a month ago. I believe it was the same update that started adding window name to my file name, earlier I only had date-time.png, but now I have windowname-date-time.png.

it's very annoying because there's no indication that it failed

pilovali commented 8 years ago

I've reinstalled my computer with a clean Windows 10 Pro installation, and only the drivers, Chrome, Skype and ShareX are installed and I still have the same issue. I haven't tried an older version, because I'm afraid I'll lose my configs.

campbeb commented 8 years ago

@pilovali Can you provide the logs from your ftp server (preferably FileZilla)? Either what is displayed in the interface program or the log file (they are the same)

campbeb commented 8 years ago

@vtexperts Can you provide logs from your ftp server and ShareX? And what type of capture are you doing?

pilovali commented 8 years ago

I'm doing a screencapture. Here is the log from ShareX: 2016-03-15 14:42:13.590 - Hotkey triggered: Hotkey: Ctrl + Print Screen, Description: Capture region, Job: RectangleRegion 2016-03-15 14:42:13.591 - Executing: Capture region 2016-03-15 14:42:16.031 - Task in queue. Job: Job, Type: File, Host: FTP 2016-03-15 14:42:16.032 - Task status: Preparing 2016-03-15 14:42:16.890 - Image copied to clipboard. 2016-03-15 14:42:16.902 - Image saved to file: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\4P49M8.png 2016-03-15 14:42:16.903 - Upload started. Filename: 4P49M8.png, Filepath: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\4P49M8.png 2016-03-15 14:42:17.660 - Task completed. Filename: 4P49M8.png, URL: https://share.pilovali.nl/4P49M8.png, Duration: 1628 ms 2016-03-15 14:42:18.217 - URL opened: https://share.pilovali.nl/4P49M8.png

And here from the FTP server: 45.32.***.*** - ftp1xxxx [15/Mar/2016:14:42:17 +0100] "PUT /var/www/clients/client1/web24/web/4P49M8.png" 200 16272

I'm using Pure-FTPd as FTP server. I used FileZilla server before, but that didn't worked either.

campbeb commented 8 years ago

@pilovali Can you enable verbose logging in your ftp server (http://serverfault.com/questions/454611/how-to-log-what-an-ftp-user-does-with-pure-ftpd-and-apache)? Also, it would be more helpful if the logs are from when it doesn't work.

pilovali commented 8 years ago

@campbeb verbose logging is enabled, I'll let you know when an image fails to upload, and I'll post the log here.

pilovali commented 8 years ago

@campbeb Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [INFO] New connection from 45.32.239.xxx Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [DEBUG] Command [user] [ftp1share] Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [DEBUG] Command [pass] [<*>] Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [INFO] ftp1share is now logged in Mar 15 19:16:45 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [feat] [] Mar 15 19:16:45 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [opts] [UTF8 ON] Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [INFO] New connection from 45.32.239.xxx Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [DEBUG] Command [user] [ftp1share] Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [DEBUG] Command [pass] [<*>] Mar 15 19:16:45 s3 pure-ftpd: (?@45.32.239.xxx) [INFO] ftp1share is now logged in Mar 15 19:16:45 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [opts] [UTF8 ON] Mar 15 19:16:45 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [pwd] [] Mar 15 19:16:45 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [cwd] [/] Mar 15 19:16:45 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [type] [I] Mar 15 19:16:46 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [size] [/web/8Uc8k5.png] Mar 15 19:16:46 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [epsv] [] Mar 15 19:16:46 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [pasv] [] Mar 15 19:16:46 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [stor] [/web/8Uc8k5.png] Mar 15 19:16:46 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [NOTICE] /var/www/clients/client1/web24//web/8Uc8k5.png uploaded (109256 bytes, 305.85KB/sec) Mar 15 19:16:46 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [DEBUG] Command [quit] [] Mar 15 19:16:46 s3 pure-ftpd: (ftp1share@45.32.239.xxx) [INFO] Logout.

campbeb commented 8 years ago

@pilovali That is a failure? The image appears to have uploaded successfully (I can see it on the server)

pilovali commented 8 years ago

@campbeb No, excuse me, this transfer failed: Mar 15 19:22:06 s3 pure-ftpd: (?@195.240.4.xxx) [INFO] New connection from 195.240.4.xxx Mar 15 19:22:06 s3 pure-ftpd: (?@195.240.4.xxx) [DEBUG] Command [user] [ftp1share] Mar 15 19:22:06 s3 pure-ftpd: (?@195.240.4.xxx) [DEBUG] Command [pass] [<*>] Mar 15 19:22:06 s3 pure-ftpd: (?@195.240.4.xxx) [INFO] ftp1share is now logged in Mar 15 19:22:06 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [feat] [] Mar 15 19:22:06 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [opts] [UTF8 ON] Mar 15 19:22:06 s3 pure-ftpd: (?@195.240.4.xxx) [INFO] New connection from 195.240.4.xxx Mar 15 19:22:06 s3 pure-ftpd: (?@195.240.4.xxx) [DEBUG] Command [user] [ftp1share] Mar 15 19:22:07 s3 pure-ftpd: (?@195.240.4.xxx) [DEBUG] Command [pass] [<*>] Mar 15 19:22:07 s3 pure-ftpd: (?@195.240.4.xxx) [INFO] ftp1share is now logged in Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [opts] [UTF8 ON] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [pwd] [] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [cwd] [/] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [type] [I] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [size] [/web/9vc4h1.png] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [epsv] [] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [pasv] [] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [stor] [/web/9vc4h1.png] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [DEBUG] Command [quit] [] Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [INFO] Logout. Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [NOTICE] /var/www/clients/client1/web24//web/9vc4h1.png uploaded (29200 bytes, 192.72KB/sec) Mar 15 19:22:07 s3 pure-ftpd: (ftp1share@195.240.4.xxx) [INFO] Logout. Take a look at https://share.pilovali.nl/9vc4h1.png The original file is 30483 bytes, and only 29200 bytes gets uploaded.

campbeb commented 8 years ago

@pilovali Unfortunately, everything seems ok there. Would you be willing to try a version of ShareX I compiled that has more debug statements? https://github.com/campbeb/ShareX/blob/logDataTransfer/ShareXDebug.zip Or you can checkout that branch and compile it yourself.

Provide your ShareX log file when you next find the errors. The new statements I'm looking for look like:

2016-03-15 15:40:40.523 - Task in queue. Job: FileUpload, Type: File, Host: FTP
2016-03-15 15:40:40.528 - Task status: Preparing
2016-03-15 15:40:40.539 - Upload started. Filename: Picture1.jpg, Filepath: C:\***\Pictures\Picture1.jpg
2016-03-15 15:40:40.636 - Before transfer, Ftp client connected? True
2016-03-15 15:40:40.643 - 1: Read 32768 bytes
2016-03-15 15:40:40.649 - After transfer, Ftp client connected? True
2016-03-15 15:40:40.656 - Preparing to transfer 58969 bytes
2016-03-15 15:40:40.663 - After transfer directory /
2016-03-15 15:40:40.669 - 2: Read 26201 bytes
2016-03-15 15:40:40.674 - 3: Read 0 bytes
2016-03-15 15:40:40.681 - Task completed. Filename: Picture1.jpg, URL: https://*/2016/03/Picture1.jpg, Duration: 119 ms
pilovali commented 8 years ago

@campbeb Sure, will do. I'll keep you informed.

pilovali commented 8 years ago

I tested it a few times, and it failed. 2016-03-15 21:00:42.044 - Hotkey triggered: Hotkey: Print Screen, Description: Capture entire screen, Job: PrintScreen 2016-03-15 21:00:42.046 - Executing: Capture entire screen 2016-03-15 21:00:42.088 - Task in queue. Job: Job, Type: File, Host: FTP 2016-03-15 21:00:42.089 - Task status: Preparing 2016-03-15 21:00:43.773 - Image copied to clipboard. 2016-03-15 21:00:43.813 - Image saved to file: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\7q13ne.png 2016-03-15 21:00:43.814 - Upload started. Filename: 7q13ne.png, Filepath: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\7q13ne.png 2016-03-15 21:00:44.590 - Before transfer, Ftp client connected? True 2016-03-15 21:00:44.591 - 2: Read 32768 bytes 2016-03-15 21:00:44.591 - 1: Read 32768 bytes 2016-03-15 21:00:44.592 - 3: Read 32768 bytes 2016-03-15 21:00:44.593 - Preparing to transfer 481535 bytes 2016-03-15 21:00:44.738 - 4: Read 32768 bytes 2016-03-15 21:00:44.805 - 5: Read 32768 bytes 2016-03-15 21:00:44.875 - 6: Read 32768 bytes 2016-03-15 21:00:44.875 - 7: Read 32768 bytes 2016-03-15 21:00:44.876 - 8: Read 32768 bytes 2016-03-15 21:00:44.941 - 9: Read 32768 bytes 2016-03-15 21:00:45.007 - 10: Read 32768 bytes 2016-03-15 21:00:45.083 - 11: Read 32768 bytes 2016-03-15 21:00:45.291 - 12: Read 32768 bytes 2016-03-15 21:00:45.642 - 13: Read 32768 bytes 2016-03-15 21:00:45.672 - 14: Read 32768 bytes 2016-03-15 21:00:45.777 - 15: Read 22783 bytes 2016-03-15 21:00:45.847 - 16: Read 0 bytes 2016-03-15 21:00:45.885 - After transfer directory / 2016-03-15 21:00:45.886 - After transfer, Ftp client connected? True 2016-03-15 21:00:45.932 - Task completed. Filename: 7q13ne.png, URL: https://share.pilovali.nl/7q13ne.png, Duration: 3840 ms 2016-03-15 21:00:46.447 - URL opened: https://share.pilovali.nl/7q13ne.png

pilovali commented 8 years ago

For comparison, this is one that didn't fail: 2016-03-15 21:06:07.935 - Hotkey triggered: Hotkey: Ctrl + Print Screen, Description: Capture region, Job: RectangleRegion 2016-03-15 21:06:07.937 - Executing: Capture region 2016-03-15 21:06:10.909 - Task in queue. Job: Job, Type: File, Host: FTP 2016-03-15 21:06:10.910 - Task status: Preparing 2016-03-15 21:06:12.233 - Image copied to clipboard. 2016-03-15 21:06:12.263 - Image saved to file: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\9o65Bd.png 2016-03-15 21:06:12.264 - Upload started. Filename: 9o65Bd.png, Filepath: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\9o65Bd.png 2016-03-15 21:06:13.134 - Preparing to transfer 468322 bytes 2016-03-15 21:06:13.134 - 3: Read 32768 bytes 2016-03-15 21:06:13.135 - Before transfer, Ftp client connected? True 2016-03-15 21:06:13.135 - 2: Read 32768 bytes 2016-03-15 21:06:13.136 - 1: Read 32768 bytes 2016-03-15 21:06:13.279 - 4: Read 32768 bytes 2016-03-15 21:06:13.344 - 5: Read 32768 bytes 2016-03-15 21:06:13.413 - 6: Read 32768 bytes 2016-03-15 21:06:13.413 - 8: Read 32768 bytes 2016-03-15 21:06:13.414 - 7: Read 32768 bytes 2016-03-15 21:06:13.485 - 9: Read 32768 bytes 2016-03-15 21:06:13.548 - 10: Read 32768 bytes 2016-03-15 21:06:13.793 - 11: Read 32768 bytes 2016-03-15 21:06:13.794 - 14: Read 32768 bytes 2016-03-15 21:06:13.794 - 15: Read 9570 bytes 2016-03-15 21:06:13.795 - 12: Read 32768 bytes 2016-03-15 21:06:13.796 - 13: Read 32768 bytes 2016-03-15 21:06:14.159 - 16: Read 0 bytes 2016-03-15 21:06:14.284 - After transfer directory / 2016-03-15 21:06:14.285 - After transfer, Ftp client connected? True 2016-03-15 21:06:14.416 - Task completed. Filename: 9o65Bd.png, URL: https://share.pilovali.nl/9o65Bd.png, Duration: 3505 ms 2016-03-15 21:06:15.149 - URL opened: https://share.pilovali.nl/9o65Bd.png

I've noticed that the failed one, starts to read the file too late. See: https://share.pilovali.nl/5M040d.png And this is a successful one: https://share.pilovali.nl/3Aa1w5.png

campbeb commented 8 years ago

@pilovali Unfortunately the logs didn't show a problem. The data was read from the file and server didn't disconnect or give any errors. I updated the zip file to check the file size on the server when completed and to check how many bytes we sent the server. Can you download and try again?

Also, the log file isn't always written in order (It is designed to be fast, not in correct order). I changed that setting in the new zip file.

pilovali commented 8 years ago

Here you go: Failed one:

2016-03-15 21:24:30.576 - Hotkey triggered: Hotkey: Print Screen, Description: Capture entire screen, Job: PrintScreen
2016-03-15 21:24:30.577 - Executing: Capture entire screen
2016-03-15 21:24:30.616 - Task in queue. Job: Job, Type: File, Host: FTP
2016-03-15 21:24:30.617 - Task status: Preparing
2016-03-15 21:24:31.855 - Image copied to clipboard.
2016-03-15 21:24:31.906 - Image saved to file: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\3044l5.png
2016-03-15 21:24:31.907 - Upload started. Filename: 3044l5.png, Filepath: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\3044l5.png
2016-03-15 21:24:32.685 - Before transfer, Ftp client connected? True
2016-03-15 21:24:32.686 - Preparing to transfer 526013 bytes
2016-03-15 21:24:32.686 - 1: Read 32768 bytes
2016-03-15 21:24:32.687 - 2: Read 32768 bytes
2016-03-15 21:24:32.687 - 3: Read 32768 bytes
2016-03-15 21:24:32.830 - 4: Read 32768 bytes
2016-03-15 21:24:32.896 - 5: Read 32768 bytes
2016-03-15 21:24:32.966 - 6: Read 32768 bytes
2016-03-15 21:24:32.966 - 7: Read 32768 bytes
2016-03-15 21:24:32.967 - 8: Read 32768 bytes
2016-03-15 21:24:33.035 - 9: Read 32768 bytes
2016-03-15 21:24:33.100 - 10: Read 32768 bytes
2016-03-15 21:24:33.169 - 11: Read 32768 bytes
2016-03-15 21:24:33.169 - 12: Read 32768 bytes
2016-03-15 21:24:33.170 - 13: Read 32768 bytes
2016-03-15 21:24:33.170 - 14: Read 32768 bytes
2016-03-15 21:24:33.170 - 15: Read 32768 bytes
2016-03-15 21:24:33.717 - 16: Read 32768 bytes
2016-03-15 21:24:33.723 - 17: Read 1725 bytes
2016-03-15 21:24:33.757 - 18: Read 0 bytes
2016-03-15 21:24:33.757 - 18: Wrote 0 bytes
2016-03-15 21:24:33.757 - 19: Wrote 0 bytes
2016-03-15 21:24:33.924 - After transfer directory /
2016-03-15 21:24:33.924 - After transfer, Ftp client connected? True
2016-03-15 21:24:33.964 - Size of /web/3044l5.png on server? 337580
2016-03-15 21:24:34.009 - Task completed. Filename: 3044l5.png, URL: https://share.pilovali.nl/3044l5.png, Duration: 3390 ms
2016-03-15 21:24:34.445 - URL opened: https://share.pilovali.nl/3044l5.png

Succesful one:

2016-03-15 21:24:19.806 - Hotkey triggered: Hotkey: Print Screen, Description: Capture entire screen, Job: PrintScreen
2016-03-15 21:24:19.820 - Executing: Capture entire screen
2016-03-15 21:24:19.910 - Task in queue. Job: Job, Type: File, Host: FTP
2016-03-15 21:24:19.919 - Task status: Preparing
2016-03-15 21:24:21.686 - Image copied to clipboard.
2016-03-15 21:24:21.721 - Image saved to file: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\05d6E0.png
2016-03-15 21:24:21.727 - Upload started. Filename: 05d6E0.png, Filepath: C:\Users\jarno\Documents\ShareX\Screenshots\2016-03\05d6E0.png
2016-03-15 21:24:22.674 - Before transfer, Ftp client connected? True
2016-03-15 21:24:22.683 - Preparing to transfer 182490 bytes
2016-03-15 21:24:22.683 - 1: Read 32768 bytes
2016-03-15 21:24:22.687 - 2: Read 32768 bytes
2016-03-15 21:24:22.688 - 3: Read 32768 bytes
2016-03-15 21:24:22.835 - 4: Read 32768 bytes
2016-03-15 21:24:22.900 - 5: Read 32768 bytes
2016-03-15 21:24:22.971 - 6: Read 18650 bytes
2016-03-15 21:24:22.972 - 7: Read 0 bytes
2016-03-15 21:24:22.973 - 7: Wrote 0 bytes
2016-03-15 21:24:22.975 - 8: Wrote 0 bytes
2016-03-15 21:24:23.127 - After transfer directory /
2016-03-15 21:24:23.127 - After transfer, Ftp client connected? True
2016-03-15 21:24:23.164 - Size of /web/05d6E0.png on server? 182490
2016-03-15 21:24:23.258 - Task completed. Filename: 05d6E0.png, URL: https://share.pilovali.nl/05d6E0.png, Duration: 3311 ms
2016-03-15 21:24:23.833 - URL opened: https://share.pilovali.nl/05d6E0.png
Cleroth commented 8 years ago

The above commit does not fix the problem. I've tracked down the problem to the update of System.Net.FtpClient library. It seems it breaks on 1.0.5821.41114

While I can't reproduce it 100%, I've managed to reproduce it by uploading several copies of the same file (it seems it happens more in some files). Within 20 uploads, there's usualy 2 or 3 broken ones.

Jaex commented 8 years ago

Then issue need to be reported in their project page: https://netftp.codeplex.com/workitem/list/basic

I can't report it myself because I don't have FTP server for testing.

Cleroth commented 8 years ago

Use mine. I don't have a codeplex account.