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

Add cli command visor ping and test #1405

Merged
merged 31 commits into from
Dec 27, 2022
Merged

Conversation

ersonp
Copy link
Contributor

@ersonp ersonp commented Nov 2, 2022

Did you run make format && make check?

Fixes #1377

Changes:

  • add ping command as visor subcommand in skywire-cli visor ping <pk>
  • add test command as visor subcommand in skywire-cli visor test

How to test this PR:
PING

  1. Start a visor A
  2. Start visor B
  3. On the machine with visor B run command skywire-cli visor ping <visor-a-pk> -t <tries> -s <size-of-packet>

TEST

  1. Run a public visor
  2. Start a visor, then run test command by skywire-cli visor test -t <tries> -s <size-of-packet>

Result should be like this, but number of test should be same as number of public visors on service discovery
Screenshot_2022-12-21_02-20-51

ersonp added 23 commits November 2, 2022 14:32
The latency in networkStats is stored as uint32 miliseconds but while converting it to time.Duration, it requires input of nanoseconds. Before we were passing in uint32 miliseconds instead of nanoseconds which caused the time.duration to be as ns and not ms.

To fix this we multiply the latencyMs with a miliseconds with a nanosecond integer count to convert our latencyMs from milisecond to nanosecond.
This commit adds the subcommand ping to the command visor. It takes one argument that is a remote PK.

This is the first version of the ping where we are pinging the skychat app on the skynet and retrieving the latency of the connection.
The json of summary is expected to have the latency in ms but we were sending it in ns after the recent change. So we convert it back to ms while creating the summary.
This commit fixes the issue where the rule used to be the same for fwd and rev when both source and destination pk is the same. This happens becase the pk is used as a key in the RulesMap and in the above case the rule is overwritten instead of creating a new one.

We fix this by changing the key to be a string of 'pk:port' instead of just the PK which makes the key unique in all cases.
We fix this error by fixgin the noise config in PingRoute by setting the RemotePK the same as LocalPK.
@0pcom 0pcom added this to the Milestone 9 milestone Dec 13, 2022
@mrpalide
Copy link
Contributor

get panic when trying to ping moses visor

[2022-12-14T17:32:57+03:30] DEBUG [router]: Saving route group rules with desc: rAddr:0309726a9389c042291dbdeaa66e276c44e526901142fe70b90fa25ee0457446df:49153, lAddr:0309726a9389c042291dbdeaa66e276c44e526901142fe70b90fa25ee0457446df:48
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9d7b9f]

goroutine 144 [running]:
github.com/skycoin/skywire/pkg/transport.(*LogEntry).AddSent(...)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/transport/log.go:73
github.com/skycoin/skywire/pkg/transport.(*ManagedTransport).logSent(0xc00028cd00, 0xc003fe90e0)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/transport/managed_transport.go:433 +0x9f
github.com/skycoin/skywire/pkg/transport.(*ManagedTransport).WritePacket(0xc0000d2dc0, {0x7f526044e5b8, 0x10}, {0xc003fe90e0, 0xc003fe90e0, 0x0})
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/transport/managed_transport.go:377 +0x11c
github.com/skycoin/skywire/pkg/router.(*RouteGroup).writePacket(0xc0041e8000, {0x1153320, 0xc00003c0c0}, 0x0, {0xc003fe90e0, 0x0, 0xc0025708e8}, 0x9e6e26)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/router/route_group.go:383 +0x66
github.com/skycoin/skywire/pkg/router.(*RouteGroup).sendHandshake(0xc0041e8000, 0x20)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/router/route_group.go:560 +0x1ce
github.com/skycoin/skywire/pkg/router.(*router).saveRouteGroupRules(0xc0000c4420, {{0x3, 0x9, 0x72, 0x6a, 0x93, 0x89, 0xc0, 0x42, 0x29, ...}, ...}, ...)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/router/router.go:525 +0x475
github.com/skycoin/skywire/pkg/router.(*router).PingRoute(0xc0000c4420, {0x1153320, 0xc00003c0c0}, {0x2, 0x4b, 0x77, 0x4d, 0x21, 0x15, 0xaf, ...}, ...)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/router/router.go:377 +0x878
github.com/skycoin/skywire/pkg/app/appnet.(*SkywireNetworker).Ping(0xc000394210, {0x2, 0x4b, 0x77, 0x4d, 0x21, 0x15, 0xaf, 0x59, 0x5, ...}, ...)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/app/appnet/skywire_networker.go:90 +0x16f
github.com/skycoin/skywire/pkg/app/appnet.Ping({0x2, 0x4b, 0x77, 0x4d, 0x21, 0x15, 0xaf, 0x59, 0x5, 0x1c, ...}, ...)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/app/appnet/networker.go:85 +0x9e
github.com/skycoin/skywire/pkg/visor.(*Visor).DialPing.func1()
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/visor/api.go:825 +0x6d
github.com/skycoin/skywire-utilities/pkg/netutil.(*Retrier).Do(0xc000127800, {0x1153320, 0xc00003c0c8}, 0xc002571608)
	/home/mohammed/Projects/Skycoin/erson/skywire/vendor/github.com/skycoin/skywire-utilities/pkg/netutil/retrier.go:77 +0x11f
github.com/skycoin/skywire/pkg/visor.(*Visor).DialPing(0xc0002ce900, {0x2, 0x4b, 0x77, 0x4d, 0x21, 0x15, 0xaf, 0x59, 0x5, ...})
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/visor/api.go:824 +0x248
github.com/skycoin/skywire/pkg/visor.(*RPC).DialPing(0xc00046c3c0, 0xc000443e00, 0x1)
	/home/mohammed/Projects/Skycoin/erson/skywire/pkg/visor/rpc.go:636 +0x152
reflect.Value.call({0xc0004acf00, 0xc00040e0f0, 0x13}, {0xc5bf66, 0x4}, {0xc000066ef8, 0x3, 0x3})
	/usr/local/go/src/reflect/value.go:556 +0x845
reflect.Value.Call({0xc0004acf00, 0xc00040e0f0, 0xc00029c6e0}, {0xc0000556f8, 0x3, 0x3})
	/usr/local/go/src/reflect/value.go:339 +0xc5
net/rpc.(*service).call(0xc00043a380, 0xc, 0xc, 0xc0001ebf80, 0xc000124300, 0x20034cf00, {0xc0fcc0, 0xc000443e00, 0x9aaf46}, {0xb45180, ...}, ...)
	/usr/local/go/src/net/rpc/server.go:377 +0x239
created by net/rpc.(*Server).ServeCodec
	/usr/local/go/src/net/rpc/server.go:474 +0x405

@mrpalide mrpalide changed the title Add cli command visor ping Add cli command visor ping and test Dec 20, 2022
@mrpalide mrpalide marked this pull request as ready for review December 27, 2022 05:49
This commit fixes the issue with the limited data size of read of app conn by first sending the total size of the PingMsg in the new struct PingSizeMsg.

Then in the ping module we read the size of the incoming PingMsg and read on the conn until we have received all the ping data packets then then unmarshall it.

This way the ping still remains backwards compatable without needing to change the size of noise and break backwards compatability.
@ersonp
Copy link
Contributor Author

ersonp commented Dec 27, 2022

We also need to update skywire-services to use this PR after the merge, because of the changes made to the setup-node.

@0pcom 0pcom merged commit ecd8f8f into skycoin:develop Dec 27, 2022
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.

3 participants