Giter VIP home page Giter VIP logo

Comments (2)

brennanMKE avatar brennanMKE commented on September 25, 2024

I've been tracing into the issue. In Xcode I set a symbolic breakpoint on aws_retry_token_release with a log message a debugger command to get more details about the backtrace.

👋 called aws_retry_token_release for @token@

This log message logs the pointer for that token so I can see when the same token is released more than once. I use the bt command to get the backtrace of 2 positions or more to see how the release function is called.

bt 2

Seeing this backtrace in the logs show that breakpoint was reached with the source files and line numbers. After running the a Storage operation and trimming unrelated log messages I get the log below.

log
👋 acquired token 0x13491df20
👋 called aws_retry_token_release for 0x13491df20
* thread #11, stop reason = breakpoint 2.1
  * frame #0: 0x000000010140c0e8 Storage`aws_retry_token_release(token=0x000000013491df20) at retry_strategy.c:56:61
    frame #1: 0x0000000101415dbc Storage`s_on_standard_retry_token_acquired(retry_strategy=0x000000013b551b60, error_code=0, token=0x0000000134e26140, user_data=0x000000013491df20) at standard_retry_strategy.c:127:5
    frame #2: 0x00000001013ccd1c Storage`s_exponential_retry_task(task=0x0000000134e26198, arg=0x0000000134e26140, status=AWS_TASK_STATUS_RUN_READY) at exponential_backoff_retry_strategy.c:84:9
    frame #3: 0x0000000101371150 Storage`aws_task_run(task=0x0000000134e26198, status=AWS_TASK_STATUS_RUN_READY) at task_scheduler.c:44:5
👋 SDKRetryer for 0x13491df20
* thread #6, queue = 'com.apple.root.user-initiated-qos.cooperative', stop reason = breakpoint 3.1
  * frame #0: 0x00000001011535d8 Storage`SDKRetryer.releaseToken(token=ClientRuntime.RetryToken @ 0x00000001543a2920, self=0x000000013b070030) at SDKRetryer.swift:38:9
    frame #1: 0x000000010100b5b4 Storage`$defer #1 <Output, OutputError><H>(self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x00000001543a28a0, token=ClientRuntime.RetryToken @ 0x00000001543a28e0) in RetryerMiddleware.tryRequest<Output>(token:errorType:partitionId:context:input:next:) at RetryerMiddleware.swift:56:31
    frame #2: 0x0000000101007d28 Storage`RetryerMiddleware.tryRequest<Output>(token=ClientRuntime.RetryToken @ 0x000000013481ca48, errorType=nil, partitionId="S3 - us-west-2)", context=$s13ClientRuntime11HttpContextVD @ 0x000000013481ca20, input=0x000000013b967b30, next=<unavailable>, self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x000000013481c9f8) at RetryerMiddleware.swift:56:21
    frame #3: 0x00000001010060c4 Storage`RetryerMiddleware.handle<Output>(context=$s13ClientRuntime11HttpContextVD @ 0x000000013481c8b0, input=0x000000013b967b30, next=<unavailable>, self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x000000013481c898) at RetryerMiddleware.swift:35
    frame #4: 0x000000010100bfcc Storage`protocol witness for Middleware.handle<A>(context:input:next:) in conformance RetryerMiddleware<A, B> at <compiler-generated>:0
👋 called aws_retry_token_release for 0x13491df20
* thread #6, queue = 'com.apple.root.user-initiated-qos.cooperative', stop reason = breakpoint 2.1
  * frame #0: 0x000000010140c0e8 Storage`aws_retry_token_release(token=0x000000013491df20) at retry_strategy.c:56:61
    frame #1: 0x00000001012c1b0c Storage`CRTAWSRetryStrategy.releaseToken(token=0x000000014b929680, self=0x00000001346be940) at CRTAWSRetryStrategy.swift:101:9
    frame #2: 0x000000010115361c Storage`SDKRetryer.releaseToken(token=ClientRuntime.RetryToken @ 0x00000001543a2920, self=0x000000013b070030) at SDKRetryer.swift:38:26
    frame #3: 0x000000010100b5b4 Storage`$defer #1 <Output, OutputError><H>(self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x00000001543a28a0, token=ClientRuntime.RetryToken @ 0x00000001543a28e0) in RetryerMiddleware.tryRequest<Output>(token:errorType:partitionId:context:input:next:) at RetryerMiddleware.swift:56:31

