Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

"Remote end closed connection without response" exception occurs when upload aab by resumable method #56

Open
@tony-zhou

Description

@tony-zhou
    @retry(stop_max_attempt_number=3, wait_random_min=10000, wait_random_max=30000)
    def upload_app(self, edit_id, package_name, app_type, app_size, package_path):
        self.log.info("start to upload app: {}".format(package_path))
        if app_type == AppType.android_application.name:
            response = self.service.edits().apks().upload(editId=edit_id,
                                                          packageName=package_name,
                                                          media_body=package_path).execute()
        elif app_type == AppType.android_bundle.name:
            if app_size >= 100:
                installation_warning = True
            else:
                installation_warning = False
            chunk_size = math.ceil(app_size * 1024 * 1024 * 1.02 / 10)
            aab_media_body = MediaFileUpload(package_path, mimetype="application/octet-stream",
                                             chunksize=chunk_size, resumable=True)
            request = self.service.edits().bundles().upload(editId=edit_id,
                                                            packageName=package_name,
                                                            ackBundleInstallationWarning=installation_warning,
                                                            media_body=aab_media_body)
            response = None
            try:
                while response is None:
                    status, response = request.next_chunk(num_retries=3)
                    self.log.info("resumable_uri: %s" % request.resumable_uri)
                    if status:
                        self.log.info("uploaded %d%%. [%s / %s]" % (int(status.progress() * 100),
                                                                    status.resumable_progress, status.total_size))
            except HttpError as e:
                if e.resp.status in [404]:
                    raise RetryError(e)
                elif e.resp.status in [500, 502, 503, 504]:
                    request.next_chunk(num_retries=5)
                else:
                    self.log.error(e.error_details)
            except Exception:
                self.log.error(common.format_exc_plus())

        else:
            response = {'versionCode': None}
        self.log.info("upload app result: {}".format(response))
        return response```



I've already tried to set timeout as 600s, still failed.

http_auth = credentials.authorize(httplib2.Http(timeout=600))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions