awslabs / amazon-kinesis-video-streams-pic

Apache License 2.0
49 stars 51 forks source link

[BUG] Client state machine retryCnt is not reset #107

Closed Nomidia closed 3 years ago

Nomidia commented 3 years ago

Logging

16:38:36 [14:08:35.302] /mnt/hgfs/Share/IOT_ORIGNAL/branches/GodrejDev/app/Net/AwsKvstream/KvstreamManager.cpp====>(Func = StartStream, line = 241)
16:38:36 2021-01-04 08:38:35 DEBUG   curlApiCallbacksShutdownActiveRequests(): pActiveRequests hashtable is empty
16:38:37 2021-01-04 08:38:35 DEBUG   defaultStreamShutdownCallback(): Reported streamShutdown callback for stream handle 43898340
16:38:37 2021-01-04 08:38:35 WARN    resetStateMachineRetryCount(): Enter
16:38:37 2021-01-04 08:38:35 WARN    resetStateMachineRetryCount(): Leave, retStatus=0x00000000
16:38:37 stepStateMachine[137] Enter,  StateMachine=0x29c88ec
16:38:37 2021-01-04 08:38:35 WARN    fromDescribeStreamState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    fromDescribeStreamState(): Leave
16:38:37 2021-01-04 08:38:35 WARN    getStateMachineState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    getStateMachineState(): Leave, retStatus=0x00000000
16:38:37 2021-01-04 08:38:35 DEBUG   stepStateMachine(): Check State Machine StateMachine=0x29c88ec - Current state: 0x0000000000000002, Next state: 0x0000000000000200
16:38:37 2021-01-04 08:38:35 WARN    acceptStateMachineState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    acceptStateMachineState(): Leave, retStatus=0x00000000
16:38:37 2021-01-04 08:38:35 DEBUG   stepStateMachine(): State Machine StateMachine=0x29c88ec - Current state: 0x0000000000000002, Next state: 0x0000000000000200
16:38:37 2021-01-04 08:38:35 WARN    executeStoppedStreamState(): Enter
16:38:37 stepStateMachine[137] Enter,  StateMachine=0x29c88ec
16:38:37 2021-01-04 08:38:35 WARN    fromStoppedStreamState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    fromStoppedStreamState(): Leave
16:38:37 2021-01-04 08:38:35 WARN    getStateMachineState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    getStateMachineState(): Leave, retStatus=0x00000000
16:38:37 2021-01-04 08:38:35 DEBUG   stepStateMachine(): Check State Machine StateMachine=0x29c88ec - Current state: 0x0000000000000200, Next state: 0x0000000000000002
16:38:37 2021-01-04 08:38:35 WARN    acceptStateMachineState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    acceptStateMachineState(): Leave, retStatus=0x00000000
16:38:37 2021-01-04 08:38:35 DEBUG   stepStateMachine(): State Machine StateMachine=0x29c88ec - Current state: 0x0000000000000200, Next state: 0x0000000000000002
16:38:37 2021-01-04 08:38:35 WARN    executeDescribeStreamState(): Enter
16:38:37 executeDescribeStreamState[74] Enter
16:38:37 stepStateMachine[137] Enter,  StateMachine=0x29e0a6c
16:38:37 2021-01-04 08:38:35 DEBUG   fromAuthClientState(): authType=2
16:38:37 
16:38:37 2021-01-04 08:38:35 DEBUG   fromAuthClientState(): pKinesisVideoClient->tokenAuthInfo.expiration=16097493480237950, currentTime=16097495157537610
16:38:37 
16:38:37 2021-01-04 08:38:35 WARN    fromAuthClientState(): Invalid auth token as it is expiring in less than 30 seconds
16:38:37 2021-01-04 08:38:35 WARN    getStateMachineState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    getStateMachineState(): Leave, retStatus=0x00000000
16:38:37 2021-01-04 08:38:35 DEBUG   stepStateMachine(): Check State Machine StateMachine=0x29e0a6c - Current state: 0x0000000000000002, Next state: 0x0000000000000002
16:38:37 2021-01-04 08:38:35 WARN    acceptStateMachineState(): Enter
16:38:37 2021-01-04 08:38:35 WARN    acceptStateMachineState(): Leave, retStatus=0x00000000
16:38:37 2021-01-04 08:38:35 DEBUG   stepStateMachine(): pStateMachineImpl->context.retryCount=6, pState->retry=5
16:38:37 stepStateMachine[191] Leave, retStatus=0x52000040
16:38:37 executeDescribeStreamState[103] Leave, retStatus=0x52000040
16:38:37 2021-01-04 08:38:35 WARN    executeDescribeStreamState(): Leave
16:38:37 stepStateMachine[191] Leave, retStatus=0x52000040
16:38:37 2021-01-04 08:38:35 WARN    executeStoppedStreamState(): Leave
16:38:37 stepStateMachine[191] Leave, retStatus=0x52000040
16:38:37 [14:08:35.766] kinesisVideoStreamResetStream, retStatus=0x52000040

Describe the bug After resetStream returns an error, we need to call resetStream again until it succeeds. In resetStream, the retryCnt of state machine needs to be reset. But the retryCount will be accumulated, although the resetStream has been called. Actually, there are two state machines that need to be reset, stream and client.

https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/d580ad84fb6e1de6fe131ccb7bc575e17051bea6/src/client/src/Stream.c#L3322-L3324

Nomidia commented 3 years ago

108

MushMal commented 3 years ago

Merged. Thanks for the contribution