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

Unable to remove queued upload #274

Open
jomorr-jkl opened this issue Oct 5, 2023 · 0 comments
Open

Unable to remove queued upload #274

jomorr-jkl opened this issue Oct 5, 2023 · 0 comments

Comments

@jomorr-jkl
Copy link

I am unable to remove a queued upload that continues to fail. The uploader.removeUpload() appears to only remove active uploads, not uploads in the queue.

My app allows the user to select a video file to upload to the server. During my testing, I had the serverUrl value of the payload incorrect. Now when I init the FileTransferManager the queued upload retries and fails. I can't remove the bad queued upload so the new uploads never are attempted.
 
From the logs, the id of the bad upload is so '81ce84c4-1daf-4647-9f62-ce83c3fa8299' I specifically attempt to remove it.

uploadId = self.crypto.randomUUID();

var payload = {
    id: uploadId,
    filePath: fileUri,
    fileKey: "file",
    serverUrl: apiURLTeam,
    notificationTitle: "Uploading videos",
    headers: {},
    parameters: {}
};

console.log("video uploader payload "+JSON.stringify(payload));

uploader = FileTransferManager.init({}, function (event) {
    if (event.state == 'UPLOADED') {
        console.log("video uploader - "+ event.id + " upload complete");
    }
    else if (event.state == 'FAILED') {
        if (event.id) {
            console.log("video uploader -  "+ event.id + " has failed "+ event.error);
        }
        else {
            console.log("video uploader caught an error: " + event.error);
        }
    }
    else if (event.state == 'UPLOADING') {
        console.log("video uploader - " + event.id + " progress: " + event.progress + "%");
    }

    if (event.eventId) {
        uploader.acknowledgeEvent(event.eventId, function(){
            console.log("video uploader event acknowledged: " + event.eventId);
        }, function (error){
            console.log("video uploader event acknowledge error: " + event.eventId+" "+error);
        });
    }
});

uploader.removeUpload('81ce84c4-1daf-4647-9f62-ce83c3fa8299', function (success) {
    console.log("Success "+success);
}, function (err) {
    console.log("Error "+err);
});

uploader.startUpload(payload);

Logs show the removal of 81ce84c4-1daf-4647-9f62-ce83c3fa8299 was attempted, but failed (although called the success callback), then the upload for 81ce84c4-1daf-4647-9f62-ce83c3fa8299 retried and failed. The new upload 'a269c034-b59c-4258-b53a-f017aed246b5' doesn't appear to be attempted since I never get an UPLOADING status from that queued item.

