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

Crash in PostObjectAsync on Android #91

Closed flarb closed 8 years ago

flarb commented 8 years ago

Trying to use PostObjectAsync to an S3 bucket -- in the editor I don't get a crash, the post is successful, on Android PostObjectAsync crashes the app.

karthiksaligrama commented 8 years ago

Hi @flarb can you paste stack trace here?

flarb commented 8 years ago

So I posted another issue--which I think is the same one. I get these null pointer exceptions only on Android--they work fine in editor. I think these may we what's causing the crashes? I'll get you a stack trace if I can next.

Just clicking the ListObjects button on the demo on Android gives me these exceptions (it works fine in the Editor):

I/Unity (25194): Status = HTTP/1.1 200 OK I/Unity (25194):
I/Unity (25194): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) I/Unity (25194): I/Unity (25194): Received response (truncated to 0 bytes): [] I/Unity (25194):
I/Unity (25194): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) I/Unity (25194): I/Unity (25194): Request metrics: {"properties":{"AsyncCall":"False","ServiceName":"Amazon.CognitoIdentity","ServiceEndpoint":"https://cognito-identity.us-east-1.amazonaws.com/","MethodName":"GetCredentialsForIdentityRequest","RequestSize":"63","StatusCode":"OK","BytesProcessed":"1136","AWSRequestID":"3c5a3ad3-6339-11e5-bcac-01437547903d"},"timings":{"HttpRequestTime":805.8992,"ResponseUnmarshallTime":67.2578,"ResponseProcessingTime":90.1289,"ClientExecuteTime":934.8333},"counters":{}} I/Unity (25194):
I/Unity (25194): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) I/Unity (25194): I/Unity (25194): NullReferenceException: Object reference not set to an instance of an object I/Unity (25194): at Amazon.Util.CryptoUtilFactory+CryptoUtil.ComputeSHA256Hash (System.Byte[] data) [0x00000] in :0 I/Unity (25194): at Amazon.Runtime.Internal.Auth.AWS4Signer.SetRequestBodyHash (IRequest request) [0x00000] in :0 I/Unity (25194): at Amazon.Runtime.Internal.Auth.AWS4Signer.SignRequest (IRequest request, Amazon.Runtime.ClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in :0 I/Unity (25194): at Amazon.S3.Internal.S3Signer.Sign (IRequest request, Amazon.Runtime.ClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in :0 I/Unity (25194): at Amazon.Runtime.Internal.Signer.SignRequest (IRequestContext requestContext) [0x00000] in :0 I/Unity (25194): at Amazon.Runtime.Internal.Signer.PreInvoke (IExecutionContext execut E/Unity (25194): An exception of type NullReferenceException was thrown from InvokeAsyncCallback(). E/Unity (25194):
E/Unity (25194): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) E/Unity (25194): I/Unity (25194): Request metrics: {"properties":{"AsyncCall":"True","Exception":"System.NullReferenceException: Object reference not set to an instance of an object\n at Amazon.Util.CryptoUtilFactory+CryptoUtil.ComputeSHA256Hash (System.Byte[] data) [0x00000] in :0 \n at Amazon.Runtime.Internal.Auth.AWS4Signer.SetRequestBodyHash (IRequest request) [0x00000] in :0 \n at Amazon.Runtime.Internal.Auth.AWS4Signer.SignRequest (IRequest request, Amazon.Runtime.ClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in :0 \n at Amazon.S3.Internal.S3Signer.Sign (IRequest request, Amazon.Runtime.ClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in :0 \n at Amazon.Runtime.Internal.Signer.SignRequest (IRequestContext requestContext) [0x00000] in <filename unknown I/Unity (25194): Object reference not set to an instance of an object I/Unity (25194):
I/Unity (25194): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) I/Unity (25194): I/Unity (25194): NullReferenceException: Object reference not set to an instance of an object I/Unity (25194): at AWSSDK.Examples.S3Example.m8 (Amazon.Runtime.AmazonServiceResult`2 responseObject) [0x00000] in :0 I/Unity (25194): at Amazon.S3.AmazonS3Client+cAnonStorey6D.<>m__76 (Amazon.Runtime.AmazonWebServiceRequest req, Amazon.Runtime.AmazonWebServiceResponse res, System.Exception ex, Amazon.Runtime.AsyncOptions ao) [0x00000] in :0 I/Unity (25194): at Amazon.Runtime.Internal.UnityMainThreadDispatcher.ProcessRequests () [0x00000] in :0 I/Unity (25194): UnityEngine.Debug:Internal_LogException(Exception, Object) I/Unity (25194): UnityEngine.Debug:LogException(Exception) I/Unity (25194): Amazon.Runtime.Internal.Util.UnityDebugLogger:Error(Exception, String, Object[]) I/Unity (25194): Amazon.Runtime.Internal.Util.Logger:Error(Exception, String, Object[]) I/Unity (25194): Amazon.Runtime.Internal.UnityMainThreadDispatcher:ProcessRequests() I/Unity (25194):
I/Unity (25194): (Filename: Line: -1) I/Unity (25194): E/Unity (25194): An unhandled exception was thrown from the callback method Amazon.S3.Model.ListObjectsRequest. E/Unity (25194):
E/Unity (25194): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) E/Unity (25194):

flarb commented 8 years ago

This is the output from logcat--which isn't much of a stack trace. But the happens when I call PostObject:

I/DEBUG ( 163): r0 4a1a7a80 r1 0000026a r2 b5567870 r3 4a1a9000 I/DEBUG ( 163): r4 48490c1c r5 53b36270 r6 53b4dce4 r7 53d5d4e0 I/DEBUG ( 163): r8 483bad70 r9 5a8f8000 sl 4a17a42c fp 5a9f6cf4 I/DEBUG ( 163): ip 00000000 sp 5a9f6cd8 lr 48385bbc pc 482677b4 cpsr 800d0010 I/DEBUG ( 163): d0 00220020002c0022 d1 00790065006b0024 I/DEBUG ( 163): d2 002d007300740072 d3 0068007400690077 I/DEBUG ( 163): d4 0000000000000000 d5 000001f6c0000000 I/DEBUG ( 163): d6 407f680000000000 d7 407f600000000000 I/DEBUG ( 163): d8 0000000000000000 d9 0000000000000000 I/DEBUG ( 163): d10 0000000000000000 d11 0000000000000000 I/DEBUG ( 163): d12 0000000000000000 d13 0000000000000000 I/DEBUG ( 163): d14 0000000000000000 d15 0000000000000000 I/DEBUG ( 163): d16 41b1c9a8472063a0 d17 0000000000000000 I/DEBUG ( 163): d18 0000000000000000 d19 0000000000000000 I/DEBUG ( 163): d20 0000000000000000 d21 51e15990ffffffff I/DEBUG ( 163): d22 0000000000000000 d23 0000000000000000 I/DEBUG ( 163): d24 3ff0000000000000 d25 4082c00000000000 I/DEBUG ( 163): d26 3ada740e00000000 d27 0000000000000000 I/DEBUG ( 163): d28 0000000000000000 d29 00000000ba83126f I/DEBUG ( 163): d30 0000000000000000 d31 3f80000000000000 I/DEBUG ( 163): scr 2000001b I/DEBUG ( 163): I/DEBUG ( 163): backtrace: I/DEBUG ( 163): #00 pc 001677b4 /data/app-lib/com.flarb.arwars-2/libmono.so (mono_string_hash+80) I/DEBUG ( 163): #01 pc 00285bb8 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #02 pc 00285ce4 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #03 pc 00286790 /data/app-lib/com.flarb.arwars-2/libmono.so (mono_g_hash_table_insert_replace+136) I/DEBUG ( 163): #04 pc 00286948 /data/app-lib/com.flarb.arwars-2/libmono.so (mono_g_hash_table_insert+40) I/DEBUG ( 163): #05 pc 001f77dc /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #06 pc 001f7634 /data/app-lib/com.flarb.arwars-2/libmono.so (mono_ldstr+140) I/DEBUG ( 163): #07 pc 000686e4 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #08 pc 0001d8f4 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #09 pc 0001fa54 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #10 pc 00020778 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #11 pc 00020978 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #12 pc 001ecbb0 /data/app-lib/com.flarb.arwars-2/libmono.so (mono_compile_method+84) I/DEBUG ( 163): #13 pc 000e98b8 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #14 pc 00002054 I/DEBUG ( 163): I/DEBUG ( 163): stack: I/DEBUG ( 163): 5a9f6c98 00000000
I/DEBUG ( 163): 5a9f6c9c 00000000
I/DEBUG ( 163): 5a9f6ca0 00000000
I/DEBUG ( 163): 5a9f6ca4 00000000
I/DEBUG ( 163): 5a9f6ca8 00000000
I/DEBUG ( 163): 5a9f6cac 00000000
I/DEBUG ( 163): 5a9f6cb0 00000000
I/DEBUG ( 163): 5a9f6cb4 00000000
I/DEBUG ( 163): 5a9f6cb8 00000000
I/DEBUG ( 163): 5a9f6cbc 00000000
I/DEBUG ( 163): 5a9f6cc0 00000000
I/DEBUG ( 163): 5a9f6cc4 00000000
I/DEBUG ( 163): 5a9f6cc8 00000000
I/DEBUG ( 163): 5a9f6ccc 00000000
I/DEBUG ( 163): 5a9f6cd0 df0027ad
I/DEBUG ( 163): 5a9f6cd4 00000000
I/DEBUG ( 163): #00 5a9f6cd8 53b34310 [anon:libc_malloc] I/DEBUG ( 163): 5a9f6cdc 4a1a7a80
I/DEBUG ( 163): 5a9f6ce0 60000000 /data/dalvik-cache/system@framework@boot.art I/DEBUG ( 163): 5a9f6ce4 a2c0b990
I/DEBUG ( 163): 5a9f6ce8 00000aba
I/DEBUG ( 163): 5a9f6cec 4a1a9000
I/DEBUG ( 163): 5a9f6cf0 00000337
I/DEBUG ( 163): 5a9f6cf4 5a9f6d1c [stack:27772] I/DEBUG ( 163): #01 5a9f6cf8 53b275f8 [anon:libc_malloc] I/DEBUG ( 163): 5a9f6cfc 4a281fa0
I/DEBUG ( 163): 5a9f6d00 596f7020
I/DEBUG ( 163): 5a9f6d04 0000026a
I/DEBUG ( 163): 5a9f6d08 4d6b4c00
I/DEBUG ( 163): 5a9f6d0c 000000fb
I/DEBUG ( 163): 5a9f6d10 596f7020
I/DEBUG ( 163): 5a9f6d14 000000ba
I/DEBUG ( 163): 5a9f6d18 5a9f6d34 [stack:27772] I/DEBUG ( 163): 5a9f6d1c 48385ce8 /data/app-lib/com.flarb.arwars-2/libmono.so I/DEBUG ( 163): #02 5a9f6d20 53d5f780
I/DEBUG ( 163): 5a9f6d24 4a281fa0
I/DEBUG ( 163): 5a9f6d28 0000001c
I/DEBUG ( 163): 5a9f6d2c 0000029e
I/DEBUG ( 163): 5a9f6d30 5a9f6d64 [stack:27772] I/DEBUG ( 163): 5a9f6d34 48386794 /data/app-lib/com.flarb.arwars-2/libmono.so (mono_g_hash_table_insert_replace+140)

karthiksaligrama commented 8 years ago

thanks. can you also tell me what version of unity are you using and also if this is using android il2cpp or mono backend?

designzoo-peter commented 8 years ago

I am also crashing on iOS, with Unity 5.1, using mono backend. There is no stack trace posted in XCode unfortunately. In IL2CPP iOS uploads without a crash.

When I use Mono with iOS, I get the following console logs (with some of the text strings snipped out):

recieved successful response

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

{"Credentials": -SNIPPED-}

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

Status = OK

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

Received response (truncated to 4096 bytes): [{"Credentials":-SNIPPED-]

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

Request metrics: {"properties":-SNIPPED-}

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

Ran out of trampolines of type 2 in '/private/var/mobile/Containers/Bundle/Application/C79D976D-A6D9-4D70-BBD6-5184E24CBB8B/Testify.app/Data/Managed/mscorlib.dll' (128)

jdmiranda commented 8 years ago

you can increase the number of trampolines inside of zcode. its iOS specific. those are used for reflection inios. things like json parsing use trampoline. also they don't get garbage collected so they are there for full app life cycle.

karthiksaligrama commented 8 years ago

go to Player Settings > Other Settings and set the AOT option to nimt-trampolines=512

karthiksaligrama commented 8 years ago

Assuming problem is solved. Closing issue. Please reopen if problem persists