Errors with ftp filesystem

We are using the ftp filesystem for our workspaces. We are encountering a situation that occasionally an error occurs with fopen stating the filename is empty. Once that occurs there is an endless repeat of feof and fread errors. It seems that the code gets stuck in a loop at that point.

Pydio 7
Ubuntu 14.04.5
PHP 5.6.30-5+ded.sury.org-trusty+2
MySQL 5.6.34

The same issue occurs in Pydio 8.

Here are the actual lines in the log for when the error first occurs. The feof &fread lines repeat forever, the syslog grew to 18GB before I killed the PHP process.

Jun  5 15:53:21 ip-***-***-***-*** php[31462]: PHP_CLI#011_username_#011FtpAccessDriver.php#011error l.141#011message=fopen(): Filename cannot be empty
Jun  5 15:53:21 ip-***-***-***-*** php[31462]: PHP_CLI#011_username_#011FtpAccessDriver.php#011error l.142#011message=feof() expects parameter 1 to be resource, boolean given
Jun  5 15:53:21 ip-***-***-***-*** php[31462]: PHP_CLI#011_username_#011FtpAccessDriver.php#011error l.143#011message=fread() expects parameter 1 to be resource, boolean given
Jun  5 15:53:21 ip-***-***-***-*** php[31462]: PHP_CLI#011_username_#011FtpAccessDriver.php#011error l.142#011message=feof() expects parameter 1 to be resource, boolean given
Jun  5 15:53:21 ip-***-***-***-*** php[31462]: PHP_CLI#011_username_#011FtpAccessDriver.php#011error l.143#011message=fread() expects parameter 1 to be resource, boolean given

Hi,
do you have files/folders named using special characters on your FTP ?

There may be the following: #, !, $, (, ), -, _, .,~,+, [, ]

Are there any that should not be used?
Could the uploader be modified to validate filenames and do an automatic rename and log it?

Ron

Hi,
i would advise you to avoid all special chars, it’s tolerated to use - or _ but don’t start a file with that, for the validation of filenames i will have a look and see if it’s possible, i’ll keep you updated.

Hello @zayn,

I agree special characters should not be used, however, when there are a large number of users that work on Windows which allows special characters and Pydio does not inform the user a filename is not acceptable, there will be this issue. An example was someone uploaded a folder that was labeled as PDF#7458. This was done to be meaningful to a team of people that the folder contained PDF documents for a particular item #. Makes logical sense. However, when it was uploaded in Pydio it did not tell the user there was an error. In fact when it tried to create the folder on the ftp site is when an error occurred. Then it tried to upload the files to the original folder name which didn’t exist.

So, one immediate fix that would be beneficial for the ftp filesystem would be to check for these type of errors and inform the user a folder cannot be created and then stop trying to copy files to a folder that could not be created.

A special symbol that did not cause issues is “@”. Folders and files were uploaded and created successfully. I am starting to make a list of common special characters that I typically see used in filenames and folder names and will test those and provide additional results as to which ones work.

Best regards,
Ron

Hello @zayn,

I tested a variety of Special characters and found only one symbol that causes an error that Windows based computers allow, “#” for folders. Files containing these symbols upload without error.

Using the New folder feature in Pydio, or uploading folders, using a # character in the folder name looks like it is successful, shows the folder name with the #, and a pop-up message says that it created it.

If you attempt to open the folder it gives an error and then the list refreshes and shows two folders. One named as entered and the other with the name truncated at the #.

To duplicate,

  1. Create a new folder name called “PDF#1” - You will get a pop-up success message and the new folder will be listed
  2. Attempt to open the new folder called “PDF#1” - You will see an error pop-up with a Stack trace. The folder list refreshes with two folders: “PDF” and “PDF#1”. You will be able to open PDF with success.

Character causing error
Only #

Characters accepted
’ ! $ % & ( ) , ; @ [ ] ^ ` { } ~ + =

Hi,

sorry for the late reply, basically between every os you have a set of characters that is forbidden, for example there"s a character that is allowed on windows but not on linux and vice versa.
So to avoid any type of error we suggest everyone to avoid at any cost the use of those characters, because you might be able to use some characters on a your server but it could be an issue for some clients.

@zayn,

I understand about the incompatibility of some characters over others and they should be avoided. However, I would like to point out that with the proliferation of Windows, the likelyhood of English users naming a file with any of the special characters I tested is very high. Given that of the characters I tested only “#” broke the ftp filesystem. It ended up causing a loop that caused the log file to grow huge and eventually crashing the system.

From what I understand, when using ftp for the filesystem, Pydio creates all the folders and uploads the files into a temp folder locally and then a separate process uses ftp to transfer the uploaded folder structure and files to the ftp server. What it looks like is happening is that pydio creates the folder properly in the temp folder but when the ftp process attempts to create the folder it gets back that the folder was created even though it was not. Then the code assumed the folder had been created and continued to try and open that folder and transfer a file to it.

So I would think the developers would want to at least fix the code in the ftp transfer process that is attempting to open a folder that does not exist and transfer a file. If the open doesn’t succeed it should not then be attempting to transfer a file.

Best regards,
Ron

@zayn,

Any chance of a fix from the developers to prevent the code attempting to transfer a file to a folder that does not exist?

Ron