2023-10-04 18:55:00.724 22613-22613 chromium                com.appname                        I  [INFO:CONSOLE(61)] "video uploader payload {"id":"adc8f1cf-71fe-4130-85b9-01b369fc43cf","filePath":"file:///sdcard/.transforms/synthetic/picker/0/com.appnameandroid.providers.media.photopicker/media/1000007062.mp4","fileKey":"file","serverUrl":"https://example.com/","notificationTitle":"Uploading videos","headers":{},"parameters":{}}", source: file:///android_asset/www/scripts/uploadFile.js (61)
2023-10-04 18:55:00.724 22613-22795 PluginManager           com.appname                        D  getPlugin - put: FileTransferBackground
2023-10-04 18:55:00.726 22613-22855 CordovaBackgroundUpload com.appname                        D  eventLabel='Remove upload 81ce84c4-1daf-4647-9f62-ce83c3fa8299'
2023-10-04 18:55:00.751 22613-23070 CordovaBackgroundUpload com.appname                        D  eventLabel='Failed to get work info for cleanup (81ce84c4-1daf-4647-9f62-ce83c3fa8299)' error='No task for id 81ce84c4-1daf-4647-9f62-ce83c3fa8299'
2023-10-04 18:55:00.752 22613-22613 CordovaBackgroundUpload com.appname                        D  Task succeeded: 7d5962ba-d3e4-42f5-bd33-a90354a3b4c8
2023-10-04 18:55:00.752 22613-22613 CordovaBackgroundUpload com.appname                        D  eventLabel='Uploader failed inexplicably' error='Data {output_failure_canceled : false, output_is_error : true, output_failure_reason : File not found !, output_id : 81ce84c4-1daf-4647-9f62-ce83c3fa8299, }'
2023-10-04 18:55:00.753 22613-22613 chromium                com.appname                        I  [INFO:CONSOLE(89)] "Success OK", source: file:///android_asset/www/scripts/uploadFile.js (89)
2023-10-04 18:55:00.866 22613-22855 CordovaBackgroundUpload com.appname                        D  startUpload: Starting worker via work manager
2023-10-04 18:55:00.869 22613-22855 CordovaBackgroundUpload com.appname                        D  eventLabel=Uploader starting uploads via worker0
2023-10-04 18:55:00.936 22613-22907 ConnectivityManager     com.appname                        D  StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4322)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4886)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4853)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4827)] [androidx.work.impl.utils.NetworkApi24.registerDefaultNetworkCallbackCompat(NetworkApi24.kt:28)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.startTracking(NetworkStateTracker.kt:139)] [androidx.work.impl.constraints.trackers.ConstraintTracker.addListener(ConstraintTracker.kt:57)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:82)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.schedule(GreedyScheduler.java:170)] [androidx.work.impl.Schedulers.schedule(Schedulers.java:119)] [androidx.work.impl.utils.EnqueueRunnable.scheduleWorkInBackground(EnqueueRunnable.java:135)] [androidx.work.impl.utils.EnqueueRunnable.run(EnqueueRunnable.java:95)] [androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)] [java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)] [java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)] [java.lang.Thread.run(Thread.java:1012)]
2023-10-04 18:55:00.962 22613-22613 CordovaBackgroundUpload com.appname                        D  Task succeeded: a269c034-b59c-4258-b53a-f017aed246b5
2023-10-04 18:55:00.962 22613-22613 CordovaBackgroundUpload com.appname                        D  eventLabel='Uploader failed inexplicably' error='Data {}'
2023-10-04 18:55:00.974 22613-23074 CordovaBackgroundUpload com.appname                        D  Upload Notification
2023-10-04 18:55:00.978 22613-23074 CordovaBackgroundUpload com.appname                        D  Upload Notification Exit
2023-10-04 18:55:00.988 22613-23074 TrafficStats            com.appname                        D  tagSocket(267) with statsTag=0xffffffff, statsUid=-1
2023-10-04 18:55:01.074 22613-23074 com.appname		        com.appname                        W  Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (unsupported, reflection, allowed)
2023-10-04 18:55:01.202 22613-23074 CordovaBackgroundUpload com.appname                        I  handleProgress: a269c034-b59c-4258-b53a-f017aed246b5 Progress: 0
2023-10-04 18:55:01.203 22613-23074 CordovaBackgroundUpload com.appname                        D  handleProgress: Progress data: Data {progress_id : 81ce84c4-1daf-4647-9f62-ce83c3fa8299, progress_percent : 0, }
2023-10-04 18:55:01.203 22613-23074 CordovaBackgroundUpload com.appname                        D  Upload Notification
2023-10-04 18:55:01.206 22613-23074 CordovaBackgroundUpload com.appname                        D  Upload Notification Exit
2023-10-04 18:55:01.215 22613-22613 CordovaBackgroundUpload com.appname                        D  initManager: a269c034-b59c-4258-b53a-f017aed246b5 (RUNNING) Progress: 0
2023-10-04 18:55:01.217 22613-22613 chromium                com.appname                        I  [INFO:CONSOLE(76)] "video uploader - 81ce84c4-1daf-4647-9f62-ce83c3fa8299 progress: 0%", source: file:///android_asset/www/scripts/uploadFile.js (76)
2023-10-04 18:55:01.290 22613-23074 CordovaBackgroundUpload com.appname                        E  doWork: Call failed, retrying later
                                                                                                    okhttp3.internal.http2.StreamResetException: stream was reset: STREAM_CLOSED
                                                                                                    	at okhttp3.internal.http2.Http2Stream.checkOutNotClosed$okhttp(Http2Stream.kt:646)
                                                                                                    	at okhttp3.internal.http2.Http2Stream$FramingSink.emitFrame(Http2Stream.kt:557)
                                                                                                    	at okhttp3.internal.http2.Http2Stream$FramingSink.write(Http2Stream.kt:532)
                                                                                                    	at okio.ForwardingSink.write(ForwardingSink.kt:29)
                                                                                                    	at okhttp3.internal.connection.Exchange$RequestBodySink.write(Exchange.kt:218)
                                                                                                    	at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.kt:255)
                                                                                                    	at okio.RealBufferedSink.write(RealBufferedSink.kt:185)
                                                                                                    	at com.appnamespoon.backgroundfileupload.ProgressRequestBody.writeTo(ProgressRequestBody.java:51)
                                                                                                    	at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.kt:157)
                                                                                                    	at okhttp3.MultipartBody.writeTo(MultipartBody.kt:93)
                                                                                                    	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:59)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
                                                                                                    	at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
                                                                                                    	at com.appnamespoon.backgroundfileupload.UploadTask.doWork(UploadTask.java:205)
                                                                                                    	at androidx.work.Worker$1.run(Worker.java:82)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2023-10-04 18:55:01.292 22613-22908 WM-WorkerWrapper        com.appname                        I  Worker result RETRY for Work [ id=a269c034-b59c-4258-b53a-f017aed246b5, tags={ com.appnamespoon.backgroundfileupload.UploadTask, work_tag_upload } ]
