amazon-archives / aws-sdk-unity

ARCHIVED: The aws sdk for unity is now distributed as a part of aws sdk for dotnet:
https://github.com/aws/aws-sdk-net
Other
105 stars 43 forks source link

After successful upload of object using PostObjectAsync, after losing internet connection then uploading another, application hangs #110

Closed designzoo-peter closed 8 years ago

designzoo-peter commented 8 years ago

This tries to access a property of response, which is null. This is because after a failed connection, the UnityWebRequest object will throw an exception, which is caught here but will leave the property HttpResponse null. This causes issues here where an exception is thrown.

Tested in a scenario where I have previously done a PostObjectAsync, then 2 minutes later I do another PostObjectAsync.

Console shows the following:

recieved error response UnityEngine.Debug:Log(Object) Amazon.Runtime.Internal.Util.UnityDebugLogger:DebugFormat(String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/_unity/UnityDebugLogger.cs:74) Amazon.Runtime.Internal.Util.Logger:DebugFormat(String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/Logger.cs:189) Amazon.Runtime.Internal.Transform.UnityWebResponseData:.ctor(WWW) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Transform/_unity/UnityWebResponseData.cs:67) Amazon.Runtime.Internal.c__Iterator2:MoveNext() (at Assets/AWSSDK/src/Core/Amazon.Runtime/Pipeline/_unity/UnityMainThreadDispatcher.cs:133)

recieved = Couldn't resolve host 'MYBUCKET.s3.amazonaws.com' UnityEngine.Debug:Log(Object) Amazon.Runtime.Internal.Util.UnityDebugLogger:DebugFormat(String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/_unity/UnityDebugLogger.cs:74) Amazon.Runtime.Internal.Util.Logger:DebugFormat(String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/Logger.cs:189) Amazon.Runtime.Internal.Transform.UnityWebResponseData:.ctor(WWW) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Transform/_unity/UnityWebResponseData.cs:68) Amazon.Runtime.Internal.c__Iterator2:MoveNext() (at Assets/AWSSDK/src/Core/Amazon.Runtime/Pipeline/_unity/UnityMainThreadDispatcher.cs:133)

Status = 0 UnityEngine.Debug:Log(Object) Amazon.Runtime.Internal.Util.UnityDebugLogger:DebugFormat(String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/_unity/UnityDebugLogger.cs:74) Amazon.Runtime.Internal.Util.Logger:DebugFormat(String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/Logger.cs:189) Amazon.Runtime.Internal.Transform.UnityWebResponseData:.ctor(WWW) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Transform/_unity/UnityWebResponseData.cs:114) Amazon.Runtime.Internal.c__Iterator2:MoveNext() (at Assets/AWSSDK/src/Core/Amazon.Runtime/Pipeline/_unity/UnityMainThreadDispatcher.cs:133)

NullReferenceException: Object reference not set to an instance of an object Amazon.S3.AmazonS3Client.PostResponseHelper (IAsyncResult result) (at Assets/AWSSDK/src/Services/S3/Custom/_unity/AmazonS3Client.unity.cs:210) Amazon.S3.AmazonS3Client.ProcessPostResponse (IAsyncResult result) (at Assets/AWSSDK/src/Services/S3/Custom/_unity/AmazonS3Client.unity.cs:200) Amazon.Runtime.Internal.UnityMainThreadDispatcher+cIterator2.<>mE (System.Object state) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Pipeline/_unity/UnityMainThreadDispatcher.cs:161) UnityEngine.Debug:LogException(Exception) Amazon.Runtime.Internal.Util.UnityDebugLogger:Error(Exception, String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/_unity/UnityDebugLogger.cs:42) Amazon.Runtime.Internal.Util.Logger:Error(Exception, String, Object[]) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/Logger.cs:171) Amazon.Runtime.Internal.cIterator2:<>mE(Object) (at Assets/AWSSDK/src/Core/Amazon.Runtime/Pipeline/_unity/UnityMainThreadDispatcher.cs:171)

An exception was thrown from the callback method executed fromUnityMainThreadDispatcher.InvokeRequest method.

designzoo-peter commented 8 years ago

A correction to the title. Related to the same issue #108, is a request handles/encounters an error, the callback for that request is never triggered with an error state for example. This means application logic may not resume as it waits for success or failure from a call, but receives neither.

PLockhart commented 8 years ago

In case someone wants a temporary solution to this https://github.com/PLockhart/aws-sdk-unity/commit/d5f6afe6fbeeab086192e2646da5da3f101cc65a

Though ideally the issue should be investigated. Proper exception handling should mean that httpresponse should never be null, so how is this allowed to happen?

karthiksaligrama commented 8 years ago

Fixed in version 3 for aws sdk for unity. If you continue to face problems please raise a new issue on our dotnet sdk repository