The deinit function in CRTAWSRetryToken was commented out so it did not release the token. That is what has been causing this runtime exception. The only other place in the scope of the Swift CRT package is called is SDKRetryer which is called by RetryerMiddleware in a defer block which is not called until after an await allows for leaving that do/catch block and the function. It will always be called due to this middleware. The call to release from the deinit function appears to be redundant. Commenting it out also prevents the Address Sanitizer from reporting a problem.

log
Thread 8 Queue : com.apple.root.user-initiated-qos.cooperative (serial)
#0	0x000000010a21a6d0 in __asan::AsanDie() ()
#1	0x000000010a22fe48 in __sanitizer::Die() ()
#2	0x000000010a2189e8 in __asan::ScopedInErrorReport::~ScopedInErrorReport() ()
#3	0x000000010a2182d8 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ()
#4	0x000000010a21927c in __asan_report_store8 ()
#5	0x0000000101fb3db8 in aws_atomic_fetch_sub_explicit at jeffb/aws-crt-swift/aws-common-runtime/aws-c-common/include/aws/common/atomics_gnu.inl:174
#6	0x0000000101fb4124 in aws_retry_token_release at jeffb/aws-crt-swift/aws-common-runtime/aws-c-io/source/retry_strategy.c:61
#7	0x0000000101e6b648 in CRTAWSRetryToken.deinit at jeffb/aws-crt-swift/Source/AwsCommonRuntimeKit/io/retryer/CRTAWSRetryToken.swift:15
#8	0x0000000101e6b824 in CRTAWSRetryToken.__deallocating_deinit ()
#9	0x000000010e166554 in _swift_release_dealloc ()
#10	0x0000000101bae2d4 in RetryerMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/RetryerMiddleware.swift:35
#11	0x0000000101bb3ef8 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance RetryerMiddleware<τ_0_0, τ_0_1> ()
#12	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#13	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#14	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#15	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#16	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#17	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#18	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#19	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#20	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#21	0x0000000101c8aa58 in ContentLengthMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Networking/Http/Middlewares/ContentLengthMiddleware.swift:33
#22	0x0000000101c8b270 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance ContentLengthMiddleware<τ_0_0> ()
#23	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#24	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#25	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#26	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#27	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#28	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#29	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#30	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#31	0x0000000101c2c1b0 in MiddlewareStep.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/MiddlewareStep.swift:45
#32	0x0000000101c2e030 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance MiddlewareStep<τ_0_0, τ_0_1, τ_0_2> ()
#33	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#34	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#35	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#36	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#37	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#38	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#39	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#40	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#41	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#42	0x0000000101c42a14 in BuildStepHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/Steps/BuildStep.swift:33
#43	0x0000000101c43128 in protocol witness for Handler.handle(context:input:) in conformance BuildStepHandler<τ_0_0, τ_0_1> ()
#44	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#45	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#46	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#47	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#48	0x0000000101baadc4 in EndpointResolverMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/EndpointResolverMiddleware.swift:65
#49	0x0000000101bab46c in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance EndpointResolverMiddleware<τ_0_0, τ_0_1> ()
#50	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#51	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#52	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#53	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#54	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#55	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#56	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#57	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#58	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#59	0x0000000101bc4918 in UserAgentMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/UserAgentMiddleware.swift:33
#60	0x0000000101bc4fd0 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance UserAgentMiddleware<τ_0_0> ()
#61	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#62	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#63	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#64	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#65	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#66	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#67	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#68	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#69	0x0000000101c2c1b0 in MiddlewareStep.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/MiddlewareStep.swift:45
#70	0x0000000101c2e030 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance MiddlewareStep<τ_0_0, τ_0_1, τ_0_2> ()
#71	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#72	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#73	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#74	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#75	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#76	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#77	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#78	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#79	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#80	0x0000000101c4b678 in SerializeStepHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/Steps/SerializeStep.swift:34
#81	0x0000000101c4bdec in protocol witness for Handler.handle(context:input:) in conformance SerializeStepHandler<τ_0_0, τ_0_1, τ_0_2> ()
#82	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#83	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#84	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#85	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#86	0x0000000101c90858 in ContentTypeMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Networking/Http/Middlewares/ContentTypeMiddleware.swift:27
#87	0x0000000101c91038 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance ContentTypeMiddleware<τ_0_0, τ_0_1> ()
#88	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#89	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#90	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#91	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#92	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#93	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#94	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#95	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#96	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#97	0x0000000101ca3780 in SerializableBodyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Networking/Http/Middlewares/SerializableBodyMiddleware.swift:29
#98	0x0000000101ca3fc4 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance SerializableBodyMiddleware<τ_0_0, τ_0_1> ()
#99	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#100	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#101	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#102	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#103	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#104	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#105	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#106	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#107	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#108	0x0000000101bc6dd4 in XAmzTargetMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/XAmzTargetMiddleware.swift:25
#109	0x0000000101bc75b4 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance XAmzTargetMiddleware<τ_0_0, τ_0_1> ()
#110	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#111	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#112	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#113	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#114	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#115	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#116	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#117	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#118	0x0000000101c2c1b0 in MiddlewareStep.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/MiddlewareStep.swift:45
#119	0x0000000101c2e030 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance MiddlewareStep<τ_0_0, τ_0_1, τ_0_2> ()
#120	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#121	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#122	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#123	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#124	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#125	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#126	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#127	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#128	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#129	0x0000000101c49758 in InitializeStepHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/Steps/InitializeStep.swift:36
#130	0x0000000101c4a148 in protocol witness for Handler.handle(context:input:) in conformance InitializeStepHandler<τ_0_0, τ_0_1, τ_0_2> ()
#131	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#132	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#133	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#134	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#135	0x0000000101ca622c in URLHostMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Networking/Http/Middlewares/URLHostMiddleware.swift:36
#136	0x0000000101ca6938 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance URLHostMiddleware<τ_0_0, τ_0_1> ()
#137	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#138	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#139	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#140	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#141	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#142	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#143	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#144	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#145	0x0000000101c1f484 in protocol witness for Handler.handle(context:input:) in conformance AnyHandler<τ_0_0, τ_0_1, τ_0_2> ()
#146	0x0000000101ca9164 in URLPathMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Networking/Http/Middlewares/URLPathMiddleware.swift:34
#147	0x0000000101ca9bd8 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance URLPathMiddleware<τ_0_0, τ_0_1, τ_0_2> ()
#148	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#149	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#150	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#151	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#152	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#153	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#154	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#155	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#156	0x0000000101c2c1b0 in MiddlewareStep.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/MiddlewareStep.swift:45
#157	0x0000000101c2e030 in protocol witness for Middleware.handle<τ_0_0>(context:input:next:) in conformance MiddlewareStep<τ_0_0, τ_0_1, τ_0_2> ()
#158	0x0000000101c21450 in implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#159	0x0000000101c218a8 in partial apply for implicit closure #2 in implicit closure #1 in AnyMiddleware.init<τ_0_0>(_:) ()
#160	0x0000000101c22c5c in AnyMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyMiddleware.swift:36
#161	0x0000000101c285ec in ComposedHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/ComposedHandler.swift:27
#162	0x0000000101c28b8c in protocol witness for Handler.handle(context:input:) in conformance ComposedHandler<τ_0_0, τ_0_1, τ_0_2> ()
#163	0x0000000101c1e634 in implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#164	0x0000000101c1ea60 in partial apply for implicit closure #2 in implicit closure #1 in AnyHandler.init<τ_0_0>(_:) ()
#165	0x0000000101c1eec0 in AnyHandler.handle(context:input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/AnyHandler.swift:18
#166	0x0000000101c34140 in OperationStack.handleMiddleware<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Middleware/OperationStack.swift:42
#167	0x0000000103687e8c in CognitoIdentityClient.getId(input:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/release/AWSCognitoIdentity/CognitoIdentityClient.swift:394
#168	0x00000001014f27fc in protocol witness for CognitoIdentityBehavior.getId(input:) in conformance CognitoIdentityClient ()
#169	0x000000010157ea80 in closure #1 in FetchAuthIdentityId.execute(withDispatcher:environment:) at jeffb/amplify-ios/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/FetchAuthorizationSession/FetchIdentity/FetchAuthIdentityId.swift:44
#170	0x00000001015817ac in partial apply for closure #1 in FetchAuthIdentityId.execute(withDispatcher:environment:) ()
#171	0x000000010155a444 in thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out τ_0_0) ()
#172	0x000000010155a724 in partial apply for thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out τ_0_0) ()