2023-10-04 18:55:01.299 22613-22613 ConnectivityManager     com.appname                        D  StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:4996)] [androidx.work.impl.utils.NetworkApi21.unregisterNetworkCallbackCompat(NetworkApi21.kt:31)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.stopTracking(NetworkStateTracker.kt:154)] [androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener(ConstraintTracker.kt:73)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:80)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.removeConstraintTrackingFor(GreedyScheduler.java:243)] [androidx.work.impl.background.greedy.GreedyScheduler.onExecuted(GreedyScheduler.java:229)] [androidx.work.impl.Processor.onExecuted(Processor.java:385)] [androidx.work.impl.Processor$FutureListener.run(Processor.java:484)]
2023-10-04 18:55:01.324 22613-22613 CordovaBackgroundUpload com.appname                        D  Task succeeded: a269c034-b59c-4258-b53a-f017aed246b5
2023-10-04 18:55:01.324 22613-22613 CordovaBackgroundUpload com.appname                        D  eventLabel='Uploader failed inexplicably' error='Data {}'
2023-10-04 18:55:31.302 22613-22613 ConnectivityManager     com.appname                        D  StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4322)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4886)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4853)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4827)] [androidx.work.impl.utils.NetworkApi24.registerDefaultNetworkCallbackCompat(NetworkApi24.kt:28)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.startTracking(NetworkStateTracker.kt:139)] [androidx.work.impl.constraints.trackers.ConstraintTracker.addListener(ConstraintTracker.kt:57)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:82)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.schedule(GreedyScheduler.java:170)] [androidx.work.impl.background.greedy.DelayedWorkTracker$1.run(DelayedWorkTracker.java:75)]
2023-10-04 18:55:31.340 22613-23184 CordovaBackgroundUpload com.appname                        D  Upload Notification
2023-10-04 18:55:31.344 22613-23184 CordovaBackgroundUpload com.appname                        D  Upload Notification Exit
2023-10-04 18:55:31.353 22613-23184 TrafficStats            com.appname                        D  tagSocket(84) with statsTag=0xffffffff, statsUid=-1
2023-10-04 18:55:31.538 22613-23184 CordovaBackgroundUpload com.appname                        I  handleProgress: a269c034-b59c-4258-b53a-f017aed246b5 Progress: 0
2023-10-04 18:55:31.540 22613-23184 CordovaBackgroundUpload com.appname                        D  handleProgress: Progress data: Data {progress_id : 81ce84c4-1daf-4647-9f62-ce83c3fa8299, progress_percent : 0, }
2023-10-04 18:55:31.540 22613-23184 CordovaBackgroundUpload com.appname                        D  Upload Notification
2023-10-04 18:55:31.560 22613-22613 CordovaBackgroundUpload com.appname                        D  initManager: a269c034-b59c-4258-b53a-f017aed246b5 (RUNNING) Progress: 0
2023-10-04 18:55:31.561 22613-23184 CordovaBackgroundUpload com.appname                        D  Upload Notification Exit
2023-10-04 18:55:31.561 22613-22613 chromium                com.appname                        I  [INFO:CONSOLE(76)] "video uploader - 81ce84c4-1daf-4647-9f62-ce83c3fa8299 progress: 0%", source: file:///android_asset/www/scripts/uploadFile.js (76)
2023-10-04 18:55:31.651 22613-23184 CordovaBackgroundUpload com.appname                        E  doWork: Call failed, retrying later
                                                                                                    okhttp3.internal.http2.StreamResetException: stream was reset: STREAM_CLOSED
                                                                                                    	at okhttp3.internal.http2.Http2Stream.checkOutNotClosed$okhttp(Http2Stream.kt:646)
                                                                                                    	at okhttp3.internal.http2.Http2Stream$FramingSink.emitFrame(Http2Stream.kt:557)
                                                                                                    	at okhttp3.internal.http2.Http2Stream$FramingSink.write(Http2Stream.kt:532)
                                                                                                    	at okio.ForwardingSink.write(ForwardingSink.kt:29)
                                                                                                    	at okhttp3.internal.connection.Exchange$RequestBodySink.write(Exchange.kt:218)
                                                                                                    	at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.kt:255)
                                                                                                    	at okio.RealBufferedSink.write(RealBufferedSink.kt:185)
                                                                                                    	at com.appnamespoon.backgroundfileupload.ProgressRequestBody.writeTo(ProgressRequestBody.java:51)
                                                                                                    	at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.kt:157)
                                                                                                    	at okhttp3.MultipartBody.writeTo(MultipartBody.kt:93)
                                                                                                    	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:59)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
                                                                                                    	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                    	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
                                                                                                    	at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
                                                                                                    	at com.appnamespoon.backgroundfileupload.UploadTask.doWork(UploadTask.java:205)
                                                                                                    	at androidx.work.Worker$1.run(Worker.java:82)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2023-10-04 18:55:31.653 22613-22908 WM-WorkerWrapper        com.appname                        I  Worker result RETRY for Work [ id=a269c034-b59c-4258-b53a-f017aed246b5, tags={ com.appnamespoon.backgroundfileupload.UploadTask, work_tag_upload } ]
2023-10-04 18:55:31.660 22613-22613 ConnectivityManager     com.appname                        D  StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:4996)] [androidx.work.impl.utils.NetworkApi21.unregisterNetworkCallbackCompat(NetworkApi21.kt:31)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.stopTracking(NetworkStateTracker.kt:154)] [androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener(ConstraintTracker.kt:73)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:80)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.removeConstraintTrackingFor(GreedyScheduler.java:243)] [androidx.work.impl.background.greedy.GreedyScheduler.onExecuted(GreedyScheduler.java:229)] [androidx.work.impl.Processor.onExecuted(Processor.java:385)] [androidx.work.impl.Processor$FutureListener.run(Processor.java:484)]
2023-10-04 18:55:31.681 22613-22613 CordovaBackgroundUpload com.appname                        D  Task succeeded: a269c034-b59c-4258-b53a-f017aed246b5
2023-10-04 18:55:31.681 22613-22613 CordovaBackgroundUpload com.appname                        D  eventLabel='Uploader failed inexplicably' error='Data {}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant