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

Upload timeouts after 30s #876

Closed
l0co opened this issue Jun 4, 2018 · 8 comments
Closed

Upload timeouts after 30s #876

l0co opened this issue Jun 4, 2018 · 8 comments
Assignees
Labels
Milestone

Comments

@l0co
Copy link

l0co commented Jun 4, 2018

For Bug Reports

  • BookStack Version solidnerd/bookstack:0.21.0
Expected Behavior

With these settings setup and shown properly in phpinfo():

file_uploads = On
memory_limit = 256M
upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 600

I expect to be able to upload >100MB file.

Current Behavior

Upload always gets killed after 30s. I've checked the underlying communication and there's nothing there. I suspect the 30s timeout is built in into the client request.

Steps to Reproduce

Try to upload file for which the upload process takes more than 30s.

@mendiromania
Copy link

+1 thought its just me

@Abijeet
Copy link
Member

Abijeet commented Jun 7, 2018

@Abijeet Abijeet self-assigned this Jun 10, 2018
@Abijeet
Copy link
Member

Abijeet commented Jun 10, 2018

@ssddanbrown - I'm able to reproduce this. It seems dropzone has a default timeout of 30s.

Surprising thing is that on timeout, the error callback is not triggered. As per a thread on Gitlab - https://gitlab.com/meno/dropzone/issues/23#note_58283962, the only way to get around this is by registering a callback in the sending event,

function handleTimeout(file, xhr, formData) {
    xhr.ontimeout = function (e) {
        alert('Uploading ' + file.name + ' timed out.');
    };
}

The other issue is that setting a timeout of 0 is fine, but if the server doesn't respond for a long time, the file upload will be stuck and the user will have to understand that they should refresh the page.

I think we should increase the timeout significantly but not set it to 0. What do you think?

@l0co
Copy link
Author

l0co commented Jun 15, 2018

Sorry, somehow I haven't got the notification about your reply :)

Best option? Probably increasing the timeout to few minutes and giving an option either in the configuration file or in the UI to extend it even more.

Or even better option - to do the above, but even if the timeout is reached, the uploading component shouldn't stop upload, but only should display notification, that "it takes more than assumed - check if everything is OK with your upload".

@iondive
Copy link

iondive commented Aug 28, 2018

@Abijeet
Will this be fixed soon?
If not, it would be awesome to if you could explain how to set the timeout to 0.
I tried to find out myself, but didn’t succeed. Thanks!

@Abijeet
Copy link
Member

Abijeet commented Sep 16, 2018

@iondive - You'd have to add a timeout parameter in /BookStack/resources/assets/js/vues/components/dropzone.js

But you'll have to rebuild the JavaScript files so it might be a better idea for us to fix it and for you to update BookStack.

@ssddanbrown - Did you get a chance to review my comment here - #876 (comment)

@ssddanbrown
Copy link
Member

@Abijeet Sorry, Totally missed this.

I think we should increase the timeout significantly but not set it to 0. What do you think?

Yeah, totally agree.

@l0co
Copy link
Author

l0co commented Nov 7, 2018

Here is a workaround for dockerized version, for those who can't work with bookstack with this bug, like me.

  1. Go into your docker (my docker is named dev-bookstack):
$ docker exec -it dev-bookstack bash
root@e25d577db9ac:/var/www/bookstack# ls
LICENSE  composer.lock  package-lock.json  phpunit.xml  resources   storage  vendor
app	 bootstrap			config	       package.json	  public       routes	   tests    version
artisan  composer.json			database       phpcs.xml	  readme.md    server.php  themes   webpack.config.js
  1. Tar the whole production bookstack without uploads and public, then exit docker machine:
$ tar --exclude='./storage' --exclude='./public' -zcvf ../bookstack.tgz .
$ exit
  1. Copy the file from docker to hosts machine:
$ cp dev-bookstack:/var/www/bookstack.tgz ./
  1. Now you have the same sources as in docker. Extract it somewhere to machine with node.js installed and apply patch in resources/assets/js/vues/components/dropzone.js:
// [...]
function mounted() {
   let container = this.$el;
   let _this = this;
   this._dz = new DropZone(container, {
   	timeout: 3600000,
	addRemoveLinks: true,
// [...]

The "patch" is timeout: 3600000, line extending the timeout to 1H.

  1. Having it done, compile everything using npm run production from the shell.

  2. Congratulations, you now have a patched bundle in public/dist/app.js. Just copy it back to the docker with the same steps as above to /var/www/bookstack/public/dist/app.js location, overwriting previous file.

  3. Remember to F5 your browser :)

It's so simple fix, so I wonder why do we need to wait so long for it?

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

No branches or pull requests

5 participants