There are many layers to the middleware calls.

The log messages below shows this sequence.

  1. Acquire token 0x137c2a220
  2. RetryerMiddleware defer block
  3. SDKRetryer.releaseToken
  4. CRTAWSRetryStrategy.releaseToken
  5. aws_retry_token_release
  6. CRTAWSRetryToken.deinit

The redundant call to aws_retry_token_release is commented out and there is no runtime exception or error reported by Address Sanitizer.

log
👋 acquired token 0x137c2a220
👋 called aws_retry_token_release for 0x137c2a220
* thread #11, stop reason = breakpoint 2.1
  * frame #0: 0x0000000101380068 Storage`aws_retry_token_release(token=0x0000000137c2a220) at retry_strategy.c:56:61
    frame #1: 0x0000000101389d3c Storage`s_on_standard_retry_token_acquired(retry_strategy=0x000000013b053680, error_code=0, token=0x000000013813a3c0, user_data=0x0000000137c2a220) at standard_retry_strategy.c:127:5
    frame #2: 0x0000000101340c9c Storage`s_exponential_retry_task(task=0x000000013813a418, arg=0x000000013813a3c0, status=AWS_TASK_STATUS_RUN_READY) at exponential_backoff_retry_strategy.c:84:9
    frame #3: 0x00000001012e50d0 Storage`aws_task_run(task=0x000000013813a418, status=AWS_TASK_STATUS_RUN_READY) at task_scheduler.c:44:5
