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

Return java.io.EOFException Android 11 #571

Closed
2 tasks
EngKhAboshama opened this issue Feb 24, 2021 · 3 comments
Closed
2 tasks

Return java.io.EOFException Android 11 #571

EngKhAboshama opened this issue Feb 24, 2021 · 3 comments

Comments

@EngKhAboshama
Copy link

Describe the bug
Please I have an issue with the uploading "HttpUploadTask". I'm using "startUpload()" inside abstract class "UploadRequest".
The server response inside the library returned java.io.EOFException: \n not found: size=1 content=0d... and sometimes the server response returned java.io.IOException: closed
To Reproduce
Steps to reproduce the behavior:

  1. Select a file from the Android 11 device.

Expected behavior
The server response return success code using the override callback function onSuccess()
Actual behavior
The file is uploaded success with the exception above

OS and Lib versions (please complete the following information):

  • Android Upload Service version: [e.g. 4.5.2]
  • Android version and API version: [e.g. Android 11]

Request code:

// the code you wrote to create the upload request
 MultipartUploadRequest(context, url, Constants.POST_REQUEST).apply {
        setMethod(Constants.POST_REQUEST)
        homework.attachmentList?.filter { it.uri.toString() != "null" }?.let {
            for (value in it) {
                addFileToUpload(value.uri.toString(), parameterName = HOMEWORK_ATTACHMENTS, fileName = value.attachmentName)
            }
        }
        setMaxRetries(0)
        setNotificationConfig(getNotificationConfigFactory())

Where have you added the request code?

  • Activity
  • Service
  • Other class (Global file)

Debug Log:

I/UploadService: NotificationActionsObserver - (uploadId: N/A) - registered
2021-02-24 11:26:53.595 9718-9718/ I/UploadService: UploadService - (uploadId: N/A) - Starting UploadService. Debug info: {
        "uploadServiceVersion": "4.5.2",
        "androidApiVersion": 29,
        "namespace": "my_package_name",
        "deviceProcessors": 4,
        "idleTimeoutSeconds": 10,
        "bufferSizeBytes": 4096,
        "httpStack": "net.gotev.uploadservice.network.hurl.HurlStack",
        "uploadProgressNotificationIntervalMillis": 333,
        "retryPolicy": {"initialWaitTimeSeconds": 1, "maxWaitTimeSeconds": 100, "multiplier": 2, "defaultMaxRetries": 3},
        "isForegroundService": true,
        "schemeHandlers": {"/": "net.gotev.uploadservice.schemehandlers.FileSchemeHandler", "content://": "net.gotev.uploadservice.schemehandlers.ContentResolverSchemeHandler"}
    }
2021-02-24 11:26:53.603 9718-9718/ I/UploadService: UploadService - (uploadId: N/A) - Successfully created new task with class: net.gotev.uploadservice.protocols.multipart.MultipartUploadTask
2021-02-24 11:26:53.613 9718-10015/ I/UploadService: UploadService - (uploadId: 741dd847-0f32-45bd-a559-a0754c944cf0) - now holds foreground notification
2021-02-24 11:26:53.613 9718-9862/ D/EGL_emulation: eglMakeCurrent: 0xdcb14f80: ver 2 0 (tinfo 0xe7ec02e0)
2021-02-24 11:26:53.623 9718-10015/ I/UploadService: MultipartUploadTask - (uploadId: 741dd847-0f32-45bd-a559-a0754c944cf0) - Starting upload task
2021-02-24 11:26:53.639 9718-10583/ V/FA: Activity resumed, time: 11584078
2021-02-24 11:26:53.668 9718-10015/ I/UploadService: HurlStackRequest - (uploadId: 741dd847-0f32-45bd-a559-a0754c944cf0) - creating new HttpURLConnection (uuid: d8d142c9-2436-4f86-a5ee-3d74b7087b46)
2021-02-24 11:26:53.754 9718-10015/ I/UploadService: UploadTask - (uploadId: 741dd847-0f32-45bd-a559-a0754c944cf0) - uploaded 0%, 101 of 103693 bytes
2021-02-24 11:26:53.837 9718-10015/ I/UploadService: UploadTask - (uploadId: 741dd847-0f32-45bd-a559-a0754c944cf0) - uploaded 100%, 103693 of 103693 bytes
2021-02-24 11:26:54.027 9718-9718/ D/AutofillManager: onActivityFinishing(): calling cancelLocked()
2021-02-24 11:26:58.769 9718-10583/ V/FA: Inactivity, disconnecting from the service
2021-02-24 11:26:58.771 9718-10583/ W/ConnectionTracker: Exception thrown while unbinding
I/UploadService: HurlStackRequest - (uploadId: 741dd847-0f32-45bd-a559-a0754c944cf0) - closing HttpURLConnection (uuid: d8d142c9-2436-4f86-a5ee-3d74b7087b46)
2021-02-24 11:27:01.653 9718-10015/I/UploadService: UploadService - (uploadId: 741dd847-0f32-45bd-a559-a0754c944cf0) - now un-holded foreground notification
2021-02-24 11:27:01.653 9718-10015/I/UploadService: UploadService - (uploadId: N/A) - All tasks completed, stopping foreground execution
2021-02-24 11:27:01.660 9718-10015/I/UploadService: UploadService - (uploadId: N/A) - Service will be shut down in 10s if no new tasks are received
2021-02-24 11:27:01.701 9718-9862/D/EGL_emulation: eglMakeCurrent: 0xdcb14f80: ver 2 0 (tinfo 0xe7ec02e0)
2021-02-24 11:27:01.736 9718-9862/D/EGL_emulation: eglMakeCurrent: 0xdcb14f80: ver 2 0 (tinfo 0xe7ec02e0)
2021-02-24 11:27:11.663 9718-10726/I/UploadService: UploadService - (uploadId: N/A) - Service is about to be stopped because idle timeout of 10s has been reached
2021-02-24 11:27:11.668 9718-9718/I/UploadService: NotificationActionsObserver - (uploadId: N/A) - unregistered
2021-02-24 11:27:11.668 9718-9718/I/UploadService: UploadService - (uploadId: N/A) - Stopping foreground execution
2021-02-24 11:27:11.670 9718-9718/I/UploadService: UploadService - (uploadId: N/A) - UploadService destroyed

Thank you in advance.

@gotev
Copy link
Owner

gotev commented Feb 24, 2021

Double check your backend server. Not an Upload Service issue. This may be helpful: square/okhttp#1517

All androids from 4.4 onwards are using different versions of OkHttp underneath Hurl.

Only thing I recommend you is to use OkHttp Stack. Check the Wiki for detailed info 😉

@gotev gotev closed this as completed Feb 25, 2021
@dat2309
Copy link

dat2309 commented Dec 21, 2022

I get the same error though i used OkHttp Stack

@gotev
Copy link
Owner

gotev commented Dec 21, 2022

That's a network error. OkHttp recovers some of them but not all. Solution in this case is to retry the upload

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

3 participants