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

AttributeError: 'mod_wsgi.Input' object has no attribute 'tell' #123

Closed
sakshigupta3 opened this issue Mar 19, 2020 · 3 comments
Closed
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@sakshigupta3
Copy link

sakshigupta3 commented Mar 19, 2020

I'm running the below versions of httpd, mod_wsgi and latest google-cloud-storage code

  • httpd-2.4.41-12.fc31.x86_64
  • python3-mod_wsgi-4.6.6-2.fc31.x86_64
  • python3.7

I'm getting the below traceback sometimes, the issue is intermittent and that's why more confusing ( Like once in an hour ). We upgraded from python2.7 to python3.7, could this be a dependency issue ? Is so, why is it intermittent ?

[2020-03-19 07:23:01,337] [ERROR] GCPStorage: PutRequest: stest.2020-03-19/DynamicPolicyRouteChangeTest.py-stest131.sjc-16045647-403435829.log.gz. Unexpected error: (<class 'AttributeError'>) 'mod_wsgi.
Input' object has no attribute 'tell'
[2020-03-19 07:23:01,340] [ERROR] Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/LogLake/Server.py", line 477, in handlePutRequest
requestBody, requestHeaders )
File "/usr/lib/python3.7/site-packages/LogLake/Storage.py", line 79, in putObject
self.bucketName( bucketName ), objectName, content, headers )
File "/usr/lib/python3.7/site-packages/LogLake/GCPStorage.py", line 221, in doPutObject
size=fileSize, client=self.gcpStorageClient )
File "/usr/local/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1261, in upload_from_file
client, file_obj, content_type, size, num_retries, predefined_acl
File "/usr/local/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1171, in _do_upload
client, stream, content_type, size, num_retries, predefined_acl
File "/usr/local/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1114, in _do_resumable_upload
predefined_acl=predefined_acl,
File "/usr/local/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1063, in _initiate_resumable_upload
stream_final=False,
File "/usr/local/lib/python3.7/site-packages/google/resumable_media/requests/upload.py", line 343, in initiate
stream_final=stream_final,
File "/usr/local/lib/python3.7/site-packages/google/resumable_media/_upload.py", line 414, in _prepare_initiate_request
if stream.tell() != 0:
AttributeError: 'mod_wsgi.Input' object has no attribute 'tell'

@sakshigupta3
Copy link
Author

I raised this issue in mod_wsgi repo and GrahamDumpleton/mod_wsgi#545 the fix helped. FYI: We were running absolutely fine with python2.7.

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Mar 20, 2020
@busunkim96 busunkim96 added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Mar 24, 2020
@busunkim96
Copy link
Contributor

@tseaver @crwilcox Could you take a look?

@IlyaFaer
Copy link

@busunkim96, @crwilcox, I've taken a look, it seems to be not a Resumable Media issue. upload() treats an uploaded object as a file-like instance, so it expects an uploaded object to support file methods, like tell(), seek(), etc.

The object caused the error is not a standard Python, nor Resumable Media object, it's a class from a third-party package, and it's not very file-like. It supports some of the file operations, but tell() and seek() are not among them, per package owner's comment they can break the expected behavior. Still, user can convert the data from this object into more file-like form and pass it into Res Media's upload().

Thus, there is just no straight way to pass data from the third-party package to Res Media, as both of them have some data requirements, which can't be ignored in any of them. But this can be solved with a data conversion in between them, so I assume the issue can be closed.

@IlyaFaer IlyaFaer self-assigned this Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants