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

Uploading Gives Tus Error when using Version 1.0.8 #135

Closed
edmenendez opened this issue Sep 4, 2018 · 13 comments
Closed

Uploading Gives Tus Error when using Version 1.0.8 #135

edmenendez opened this issue Sep 4, 2018 · 13 comments
Assignees

Comments

@edmenendez
Copy link

edmenendez commented Sep 4, 2018

On Python 2.7.6 after upgrading to PyVimeo 1.0.8 from 0.4.1 I get this error in the upload() method:

Unexpected error when uploading through tus.

Traceback below.

----> 1 create_2min_clip(mv.guid)

/var/www/learn/.env/local/lib/python2.7/site-packages/celery/local.pyc in __call__(self, *a, **kw)
    186
    187     def __call__(self, *a, **kw):
--> 188         return self._get_current_object()(*a, **kw)
    189
    190     def __len__(self):

/var/www/learn/.env/local/lib/python2.7/site-packages/celery/app/task.pyc in __call__(self, *args, **kwargs)
    418             if self.__self__ is not None:
    419                 return self.run(self.__self__, *args, **kwargs)
--> 420             return self.run(*args, **kwargs)
    421         finally:
    422             self.pop_request()

/var/www/learn/src/py/lms/tasks.pyc in create_2min_clip(video_guid)
    487         v.replace(mv.vimeo_url, full_fn)
    488     else:
--> 489         mv.vimeo_url = v.upload(full_fn)
    490         mv.save()
    491

/var/www/learn/.env/local/lib/python2.7/site-packages/vimeo/upload.pyc in upload(self, filename, **kwargs)
     76         attempt = attempt.json()
     77
---> 78         return self.__perform_tus_upload(filename, attempt, chunk_size=chunk_size)
     79
     80     def replace(self, video_uri, filename, **kwargs):

/var/www/learn/.env/local/lib/python2.7/site-packages/vimeo/upload.pyc in __perform_tus_upload(self, filename, attempt, chunk_size)
    159             raise exceptions.VideoUploadFailure(
    160                 e,
--> 161                 'Unexpected error when uploading through tus.'
    162             )
    163

VideoUploadFailure:

Workaround is to switch back to 0.4.1.

@edmenendez edmenendez changed the title Uploading Gives Uploading Gives Tus Error when using Version 1.0.8 Sep 4, 2018
@erunion
Copy link
Contributor

erunion commented Sep 5, 2018

Are you able to capture the actual exception that's being thrown here?

@edmenendez
Copy link
Author

edmenendez commented Sep 5, 2018

This is what I see in the logs

VideoUploadFailure: null
File "celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "celery/app/trace.py", line 438, in protected_call
return self.run(*args, **kwargs)
File "lms/tasks.py", line 489, in create_2min_clip
mv.vimeo_url = v.upload(full_fn)
File "vimeo/upload.py", line 78, in upload
return self.__perform_tus_upload(filename, attempt, chunk_size=chunk_size)
File "vimeo/upload.py", line 161, in __perform_tus_upload
'Unexpected error when uploading through tus.'

Let me know if you need to know something else.

@erunion
Copy link
Contributor

erunion commented Sep 5, 2018

You get this error on every upload? Or just specific video files? How large are the videos that are failing?

@edmenendez
Copy link
Author

It happens on every upload. They are all 2 minutes long so they're approximately the same file size. The most recent one I tried was:

630765704 Sep 5 16:30 251 - Test Video - Review - FINAL.mp4

@erunion
Copy link
Contributor

erunion commented Sep 6, 2018

Can you replicate the problem with our upload.py example script?

@erunion erunion added the support label Sep 6, 2018
@erunion erunion self-assigned this Sep 6, 2018
@amrutadotorg
Copy link

amrutadotorg commented Sep 6, 2018

confirmed

 --- modulename: httplib, funcname: putheader
httplib.py(1007):         if self.__state != _CS_REQ_STARTED:
httplib.py(1010):         header = '%s' % header
httplib.py(1011):         if not _is_legal_header_name(header):
httplib.py(1014):         values = [str(v) for v in values]
httplib.py(1014):         values = [str(v) for v in values]
httplib.py(1015):         for one_value in values:
httplib.py(1016):             if _is_illegal_header_value(one_value):
httplib.py(1015):         for one_value in values:
httplib.py(1019):         hdr = '%s: %s' % (header, '\r\n\t'.join(values))
httplib.py(1020):         self._output(hdr)
 --- modulename: httplib, funcname: _output
httplib.py(862):         self._buffer.append(s)
httplib.py(1071):         for hdr, value in headers.iteritems():
httplib.py(1072):             self.putheader(hdr, value)
 --- modulename: httplib, funcname: putheader
httplib.py(1007):         if self.__state != _CS_REQ_STARTED:
httplib.py(1010):         header = '%s' % header
httplib.py(1011):         if not _is_legal_header_name(header):
httplib.py(1014):         values = [str(v) for v in values]
httplib.py(1014):         values = [str(v) for v in values]
httplib.py(1015):         for one_value in values:
httplib.py(1016):             if _is_illegal_header_value(one_value):
httplib.py(1015):         for one_value in values:
httplib.py(1019):         hdr = '%s: %s' % (header, '\r\n\t'.join(values))
httplib.py(1020):         self._output(hdr)
 --- modulename: httplib, funcname: _output
httplib.py(862):         self._buffer.append(s)
httplib.py(1071):         for hdr, value in headers.iteritems():
httplib.py(1073):         self.endheaders(body)
 --- modulename: httplib, funcname: endheaders
