Skip to content
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

Closed
wants to merge 9 commits into from

Conversation

ronag
Copy link

@ronag ronag commented Aug 9, 2016

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:

UNSOLICITED_MESSAGE
UNSOLICITED_MESSAGE
ACK_TIMEOUT
RESPONSE_TIMEOUT
MULTIPLE_SUBSCRIBTIONS

error cycle


return;
}

Copy link
Author

@ronag ronag Aug 9, 2016

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 97.243% when pulling ed77f03 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@ronag
Copy link
Author

ronag commented Aug 9, 2016

travis fails since the test doesn't allow re-using/reviving record instances.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 97.243% when pulling e7c4f4c on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.226% when pulling e8eaec8 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.226% when pulling e8eaec8 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.226% when pulling 1389963 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.226% when pulling 1389963 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.226% when pulling 1389963 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.226% when pulling c2fab75 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-65.8%) to 31.458% when pulling 9209a60 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.227% when pulling 2aaad33 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.227% when pulling c249ebc on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@ronag
Copy link
Author

ronag commented Aug 10, 2016

This also resolve the issue of spamming subscribe/unsubscribe as there is a natural throttling.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.224% when pulling 58dba54 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.224% when pulling 58dba54 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 97.243% when pulling 90c98b0 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 97.242% when pulling 6b1a649 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 97.242% when pulling 6b1a649 on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

this._sendRead();
}
else {
this._clearTimeouts();
Copy link
Author

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 97.242% when pulling 8641f5a on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@ronag ronag mentioned this pull request Aug 19, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 97.243% when pulling 462440b on nxtedition:fix/#204 into f8341be on deepstreamIO:master.

@ronag
Copy link
Author

ronag commented Aug 19, 2016

@yasserf: tests pass

@ronag ronag changed the title Fixed record discard/delete handling. Fix record discard/delete & subscribe race Aug 19, 2016
@ronag
Copy link
Author

ronag commented Aug 31, 2016

@yasserf: This PR has a race when disconnecting the client before the UNSUBSCRIBEDack. I'm currently in a state where I have no working solution or workaround to the issue #214.

@ronag
Copy link
Author

ronag commented Sep 1, 2016

I'm closing this as it's broken.

@ronag ronag closed this Sep 1, 2016
@ronag
Copy link
Author

ronag commented Sep 3, 2016

Fixed issue.

@ronag ronag reopened this Sep 3, 2016
if( state === C.CONNECTION_STATE.OPEN && this._isReconnecting === true ) {
this._isReconnecting = false;
this._resubscribe();
}
else if ( this._isReconnecting === false ) {
Copy link
Author

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.

@ronag
Copy link
Author

ronag commented Sep 3, 2016

#232

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 );
Copy link
Author

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...

@ronag
Copy link
Author

ronag commented Sep 4, 2016

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.

@yasserf
Copy link
Contributor

yasserf commented Sep 4, 2016

Yeah, we need to look into the discard/delete async case in more detail

@ronag ronag closed this Feb 17, 2017
@ronag
Copy link
Author

ronag commented Feb 17, 2017

This needs to be solved in another way. We've resolved it locally in our fork in a different way.

@ronag ronag deleted the fix/#204 branch November 14, 2018 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants