-
Notifications
You must be signed in to change notification settings - Fork 109
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
Fix record discard/delete & subscribe race #209
Conversation
|
||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parts of this is probably still needed. In particular the MESSAGE_DENIED
part.
'between another clients creation and read message for the same record' is unclear.
travis fails since the test doesn't allow re-using/reviving record instances. |
This also resolve the issue of spamming subscribe/unsubscribe as there is a natural throttling. |
…subscribe behaviour to separate PR.
this._sendRead(); | ||
} | ||
else { | ||
this._clearTimeouts(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear timeout beredda to be moved to top and always be invoked.
@yasserf: tests pass |
I'm closing this as it's broken. |
Fixed issue. |
if( state === C.CONNECTION_STATE.OPEN && this._isReconnecting === true ) { | ||
this._isReconnecting = false; | ||
this._resubscribe(); | ||
} | ||
else if ( this._isReconnecting === false ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always want to reconnect when going from non OPEN to OPEN.
this._readAckTimeout = setTimeout( this._onTimeout.bind( this, C.EVENT.ACK_TIMEOUT ), this._options.recordReadAckTimeout ); | ||
this._readTimeout = setTimeout( this._onTimeout.bind( this, C.EVENT.RESPONSE_TIMEOUT ), this._options.recordReadTimeout ); | ||
this._sendRead(); | ||
this._resubscribeNotifier = new ResubscribeNotifier( this._client, this._sendRead.bind( this ), this._clearTimeouts.bind( this ), true ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply doing a clearTimeouts on disconnect is not good enough...
I don't think this PR is good enough. But the basic ideas are there. There are some edge cases that I don't think are properly handled. |
Yeah, we need to look into the discard/delete async case in more detail |
This needs to be solved in another way. We've resolved it locally in our fork in a different way. |
This is my try at fixing the discard/delete and subscribe data-races. #204
The basic idea is that the record can revive itself AFTER successful discard/delete, using the pending queue for the time between re-subscription and revival.
This ensures that there CAN BE ONLY ONE active record instance for the client avoiding the:
error cycle