Skip to content

Ajax resumable upload endless loop, (and multple chunks file upload issue ?) #1557

@Kwaadpepper

Description

@Kwaadpepper

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of bootstrap-fileinput.
  • This is not an usage question. I confirm having read the plugin documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

I have not found a sure way to reproduce this yet, but here is my config
This can happen on demo page just upload a large file to force chunk upload, so larger than 2MB

$('#uploadInput').fileinput({
    language: uploadLocale,
    uploadAsync: true,
    enableResumableUpload: true,

    uploadUrl: actions.upload.url,
    uploadExtraData : {
        _token: 'tokenString',
        filePath: "${decodeURIComponent(getUrlLocationParameter('path'))}/"
    },
        
    showCaption: false, 
    showBrowse: false, 
    showPreview: true,
    showRemove: false, 
    showUpload: true, 
    showUploadStats: true,
    showCancel: null,
    showPause: null,
    showClose: false,
    showUploadedThumbs: true,
    showConsoleLogs: true,

    browseOnZoneClick: false,
    autoReplace: false,
    autoOrientImage: false, 
    autoOrientImageInitial: true,
    focusCaptionOnBrowse: true,
    focusCaptionOnClear: true,
    required: false,

    rtl: false,
    hideThumbnailContent: false,
    encodeUrl: true,
    generateFileId: null,
    previewClass: '',
    captionClass: '',
    frameClass: 'krajee-default',
    mainClass: 'file-caption-main',

    theme: "krajee-explorer",

    overwriteInitial: false,
    initialPreviewAsData: true,
    maxFileSize: 10000,
    removeFromPreviewOnError: true,
    previewFileType: 'any',

    fileSizeGetter: function(bytes) {
        i = Math.floor(Math.log(bytes) / Math.log(1024))
        sizes = [trans('B'), trans('KB'), trans('MB'), trans('GB'), trans('TB'), trans('PB'), trans('EB'), trans('ZB'), trans('YB')]
        return (bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i]
    }
});

The server answer

Capture d’écran de 2020-05-12 13-29-40

  1. Setup a resumable upoad

  2. open the JS debugger

  3. set a breakpoint on the if statement of the processQueu method

     processQueue = function () {
         var config, xhr;
         if (self.ajaxCurrentThreads < self.maxAjaxThreads) {
             config = self.ajaxQueue.shift();
             if (typeof config !== 'undefined') {
                 self.ajaxCurrentThreads++;
                 xhr = $.ajax(config).done(function () {
                     clearInterval(self.ajaxQueueIntervalId);
                     self.ajaxCurrentThreads--;
                 });
                 self.ajaxRequests.push(xhr);
             }
         }
     };
    

Expected behavior and actual behavior

This is the context, when i set the breakpoint: file has been uploaded, see the capture

Capture d’écran de 2020-05-12 13-38-15

As you can see, server answered "{"chunkIndex":"4","append":true}"

I believe this is wanted as stated in the example https://plugins.krajee.com/file-input#ajax-resumable

I was expecting...

AllTimeouts to be ended.

Also if i anwer HTTP 500 and error message from the server see the following capture, it seems to be stuck. The loop still happens.

Capture d’écran de 2020-05-12 13-42-58

Environment

Browsers

  • Chromium Version 81.0.4044.138 (Build officiel) snap (64 bits)
  • Google Chrome
  • Mozilla Firefox 76.0 (64 bits)
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: 3.5.1
  • bootstrap-fileinput version: 5.0.9

Isolating the problem

  • This bug happens on the plugin demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using bootstrap-fileinput without other plugins
  • I can reproduce this bug in a jsbin

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions