rejetto/hfs

Temporary upload-file causing filesystem and service-related issue

Closed this issue · 5 comments

BEFORE

  • Are you using a reverse-proxy, like nginx?
    NO

To Reproduce

Steps to reproduce the behavior:

  1. Upload a large file to a certain location, then manually cancel the transfer before finishing.
  2. The file will disappear at set delete time in "delete unfinished uploading", but 'folder menu-get list' still show the temporary file.
  3. now check your host server's filesystem, from serverside you'll see corresponding file named hfs$upload-[YOUR FILENAME] is not deleted.
  4. You'll find further upload to the same location with the same file is stucked at speed near zero or even not available.
  5. The temporary file in 3 cannot be deleted even with SYSTEM or LOCAL SERVICE account permission (tried launch a cmd from processhacker). The only way to remove that is terminating the HFS process, since you cannot get the file's permission without its read permission. Those files might be marked as "to be deleted" thus stucked in NTFS filesystem, blocking further uploading attempt on the same file.

Describe the bug

The temporary file created whilst uploading is not correctly handled by HFS.

Expected behavior

The temporary file created whilst uploading should be correctly deleted according to settings

Screenshots

SETTINGS:
image

image

SERVER SIDE BEHAVIOR:
image

image image image image

CLIENT-SIDE BEHAVIOR:
image

image

image

Environment (please complete the following information):

  • OS: [HFS Server runs on Windows Server 2022 21H2 20348.2655, host can be any version of windows 10/11 with a web browser]
  • HFS Version [tested on 0.53.0 and 0.54.0 alpha2]
  • Browser [tested on chrome and edge]

Additional context

Suggestions:

  1. give an option to allow user to choose a TEMP directory or use an independent environment variable
  2. give an option to store temporary uploading file in server's memory instead of disk drive if the latter choice is causing this instability.
  3. change the interaction method with NTFS filesystem to a more robust one.

P.S.
The HFS executable is registered on windows as a service using NSSM 2.24-103-gdee49fc 64-bit 2017-05-16, but makes no difference on this issue compared to directly running it by double-clicking the executable.

you say "manually cancel the transfer".
how?
if I click the button for upload cancellation, I get "1 skipped"
image

I see in your screenshot it says "1 failed", so I assume you did something different.

The first time when you upload a certain file, you can cancel the upload and skipped the file just as your description.

If you set 10s expiration time for unfinished upload, you'll see this up cancellation:
image

And after 10s you'll see the temp file is removed in web display
image

However, if you try to get a list by:
image

You'll see the temp file is not properly deleted, thus prohibiting further attempt to re-uploading the same file.
image

At server's end I can confirm that the temp file is not properly removed:
image

Then you'll have no alternative but to restart the HFS service to completely get rid of those unhandled temp file before being able to upload the same file again, or you'll be stuck like this:

image

After a long zero-speed timeout (Wireshark says TCP zero window which means server refused client's upload since it cannot overwrite that unhandled temp file), you'll see some "failed" hint.

ok, i see this problem is happening only on Windows

of course i made my verification, but would you care to confirm that this version is fixing the problem for you?
https://github.com/user-attachments/files/17174250/hfs-windows-x64-0.54.0-alpha2.2.zip
to install it you can go Admin-panel > Home
and right-click on the check-for-updates

alpha3 released