httplib.py(1031):         if self.__state == _CS_REQ_STARTED:
httplib.py(1032):             self.__state = _CS_REQ_SENT
httplib.py(1035):         self._send_output(message_body)
 --- modulename: httplib, funcname: _send_output
httplib.py(870):         self._buffer.extend(("", ""))
httplib.py(871):         msg = "\r\n".join(self._buffer)
httplib.py(872):         del self._buffer[:]
httplib.py(876):         if isinstance(message_body, str):
httplib.py(877):             msg += message_body
request.py(64):         except http.client.HTTPException as e:
request.py(68):         except OSError as e:
uploader.py(289):         except TusUploadFailed as error:
uploader.py(293):             self.request.close()
 --- modulename: request, funcname: close
request.py(77):         self.handle.close()
 --- modulename: httplib, funcname: close
httplib.py(829):         if self.sock:
httplib.py(832):         if self.__response:
httplib.py(835):         self.__state = _CS_IDLE
upload.py(158):         except Exception as e:
upload.py(159):             raise exceptions.VideoUploadFailure(
upload.py(160):                 e,
upload.py(161):                 'Unexpected error when uploading through tus.'
 --- modulename: exceptions, funcname: __init__
exceptions.py(93):         super(VideoUploadFailure, self).__init__(response, message)
 --- modulename: exceptions, funcname: __init__
exceptions.py(30):         self.message = self.__get_message(response)
 --- modulename: exceptions, funcname: __get_message
exceptions.py(8):         if type(response) is Exception:
exceptions.py(11):         json = None
exceptions.py(12):         try:
exceptions.py(13):             json = response.json()
exceptions.py(14):         except Exception:
exceptions.py(15):             pass
exceptions.py(17):         if json:
exceptions.py(19):         elif hasattr(response, 'text'):
exceptions.py(23):             message = getattr(response, 'message')
exceptions.py(25):         return message
exceptions.py(33):         if type(response) is Exception:
exceptions.py(35):         elif hasattr(response, 'status_code'):
exceptions.py(38):             self.status_code = 500
exceptions.py(40):         super(BaseVimeoException, self).__init__(self.message)
upload.py(55): except vimeo.exceptions.VideoUploadFailure as e:
upload.py(58):     print 'Error uploading %s' % file_name
Error uploading xxx.mp4
upload.py(59):     print 'Server reported: %s' % e.message
Server reported:
 --- modulename: trace, funcname: _unsettrace
trace.py(80):         sys.settrace(None)

@erunion
Copy link
Contributor

erunion commented Sep 6, 2018

@amrutadotorg Are you also on Python 2.7?

I'm pulling @Onebrownsound in to help out on this.

@amrutadotorg
Copy link

Yes
Python 2.7.9

@Onebrownsound
Copy link
Collaborator

@amrutadotorg @edmenendez
👋 So, while digging through this issue today, I came across findings I found interesting.
I was able to reproduce what was described, but only after spawning a fresh virtualenv off my long term local Python 2.7.10.

I was unable to reproduce this problem, when I spawned a virtualenv off my long term and I inherited the existing site packages. Going to keep digging, and explore the why for the above observed behavior. Will update upon encountering anything interesting.
screen shot 2018-09-06 at 4 35 44 pm

@erunion
Copy link
Contributor

erunion commented Sep 7, 2018

@edmenendez @amrutadotorg We've downgraded our tuspy requirement back to 0.2.1, and it seems to have resolved the issue.

I've tagged a new release for this, 1.0.9. Please let us know if it resolves your issues.

@edmenendez
Copy link
Author

It worked.

Note that I get the following messages while upgrading requirements but it worked anyway. Also, had to do this first to update curl: apt-get install libcurl4-openssl-dev

tuspy 0.2.1 has requirement certifi==2017.7.27.1, but you'll have certifi 2018.4.16 which is incompatible.
tuspy 0.2.1 has requirement six==1.10.0, but you'll have six 1.11.0 which is incompatible.
Installing collected packages: pycurl, tuspy, PyVimeo
Running setup.py install for pycurl ... done
Found existing installation: tuspy 0.2.3
Uninstalling tuspy-0.2.3:
Successfully uninstalled tuspy-0.2.3
Running setup.py install for tuspy ... done
Found existing installation: PyVimeo 0.4.1
Uninstalling PyVimeo-0.4.1:
Successfully uninstalled PyVimeo-0.4.1
Running setup.py install for PyVimeo ... done
Successfully installed PyVimeo-1.0.9 pycurl-7.43.0 tuspy-0.2.1

@erunion
Copy link
Contributor

erunion commented Sep 7, 2018

Awesome. Thanks for being patient and sorry for the trouble on this.

@erunion erunion closed this as completed Sep 7, 2018
@brunoreisfm
Copy link

@erunion Same error happening with the same versions of last @edmenendez comment:

Versions:
image

Error:

  File "vimeo_upload.py", line 47, in <module>
    video_id = client.upload(file_name, data={'name': file_name,})
  File "C:\Python27\lib\site-packages\vimeo\upload.py", line 78, in upload
    return self.__perform_tus_upload(filename, attempt, chunk_size=chunk_size)
  File "C:\Python27\lib\site-packages\vimeo\upload.py", line 161, in __perform_tus_upload
    'Unexpected error when uploading through tus.'
vimeo.exceptions.VideoUploadFailure: (55, 'SSL_write() returned SYSCALL, errno = 10053')

That file is only 50mb... For smaller files (<5mb) I'm not getting an error.

Can someone help?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants