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

Error uploading chunks issue on uploading video to vimeo #200

Open
roshangrg364 opened this issue Sep 25, 2023 · 1 comment
Open

Error uploading chunks issue on uploading video to vimeo #200

roshangrg364 opened this issue Sep 25, 2023 · 1 comment

Comments

@roshangrg364
Copy link

ON Uploading videos with vimeo i am regularly getting error uploading chunks issue.below is the error i got

VimeoDotNet.Exceptions.VimeoUploadException: Error uploading file chunk
---> System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.Net.Http.HttpRequestException: Error while copying content to a stream.
---> System.IO.IOException: Unable to write data to the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
  --- End of inner exception stack trace ---
  at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
  at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
  at System.Net.Security.SslStream.<WriteSingleChunk>g__CompleteWriteAsync|153_1[TIOAdapter](ValueTask writeTask, Byte[] bufferToReturn)
  at System.Net.Security.SslStream.WriteAsyncChunked[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
  at System.Net.Security.SslStream.WriteAsyncInternal[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnection.WriteAsync(ReadOnlyMemory`1 source, Boolean async)
  at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
  at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
  at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
  --- End of inner exception stack trace ---
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
  at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
  at VimeoDotNet.Net.ApiRequest.ExecuteRequestAsync() in /_/src/VimeoDotNet/Net/ApiRequest.cs:line 159
  at VimeoDotNet.VimeoClient.ContinueUploadFileAsync(IUploadRequest uploadRequest) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 227
  --- End of inner exception stack trace ---
  at VimeoDotNet.VimeoClient.ContinueUploadFileAsync(IUploadRequest uploadRequest) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 255
  at VimeoDotNet.VimeoClient.UploadEntireFileAsync(IBinaryContent fileContent, Int64 chunkSize, Nullable`1 replaceVideoId, Action`1 statusCallback) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 76
  at WebAPP.Controllers.CourseLessonController.<>c__DisplayClass10_0.<<UploadFileToVimeo>b__0>d.MoveNext() in C:\Users\Dell\OneDrive\Desktop\Institute\WebAPP\Controllers\CourseLessonController.cs:line 186
Error uploading file chunkSystem.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.Net.Http.HttpRequestException: Error while copying content to a stream.
---> System.IO.IOException: Unable to write data to the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
  --- End of inner exception stack trace ---
  at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
  at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
  at System.Net.Security.SslStream.<WriteSingleChunk>g__CompleteWriteAsync|153_1[TIOAdapter](ValueTask writeTask, Byte[] bufferToReturn)
  at System.Net.Security.SslStream.WriteAsyncChunked[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
  at System.Net.Security.SslStream.WriteAsyncInternal[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnection.WriteAsync(ReadOnlyMemory`1 source, Boolean async)
  at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
  at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
  at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
  --- End of inner exception stack trace ---
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
  at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
  at VimeoDotNet.Net.ApiRequest.ExecuteRequestAsync() in /_/src/VimeoDotNet/Net/ApiRequest.cs:line 159
  at VimeoDotNet.VimeoClient.ContinueUploadFileAsync(IUploadRequest uploadRequest) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 227
1407284503675470-532462766-2146233088Void MoveNext()TrueError uploading file chunkSystem.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.Net.Http.HttpRequestException: Error while copying content to a stream.
---> System.IO.IOException: Unable to write data to the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
  --- End of inner exception stack trace ---
  at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
  at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
  at System.Net.Security.SslStream.<WriteSingleChunk>g__CompleteWriteAsync|153_1[TIOAdapter](ValueTask writeTask, Byte[] bufferToReturn)
  at System.Net.Security.SslStream.WriteAsyncChunked[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
  at System.Net.Security.SslStream.WriteAsyncInternal[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnection.WriteAsync(ReadOnlyMemory`1 source, Boolean async)
  at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
  at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
  at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
  at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
  --- End of inner exception stack trace ---
  --- End of inner exception stack trace ---
  at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
  at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
  at VimeoDotNet.Net.ApiRequest.ExecuteRequestAsync() in /_/src/VimeoDotNet/Net/ApiRequest.cs:line 159
  at VimeoDotNet.VimeoClient.ContinueUploadFileAsync(IUploadRequest uploadRequest) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 227
VimeoDotNet-2146233088   at VimeoDotNet.VimeoClient.ContinueUploadFileAsync(IUploadRequest uploadRequest) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 255
  at VimeoDotNet.VimeoClient.UploadEntireFileAsync(IBinaryContent fileContent, Int64 chunkSize, Nullable`1 replaceVideoId, Action`1 statusCallback) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 76
  at WebAPP.Controllers.CourseLessonController.<>c__DisplayClass10_0.<<UploadFileToVimeo>b__0>d.MoveNext() in C:\Users\Dell\OneDrive\Desktop\Institute\WebAPP\Controllers\CourseLessonController.cs:line 186
  at VimeoDotNet.VimeoClient.ContinueUploadFileAsync(IUploadRequest uploadRequest) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 255
  at VimeoDotNet.VimeoClient.UploadEntireFileAsync(IBinaryContent fileContent, Int64 chunkSize, Nullable`1 replaceVideoId, Action`1 statusCallback) in /_/src/VimeoDotNet/VimeoClient_Upload.cs:line 76
  at WebAPP.Controllers.CourseLessonController.<>c__DisplayClass10_0.<<UploadFileToVimeo>b__0>d.MoveNext() in C:\Users\Dell\OneDrive\Desktop\Institute\WebAPP\Controllers\CourseLessonController.cs:line 186

my code

   private async Task<IUploadRequest> UploadFileToVimeo(IFormFile file, long? videoId)
    {
        string[] mediaExtensions = {
    ".WAV", ".MID",".AVI", ".MP4", ".DIVX", ".WMV",".MOV"};
        var extension = System.IO.Path.GetExtension(file.FileName);
        if (!mediaExtensions.Contains(extension.ToUpper())) throw new CustomException($"Invalid video format. Only [{string.Join(",", mediaExtensions)}] allowed");
        if (file.Length > 200 * 1024 * 1024) throw new CustomException("File Size cannot be more than 200MB");
        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        var vimeoClientId = _configuration.GetSection("VimeoClientId").Value;
        VimeoClient vimeoClient = new VimeoClient(vimeoClientId);
        var authCheck = await vimeoClient.GetAccountInformationAsync();

        byte[] fileBytes;
        using (var ms = new MemoryStream())
        {
            file.CopyTo(ms);
            fileBytes = ms.ToArray();
        }
        var binaryContent = new BinaryContent(fileBytes, file.ContentType);
        int chunkSize = 0;
        int contenetLength = (int)file.Length;
        int temp1 = contenetLength / (1048576);
        if (temp1 > 50)
        {
            chunkSize = 50485760;
        }
        else
        {
            chunkSize = temp1 * 1048576;
        }
        binaryContent.OriginalFileName = file.FileName;
        var response = Task.Run(async () => await vimeoClient.UploadEntireFileAsync(binaryContent, chunkSize, null)).Result;
        if (videoId != null && videoId > 0)
        {
            await vimeoClient.DeleteVideoAsync(videoId.Value);
        }
        return response;
    }

- i need to solve this issue soon as i am in deadline of issue .. please help

@mfilippov
Copy link
Owner

@roshangrg364 Sorry for the long delay. It looks like timeout from HTTP connection. Do you have a stable repro for this issue?

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

2 participants