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

do not invoke next.Close when connection not established #23

Merged
merged 2 commits into from
Sep 23, 2021

Conversation

pperiyasamy
Copy link
Member

This fixes too many stale interface and ovs port entries upon service request failure (due to IP Pool Empty error).

Signed-off-by: Periyasamy Palanisamy periyasamy.palanisamy@est.tech

Description

Issue link

How Has This Been Tested?

  • Added unit testing to cover
  • Tested manually
  • Tested by integration testing
  • Have not tested

Types of changes

  • Bug fix
  • New functionallity
  • Documentation
  • Refactoring
  • CI

Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
@edwarnicke
Copy link
Member

I'd recommend not using the Path to determine 'established'... instead fall back on fundamentals.

Since the normal pattern is:

  1. Decisions are made on the call direction of 'Request'
  2. Action is taken on the return direction of 'Request'

If a particular chain element experiences an error trying to do its work, it should call Close from itself down, to signal to all downstream chain elements to clean up after themselves, and then return an error.

But that 'Close' should only occur if the error originates in the chain element itself, if the error is returned from the downstream chain, the chain element should simply return the error up the chain. Since the chain element does its work on the return chain, simply returning the error means the chain element doesn't create the state it would otherwise need to cleanup.

Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
@pperiyasamy
Copy link
Member Author

I'd recommend not using the Path to determine 'established'... instead fall back on fundamentals.

yes, I totally forgot about this, now changed it back to use local metadata cache for connection established check.

Since the normal pattern is:

  1. Decisions are made on the call direction of 'Request'
  2. Action is taken on the return direction of 'Request'

If a particular chain element experiences an error trying to do its work, it should call Close from itself down, to signal to all downstream chain elements to clean up after themselves, and then return an error.

But that 'Close' should only occur if the error originates in the chain element itself, if the error is returned from the downstream chain, the chain element should simply return the error up the chain. Since the chain element does its work on the return chain, simply returning the error means the chain element doesn't create the state it would otherwise need to cleanup.

Yes Ed, this pattern is followed in client chain elements. The server chain elements slight vary from this i.e. do_its_work -> return_if_work_fails -> next.Request -> cleanup_its_work_done_previously_when_next_request_fails -> return. Hope this is fine with you.

@edwarnicke
Copy link
Member

Yes Ed, this pattern is followed in client chain elements. The server chain elements slight vary from this i.e. do_its_work -> return_if_work_fails -> next.Request -> cleanup_its_work_done_previously_when_next_request_fails -> return. Hope this is fine with you.

While there is always an exception to every rule... as a rule I find it is actually good to follow the 'add information/make decisions' on the call side of the Request and 'do work' on the return side works best for most server chain elements (especially for forwarders that are passthroughs).

@pperiyasamy
Copy link
Member Author

Yes Ed, this pattern is followed in client chain elements. The server chain elements slight vary from this i.e. do_its_work -> return_if_work_fails -> next.Request -> cleanup_its_work_done_previously_when_next_request_fails -> return. Hope this is fine with you.

While there is always an exception to every rule... as a rule I find it is actually good to follow the 'add information/make decisions' on the call side of the Request and 'do work' on the return side works best for most server chain elements (especially for forwarders that are passthroughs).

@edwarnicke created an issue #25 to track this work separately as it needs changes across other sdk repos too and realign of xconnect endpoint chain.

@pperiyasamy pperiyasamy merged commit 17e2053 into networkservicemesh:main Sep 23, 2021
@pperiyasamy pperiyasamy deleted the fix-stale-entries branch September 23, 2021 08:43
nsmbot pushed a commit to networkservicemesh/cmd-forwarder-ovs that referenced this pull request Sep 23, 2021
…k-ovs@main

PR link: networkservicemesh/sdk-ovs#23

Commit: 17e2053
Author: peri
Date: 2021-09-23 10:43:22 +0200
Message:
  - Merge pull request #23 from Nordix/fix-stale-entries
Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants