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

[sdk#1111] Fix sendfd issue on URL change #1112

Merged
merged 6 commits into from
Oct 20, 2021

Conversation

Bolodya1997
Copy link

Description

  1. Clones Request in roundrobin, interpose, discover.
  2. Puts dial before additionalFunctionality in client chain.
  3. Copies opts in sendfd, recvfd clients.

Issue link

Closes #1111.

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

Vladimir Popov added 4 commits October 20, 2021 10:15
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
Comment on lines -60 to -61
append(
opts.additionalFunctionality,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to change this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of URL change dial.Client does the following on Request:

  1. Close old URL.
  2. Request new URL.

If we have sendfd.Client in the chain before it does the following on Request:

  1. insert grpcfd.PerRPCCredentials to the call options.

grpcfd.PerRPCCredentials does the following:

  1. Store fds that needs to be sent.
  2. On first gRPC interaction send them and remember connection as a FDTransceiver.
  3. Cleanup all stored fds.

So it results in the following:

  1. dial closes old URL - PerRPCCredentials sends all fds to the old URL.
  2. dial requests new URL - PerRPCCredentials has nothing to send so it does nothing.

So here are 2 solutions that I can currently see:

  1. Put dial client before additionalFunctionality.
  2. Edit PerRPCCredentials not to capture FDTransceiver and not to cleanup stored fds on send.

We have discussed this with @edwarnicke and so it actually looks like both of these solutions have their pros and cons, but [1] is easier to implement.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denis-tingaikin I discussed this this morning with @Bolodya1997 on slack. It's a subtle bug, but once explained it makes sense.

pkg/networkservice/common/discover/server.go Show resolved Hide resolved
pkg/networkservice/common/interpose/server.go Show resolved Hide resolved
@@ -48,7 +48,7 @@ func NewClient() networkservice.NetworkServiceClient {
func (r *recvFDClient) Request(ctx context.Context, request *networkservice.NetworkServiceRequest, opts ...grpc.CallOption) (*networkservice.Connection, error) {
// Get the grpcfd.FDRecver
rpcCredentials := grpcfd.PerRPCCredentials(grpcfd.PerRPCCredentialsFromCallOptions(opts...))
opts = append(opts, grpc.PerRPCCredentials(rpcCredentials))
opts = append([]grpc.CallOption{grpc.PerRPCCredentials(rpcCredentials)}, opts...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to change the order of call options?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fault, I did a mistake during the testing, there is no need for this.

pkg/networkservice/common/mechanisms/recvfd/client.go Outdated Show resolved Hide resolved
pkg/networkservice/common/mechanisms/sendfd/client.go Outdated Show resolved Hide resolved
pkg/networkservice/common/mechanisms/sendfd/client.go Outdated Show resolved Hide resolved
func TestSelectEndpointServer_CleanRequest(t *testing.T) {
t.Cleanup(func() { goleak.VerifyNone(t) })

var flag bool
Copy link
Member

@denis-tingaikin denis-tingaikin Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use a more understandable name?

Suggested change
var flag bool
var TODO bool

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with hasBeenRequested.

@Bolodya1997 Bolodya1997 marked this pull request as draft October 20, 2021 08:20
Vladimir Popov added 2 commits October 20, 2021 20:41
This reverts commit d14a71d.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
@Bolodya1997 Bolodya1997 marked this pull request as ready for review October 20, 2021 14:00
@edwarnicke edwarnicke merged commit a94971d into networkservicemesh:main Oct 20, 2021
nsmbot pushed a commit to networkservicemesh/cmd-nsmgr that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/sdk-k8s that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-nsc-init that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-registry-memory that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-nse-vfio that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-registry-proxy-dns that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/cmd-nsmgr-proxy that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
nsmbot pushed a commit to networkservicemesh/sdk-kernel that referenced this pull request Oct 20, 2021
…k@main

PR link: networkservicemesh/sdk#1112

Commit: a94971d
Author: Vladimir Popov
Date: 2021-10-20 21:43:53 +0700
Message:
  - [sdk#1111] Fix `sendfd` issue on URL change (#1112)
* Set dial client before additional functionality in client chain

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix recvfd/senfd clients

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Clone request in remote iteration points

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Add multiforwarder sendfd test

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Revert "Fix recvfd/senfd clients"

This reverts commit d14a71d11a2561b847d73dc6ae17f9394fa12125.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>

* Fix naming

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.

sendfd doesn't send fd on Forwarder/Endpoint iteration
3 participants