👋 SDKRetryer for 0x137c2a220
* thread #9, queue = 'com.apple.root.user-initiated-qos.cooperative', stop reason = breakpoint 3.1
  * frame #0: 0x00000001010c738c Storage`SDKRetryer.releaseToken(token=ClientRuntime.RetryToken @ 0x0000000154d6ef20, self=0x000000013ab718f0) at SDKRetryer.swift:38:9
    frame #1: 0x0000000100f7f368 Storage`$defer #1 <Output, OutputError><H>(self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x0000000154d6eea0, token=ClientRuntime.RetryToken @ 0x0000000154d6eee0) in RetryerMiddleware.tryRequest<Output>(token:errorType:partitionId:context:input:next:) at RetryerMiddleware.swift:56:31
    frame #2: 0x0000000100f7badc Storage`RetryerMiddleware.tryRequest<Output>(token=ClientRuntime.RetryToken @ 0x0000000137b2f748, errorType=nil, partitionId="S3 - us-west-2)", context=$s13ClientRuntime11HttpContextVD @ 0x0000000137b2f720, input=0x000000013b422e80, next=<unavailable>, self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x0000000137b2f6f8) at RetryerMiddleware.swift:56:21
    frame #3: 0x0000000100f79e78 Storage`RetryerMiddleware.handle<Output>(context=$s13ClientRuntime11HttpContextVD @ 0x0000000137b2f5b0, input=0x000000013b422e80, next=<unavailable>, self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x0000000137b2f598) at RetryerMiddleware.swift:35
    frame #4: 0x0000000100f7fd80 Storage`protocol witness for Middleware.handle<A>(context:input:next:) in conformance RetryerMiddleware<A, B> at <compiler-generated>:0
