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

Uppy-TUS-PHP (Local pc vs Server): file resuming starts from beginning after pause #139

Closed
mahmudul opened this issue Apr 25, 2019 · 13 comments

Comments

@mahmudul
Copy link

mahmudul commented Apr 25, 2019

Hi, thanks for sharing the great library for TUS server implementation. I am using this library for Uppy. For last couple of days, I am facing issue with uppy file resuming using tus-php in my server running under php 7. Every time I pause and resume or reload browser, it loads from the start. The progressing circle goes back to zero and begin again. It should have been started where it left. This is working great in my local PC of XAMPP environment having php 7 installed. That means it's not the issue from tus-js-client library that I am using as a client. I have the same script running at my server and local pc. So, that should be the server settings which is causing the issue. If anybody here including the author could do any help or guidance that would really save me. I have attached the screenshots (sorry long vertical images, so sharing the link only) of phpinfo for both local pc and server for comparison if it would help to diagnose.

Local PC (Working): https://user-images.githubusercontent.com/494665/56719235-26fbc180-6762-11e9-99ca-ccab46aec90f.png

Server (Not working): https://user-images.githubusercontent.com/494665/56719236-27945800-6762-11e9-810d-ce905da6f776.png

I am using file based cache. I disabled the mod_cache_disk in local pc to check whether it's the cause but it's working without that module. I am suspecting file opcache which is disabled in server.

Thanks in advance.

@ankitpokhrel
Copy link
Owner

@mahmudul is it possible for you to try with redis cache? File based cache is not as mature as redis though it should work in most of the cases.

In any case can you paste the contents of cache generated when you start the upload and after you refresh and start again?

@mahmudul
Copy link
Author

@ankitpokhrel, Possibly, I can try redis cache. Just wondering why not the file based cache is working in remote server where the local server was able to perform great using the same script.

A sample entry in the cache file ( .cache/ folder having 'tus_php.server.cache' file) looks like when I click pause:

"tus:server:41b5c307-a9c5-406a-8a3a-a2335732ecf4":{"name":"IMG_0045.JPG","size":2078503,"offset":0,"checksum":"","location":"http://example.com/files/41b5c307-a9c5-406a-8a3a-a2335732ecf4","file_path":"/var/www/vhosts/example.com/uppy/uploads/IMG_0045.JPG","created_at":"Sun, 21 Apr 2019 05:53:01 GMT","expires_at":"Mon, 22 Apr 2019 05:53:01 GMT","upload_type":"normal"}}

Once it is uploaded without any pause, the cache file looks like:

"tus:server:41b5c307-a9c5-406a-8a3a-a2335732ecf4":{"offset":2078503,"name":"IMG_0045.JPG","size":2078503,"checksum":"","location":"http://example.com/files/41b5c307-a9c5-406a-8a3a-a2335732ecf4","file_path":"/var/www/vhosts/example.com/uppy/uploads/IMG_0045.JPG","created_at":"Sun, 21 Apr 2019 05:53:01 GMT","expires_at":"Mon, 22 Apr 2019 05:53:01 GMT","upload_type":"normal"}}

I don't have other cases as it starts from the beginning and the cache file looks like the same as the former one.

Thanks.

@sull
Copy link

sull commented May 1, 2019

same issue for me, same setup.

@sull
Copy link

sull commented May 2, 2019

I decided to next try with Redis.
Had problems so created this issue: #143

@klimentLambevski
Copy link

I have the same issue, tried with node js tus server and it works fine.
Tried with redis cache and it is the same. After pause the HEAD request always returns Upload-Offset: 0

Also i am getting this warning
upload.js?c775:422 Cross-Origin Read Blocking (CORB) blocked cross-origin response https:///files with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.

@akshay-bhanderi
Copy link

same issue as yours @klimentLambevski

@ankitpokhrel
Copy link
Owner

apologies for late response, are you guys having same issue after #143 was merged?

@stale
Copy link

stale bot commented Sep 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Sep 19, 2019
@LiaraAlis
Copy link

LiaraAlis commented Sep 19, 2019

Unfortunately I have the same issue with the latest package version.
Locally it worked (except that the progress is not correct, propable the same reason as in #44) but on the server as soon as I pause the upload, the file can no longer be uploaded until I delete the cache file. And unfortunately I have no chance to try redis on this server… :(

@stale stale bot removed the inactive label Sep 19, 2019
@stale
Copy link

stale bot commented Nov 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Nov 18, 2019
@ankitpokhrel
Copy link
Owner

Closing this as a duplicate of #44

@Brice155
Copy link

Brice155 commented Aug 29, 2024

Hi,
First of all, thanks a lot for your wonderful tus library which saved my life !
I also have the same issue....
Locally, the "tus_php.server.cache" contains an "offset" not null but in my production server, the "offset" is null.
I use Symfony 6.3 for the server
Do you have a solution ?
Thanks a lot

@ScoobyDid
Copy link

Same issue, here what is going on:

on production server, after resuming, the upload starts from last chunk that was uploaded successfully, so if it is a first chunk, or the file is small enough to fit in one chunk, it will be start from 0

on localhost, after resuming, currently uploading chunk continues upload (it is not being started from scratch, as expected)

i tested it on 2 domains: one is proxied by cloudflare and one not, same issue in both cases
i tested it on http 1.1, 2 and 3, same issue

when HEAD request is sent to server after upload is resumed, it returns Upload-Offset from last fully-uploaded chunk or 0;
it seems like .cache is not updated on xhr progress - only when request is fully sent

i tested with both file and redis as cache adapters; i also ensured that uploads directory and .cache folder has read and write permissions

it's hard to figure out what exactly is the source of problem... probably it is related to server config... i will let you know if i figure it out

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

No branches or pull requests

8 participants