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

client fails to upload very large files #216

Closed
lzaoral opened this issue Aug 10, 2023 · 3 comments · Fixed by #219
Closed

client fails to upload very large files #216

lzaoral opened this issue Aug 10, 2023 · 3 comments · Fixed by #219

Comments

@lzaoral
Copy link
Contributor

lzaoral commented Aug 10, 2023

If you try to update very large files (+2 GB) using kobo's upload_file XML-RPC method, the method will fail with the following Traceback:

$ truncate -s 2G test
$ osh/client/osh-cli mock-build --tarball-build-script=test ./test
Traceback (most recent call last):
  File "/src/osh/client/osh-cli", line 79, in <module>
    main()
  File "/src/osh/client/osh-cli", line 72, in main
    parser.run()
  File "/src/kobo/kobo/cli.py", line 296, in run
    cmd.run(*cmd_args, **cmd_kwargs)
  File "/src/osh/client/commands/cmd_diff_build.py", line 157, in run
    target_dir, self.parser)
  File "/src/osh/client/commands/shortcuts.py", line 145, in upload_file
    return hub.upload_file(os.path.expanduser(srpm), target_dir)
  File "/src/kobo/kobo/client/__init__.py", line 473, in upload_file
    upload_id, upload_key = self.upload.register_upload(os.path.basename(file_name), checksum, fsize, target_dir)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1446, in __request
    allow_none=self.__allow_none).encode(self.__encoding, 'xmlcharrefreplace')
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 971, in dumps
    data = m.dumps(params)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 502, in dumps
    dump(v, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 524, in __dump
    f(self, value, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 540, in dump_long
    raise OverflowError("int exceeds XML-RPC limits")
OverflowError: int exceeds XML-RPC limits

OpenScanHub needs to be able to work with large SRPMs. Unfortunately, I have no idea how to fix this issue without breaking backwards compatibility with older releases of kobo.

@rohanpm
Copy link
Member

rohanpm commented Aug 11, 2023

It seems there are at least two layers which are going to have a problem with this:

@kdudka
Copy link
Contributor

kdudka commented Aug 11, 2023

The former could be solved by introducing a new XML-RPC method. IIRC checksum is already passed in as a string rather than a long number. The latter could be handled by a Django migration.

lzaoral added a commit to lzaoral/kobo that referenced this issue Aug 22, 2023
Otherwise, we cannot log uploads that are larger than 2 GB.

Resolves: release-engineering#216
lzaoral added a commit to lzaoral/kobo that referenced this issue Aug 22, 2023
... for uploads which sizes exceed the xmlrpc.client.MAXINT limit for int
values.  This change should not be backwards incompatible.  Old client
with newer hub should work seamlessly.  And new hub with older client
would crash with the following traceback anyway.

Fixes the following traceback:
```
$ truncate -s 2G test
$ osh/client/osh-cli mock-build --tarball-build-script=test ./test
Traceback (most recent call last):
  File "/src/osh/client/osh-cli", line 79, in <module>
    main()
  File "/src/osh/client/osh-cli", line 72, in main
    parser.run()
  File "/src/kobo/kobo/cli.py", line 296, in run
    cmd.run(*cmd_args, **cmd_kwargs)
  File "/src/osh/client/commands/cmd_diff_build.py", line 157, in run
    target_dir, self.parser)
  File "/src/osh/client/commands/shortcuts.py", line 145, in upload_file
    return hub.upload_file(os.path.expanduser(srpm), target_dir)
  File "/src/kobo/kobo/client/__init__.py", line 473, in upload_file
    upload_id, upload_key = self.upload.register_upload(os.path.basename(file_name), checksum, fsize, target_dir)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1446, in __request
    allow_none=self.__allow_none).encode(self.__encoding, 'xmlcharrefreplace')
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 971, in dumps
    data = m.dumps(params)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 502, in dumps
    dump(v, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 524, in __dump
    f(self, value, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 540, in dump_long
    raise OverflowError("int exceeds XML-RPC limits")
OverflowError: int exceeds XML-RPC limits
```

Resolves: release-engineering#216
@lzaoral
Copy link
Contributor Author

lzaoral commented Aug 22, 2023

I was able to come up with a solution that should not break anything that was not already broken: #219

lzaoral added a commit to lzaoral/kobo that referenced this issue Aug 22, 2023
Otherwise, we cannot log uploads that are larger than 2 GB.

Resolves: release-engineering#216
lzaoral added a commit to lzaoral/kobo that referenced this issue Aug 22, 2023
... for uploads which sizes exceed the xmlrpc.client.MAXINT limit for int
values.  This change should not be backwards incompatible.  Old client
with newer hub should work seamlessly.  And new hub with older client
would crash with the following traceback anyway.

Fixes the following traceback:
```
$ truncate -s 2G test
$ osh/client/osh-cli mock-build --tarball-build-script=test ./test
Traceback (most recent call last):
  File "/src/osh/client/osh-cli", line 79, in <module>
    main()
  File "/src/osh/client/osh-cli", line 72, in main
    parser.run()
  File "/src/kobo/kobo/cli.py", line 296, in run
    cmd.run(*cmd_args, **cmd_kwargs)
  File "/src/osh/client/commands/cmd_diff_build.py", line 157, in run
    target_dir, self.parser)
  File "/src/osh/client/commands/shortcuts.py", line 145, in upload_file
    return hub.upload_file(os.path.expanduser(srpm), target_dir)
  File "/src/kobo/kobo/client/__init__.py", line 473, in upload_file
    upload_id, upload_key = self.upload.register_upload(os.path.basename(file_name), checksum, fsize, target_dir)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1446, in __request
    allow_none=self.__allow_none).encode(self.__encoding, 'xmlcharrefreplace')
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 971, in dumps
    data = m.dumps(params)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 502, in dumps
    dump(v, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 524, in __dump
    f(self, value, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 540, in dump_long
    raise OverflowError("int exceeds XML-RPC limits")
OverflowError: int exceeds XML-RPC limits
```

Resolves: release-engineering#216
lzaoral added a commit to lzaoral/kobo that referenced this issue Aug 23, 2023
Otherwise, we cannot log uploads that are larger than 2 GB.

Resolves: release-engineering#216
lzaoral added a commit to lzaoral/kobo that referenced this issue Aug 23, 2023
... for uploads which sizes exceed the xmlrpc.client.MAXINT limit for int
values.  This change should not be backwards incompatible.  Old client
with newer hub should work seamlessly.  And new hub with older client
would crash with the following traceback anyway.

Fixes the following traceback:
```
$ truncate -s 2G test
$ osh/client/osh-cli mock-build --tarball-build-script=test ./test
Traceback (most recent call last):
  File "/src/osh/client/osh-cli", line 79, in <module>
    main()
  File "/src/osh/client/osh-cli", line 72, in main
    parser.run()
  File "/src/kobo/kobo/cli.py", line 296, in run
    cmd.run(*cmd_args, **cmd_kwargs)
  File "/src/osh/client/commands/cmd_diff_build.py", line 157, in run
    target_dir, self.parser)
  File "/src/osh/client/commands/shortcuts.py", line 145, in upload_file
    return hub.upload_file(os.path.expanduser(srpm), target_dir)
  File "/src/kobo/kobo/client/__init__.py", line 473, in upload_file
    upload_id, upload_key = self.upload.register_upload(os.path.basename(file_name), checksum, fsize, target_dir)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1446, in __request
    allow_none=self.__allow_none).encode(self.__encoding, 'xmlcharrefreplace')
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 971, in dumps
    data = m.dumps(params)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 502, in dumps
    dump(v, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 524, in __dump
    f(self, value, write)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 540, in dump_long
    raise OverflowError("int exceeds XML-RPC limits")
OverflowError: int exceeds XML-RPC limits
```

Resolves: release-engineering#216
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

Successfully merging a pull request may close this issue.

3 participants