👋 called aws_retry_token_release for 0x137c2a220
* thread #9, queue = 'com.apple.root.user-initiated-qos.cooperative', stop reason = breakpoint 2.1
  * frame #0: 0x0000000101380068 Storage`aws_retry_token_release(token=0x0000000137c2a220) at retry_strategy.c:56:61
    frame #1: 0x00000001012358c0 Storage`CRTAWSRetryStrategy.releaseToken(token=0x000000014c428ae0, self=0x00000001379bd260) at CRTAWSRetryStrategy.swift:101:9
    frame #2: 0x00000001010c73d0 Storage`SDKRetryer.releaseToken(token=ClientRuntime.RetryToken @ 0x0000000154d6ef20, self=0x000000013ab718f0) at SDKRetryer.swift:38:26
    frame #3: 0x0000000100f7f368 Storage`$defer #1 <Output, OutputError><H>(self=AWSClientRuntime.RetryerMiddleware<AWSS3.GetObjectOutputResponse, AWSS3.GetObjectOutputError> @ 0x0000000154d6eea0, token=ClientRuntime.RetryToken @ 0x0000000154d6eee0) in RetryerMiddleware.tryRequest<Output>(token:errorType:partitionId:context:input:next:) at RetryerMiddleware.swift:56:31
👋 deinit 0x137c2a220
* thread #9, queue = 'com.apple.root.user-initiated-qos.cooperative', stop reason = breakpoint 4.1
  * frame #0: 0x000000010123746c Storage`CRTAWSRetryToken.deinit(self=0x000000014c428ae0) at CRTAWSRetryToken.swift:16:15
    frame #1: 0x00000001012377a4 Storage`CRTAWSRetryToken.__deallocating_deinit(self=0x000000014c428ae0) at CRTAWSRetryToken.swift:0
    frame #2: 0x000000010d5fe554 libswiftCore.dylib`_swift_release_dealloc + 28

Since the token is always released due to the middleware it does not appear it also needs to be released in deinit.

There are a series of packages involved which are in this order.

Name Package Purpose
Amplify aws-amplify/amplify-ios Swift client library
AWS SDK awslabs/aws-sdk-swift AWS Swift SDK & middleware
CRT SDK awslabs/aws-crt-swift Swift & C integration
CRT awslabs/aws-c-common (*) Common Runtime (C code)

(*) multiple packages with C code make up the full CRT.

Who owns the token?

The memory lifecyle must be managed manually from allocating to releasing memory. An owner should be defined clearly so the lifecycle can be managed.

The public API for CRT SDK includes SDKRetryer which calls acquireToken and later releaseToken and it calls the private CRTAWSRetryStrategy class which calls acquireTokenFromCRT to create the token. SDKRetryer is used by the middleware from the Swift SDK which acquires and releases the token with the public API provided by Swift CRT. It appears that SDKRetryer is the owner.

Below are the stackframes showing the memory lifecyle for allocating and releasing the token.

#0	0x00000001011be1f4 in SDKRetryer.acquireToken(partitionId:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Retries/SDKRetryer.swift:24
#1	0x0000000101071188 in RetryerMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/RetryerMiddleware.swift:34
#0	0x00000001011bf2fc in SDKRetryer.releaseToken(token:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/smithy-swift/Packages/ClientRuntime/Sources/Retries/SDKRetryer.swift:37
#1	0x0000000101077368 in $defer #1 <τ_0_0, τ_0_1><τ_1_0>() in RetryerMiddleware.tryRequest<τ_0_0>(token:errorType:partitionId:context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/RetryerMiddleware.swift:56
#2	0x0000000101073adc in RetryerMiddleware.tryRequest<τ_0_0>(token:errorType:partitionId:context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/RetryerMiddleware.swift:56
#3	0x0000000101071e78 in RetryerMiddleware.handle<τ_0_0>(context:input:next:) at /Users/jeffb/Library/Developer/Xcode/DerivedData/Storage-etgncjgczqcxkqelrwaficqpcfbj/SourcePackages/checkouts/aws-sdk-swift/AWSClientRuntime/Sources/Middlewares/RetryerMiddleware.swift:35

Dropping the deinit function from CRTAWSRetryToken appears to be the fix to prevent the runtime exception.

from aws-crt-swift.

waahm7 avatar waahm7 commented on September 25, 2024

CRT no longer have a manual release token. The token will get released automatically using ARC.

from aws-crt-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.