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

[sn_client] Client is not prepared for connection reuse. #2060

Open
loziniak opened this issue Aug 21, 2024 · 8 comments
Open

[sn_client] Client is not prepared for connection reuse. #2060

loziniak opened this issue Aug 21, 2024 · 8 comments

Comments

@loziniak
Copy link
Contributor

I'm getting an error "Failed to receive transfer due to InvalidTransfer(\"Internal messaging channel was dropped\")" on call to Client::receive(). A client, that was made by Client::new() was kept in Tauri managed state.

Same operations in immediate form (connect, load wallet, receive – one after another) resulted in a successful cashnotes reception.

sn_client version 0.109.0

(more discusson: https://forum.autonomi.community/t/reusing-a-connection/40243)

@loziniak
Copy link
Contributor Author

I could reuse a connection earlier, like in the end of 2023, so I'd say it's a regression.

@loziniak
Copy link
Contributor Author

I have the same problem with ClientRegister::create_online():

Logging to stdout
Secret Key: 1a66e2ca341a298a27cba9e7995756c805eb1b4180ed75c11591b9d4cf3c7745
Connecting...
[2024-08-22T13:34:28.210657Z INFO sn_client::api] Startup a client with peers Some(["/ip4/127.0.0.1/udp/36290/quic-v1/p2p/12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS"]) and local true flag
[2024-08-22T13:34:28.210877Z INFO sn_client::api] Starting Kad swarm in client mode...
[2024-08-22T13:34:28.210923Z TRACE sn_client::api] Starting Kad swarm in client mode.."/tmp".
[2024-08-22T13:34:28.212053Z WARN sn_transfers] Using default FOUNDATION_PK: 8f73b97377f30bed96df1c92daf9f21b4a82c862615439fab8095e68860a5d0dff9f97dba5aef503a26c065e5cb3c7ca
[2024-08-22T13:34:28.212337Z WARN sn_transfers::genesis] USING DEFAULT GENESIS SK (9934c2) FOR TESTING PURPOSES! EXPECTING PAIRED SK (23746b) TO BE USED!
[2024-08-22T13:34:28.212554Z INFO sn_transfers::genesis] Genesis PK: 9934c21469a68415e6b06a435709e16bff6e92bf302aeb0ea9199d2d06a55f1b1a21e155853d3f94ae31f8f313f886ee
[2024-08-22T13:34:28.212608Z WARN sn_transfers] Using default NETWORK_ROYALTIES_PK: b4243ec9ceaec374ef992684cd911b209758c5de53d1e406b395bc37ebc8ce50e68755ea6d32da480ae927e1af4ddadb
[2024-08-22T13:34:28.212781Z WARN sn_transfers] Using default PAYMENT_FORWARD_PK: a585839f0502713a0ed6a327f3bd0c301f9e8fe298c93dd00ed7869d8e6804244f0d3014e90df45cd344a7ccd702865c
[2024-08-22T13:34:28.212993Z INFO sn_networking::driver] Process (PID: 22191) with PeerId: 12D3KooWSBgw2tc1j3Wx7wfaitUad5eKJ2MmFNv9fmptJaboCDFw
[2024-08-22T13:34:28.213100Z INFO sn_networking::driver] Self PeerID 12D3KooWSBgw2tc1j3Wx7wfaitUad5eKJ2MmFNv9fmptJaboCDFw is represented as kbucket_key 2d11e2368e3d28a88cfd57fb96f97e59d6cf7af2a07b557ac94ddd113a09a3e3
[2024-08-22T13:34:28.213203Z INFO sn_networking::driver] Building request response with "/safe/node/0.17/8f73b9_9934c2_b4243e_a58583"
[2024-08-22T13:34:28.213305Z DEBUG sn_networking::driver] Using Kademlia with ClientRecordStore!
[2024-08-22T13:34:28.214157Z INFO sn_networking::driver] Building Identify with identify_protocol_str: "safe/0.17/8f73b9_9934c2_b4243e_a58583" and identify_version: "safe/client/0.17/8f73b9_9934c2_b4243e_a58583"
[2024-08-22T13:34:28.319085Z INFO sn_networking::network_discovery] Time to generate NetworkDiscoveryCandidates: 99.259525ms
[2024-08-22T13:34:28.320274Z INFO sn_networking::network_discovery] The generated network discovery candidates currently cover these ilog2 buckets: [(242, 1), (244, 3), (245, 4), (246, 5), (247, 5), (248, 5), (249, 5), (250, 5), (251, 5), (252, 5), (253, 5), (254, 5), (255, 5)]
[2024-08-22T13:34:28.320324Z INFO sn_client::api] Client constructed network and swarm_driver
[2024-08-22T13:34:28.320386Z TRACE sn_client::api] Starting up client swarm_driver
[2024-08-22T13:34:28.320490Z DEBUG sn_client::api] Client connection timeout: 10s
[2024-08-22T13:34:28.320587Z TRACE sn_client::api] dialing initial peer addr=/ip4/127.0.0.1/udp/36290/quic-v1/p2p/12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS
[2024-08-22T13:34:28.355807Z INFO sn_networking::event] New peer added to routing table: PeerId("12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS"), now we have #1 connected peers
[2024-08-22T13:34:28.355893Z INFO sn_networking::event] Peer PeerId("12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS") has a Some(255) distance to us
[2024-08-22T13:34:28.355977Z INFO sn_networking::event] kBucketTable has 1 kbuckets 1 peers, [(0, 1, 255)], estimated network size: 2
[2024-08-22T13:34:28.356018Z INFO sn_networking::event::kad] Performing the first bootstrap
[2024-08-22T13:34:28.356113Z DEBUG sn_client::api] PeerAdded: 12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS
[2024-08-22T13:34:28.356186Z DEBUG sn_client::api] 1/5 initial peers found.
[2024-08-22T13:34:28.356201Z TRACE sn_client::api] Handled network event in 136.696µs: "NetworkEvent::PeerAdded(PeerId(\"12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS\"), 1)"
[2024-08-22T13:34:28.367980Z DEBUG sn_networking::bootstrap] Trigger network discovery took 11.933511ms
[2024-08-22T13:34:28.368017Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 1: PeerId("12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS"), is_new_peer: true old_peer: None
[2024-08-22T13:34:28.368155Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 1: PeerId("12D3KooWC7niSAZPa39RX6XG26YZrigKvX5bCyeTq4XY6xeYDsDS"), is_new_peer: false old_peer: None
[2024-08-22T13:34:28.461327Z INFO sn_networking::event] New peer added to routing table: PeerId("12D3KooWJps6nynmCkKE7gipf4tyx2ewpa1XJ7LyTkW5UpoYbWGJ"), now we have #2 connected peers
[2024-08-22T13:34:28.461474Z INFO sn_networking::event] Peer PeerId("12D3KooWJps6nynmCkKE7gipf4tyx2ewpa1XJ7LyTkW5UpoYbWGJ") has a Some(251) distance to us
[2024-08-22T13:34:28.461646Z INFO sn_networking::event] kBucketTable has 2 kbuckets 2 peers, [(0, 1, 251), (1, 1, 255)], estimated network size: 3
[2024-08-22T13:34:28.461696Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 2: PeerId("12D3KooWJps6nynmCkKE7gipf4tyx2ewpa1XJ7LyTkW5UpoYbWGJ"), is_new_peer: true old_peer: None
[2024-08-22T13:34:28.461816Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 2: PeerId("12D3KooWJps6nynmCkKE7gipf4tyx2ewpa1XJ7LyTkW5UpoYbWGJ"), is_new_peer: false old_peer: None
[2024-08-22T13:34:28.463946Z DEBUG sn_client::api] PeerAdded: 12D3KooWJps6nynmCkKE7gipf4tyx2ewpa1XJ7LyTkW5UpoYbWGJ
[2024-08-22T13:34:28.464052Z DEBUG sn_client::api] 2/5 initial peers found.
[2024-08-22T13:34:28.464069Z TRACE sn_client::api] Handled network event in 187.833µs: "NetworkEvent::PeerAdded(PeerId(\"12D3KooWJps6nynmCkKE7gipf4tyx2ewpa1XJ7LyTkW5UpoYbWGJ\"), 2)"
[2024-08-22T13:34:28.469063Z INFO sn_networking::event] New peer added to routing table: PeerId("12D3KooWQWMq1LqEAcdoJujegEZbgiJWu2AKf1MF9yQdKrbdV1U1"), now we have #3 connected peers
[2024-08-22T13:34:28.469190Z INFO sn_networking::event] Peer PeerId("12D3KooWQWMq1LqEAcdoJujegEZbgiJWu2AKf1MF9yQdKrbdV1U1") has a Some(254) distance to us
[2024-08-22T13:34:28.469402Z INFO sn_networking::event] kBucketTable has 3 kbuckets 3 peers, [(0, 1, 251), (1, 1, 254), (2, 1, 255)], estimated network size: 4
[2024-08-22T13:34:28.469451Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 3: PeerId("12D3KooWQWMq1LqEAcdoJujegEZbgiJWu2AKf1MF9yQdKrbdV1U1"), is_new_peer: true old_peer: None
[2024-08-22T13:34:28.469566Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 3: PeerId("12D3KooWQWMq1LqEAcdoJujegEZbgiJWu2AKf1MF9yQdKrbdV1U1"), is_new_peer: false old_peer: None
[2024-08-22T13:34:28.470750Z INFO sn_networking::event] New peer added to routing table: PeerId("12D3KooWL7rrSTqrKwiAQ8KhwnXehdG25JpGhstQNHYHwFK8beQU"), now we have #4 connected peers
[2024-08-22T13:34:28.470864Z INFO sn_networking::event] Peer PeerId("12D3KooWL7rrSTqrKwiAQ8KhwnXehdG25JpGhstQNHYHwFK8beQU") has a Some(255) distance to us
[2024-08-22T13:34:28.471057Z INFO sn_networking::event] kBucketTable has 3 kbuckets 4 peers, [(0, 1, 251), (1, 1, 254), (2, 2, 255)], estimated network size: 5
[2024-08-22T13:34:28.471113Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 4: PeerId("12D3KooWL7rrSTqrKwiAQ8KhwnXehdG25JpGhstQNHYHwFK8beQU"), is_new_peer: true old_peer: None
[2024-08-22T13:34:28.471231Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 4: PeerId("12D3KooWL7rrSTqrKwiAQ8KhwnXehdG25JpGhstQNHYHwFK8beQU"), is_new_peer: false old_peer: None
[2024-08-22T13:34:28.472590Z DEBUG sn_client::api] PeerAdded: 12D3KooWL7rrSTqrKwiAQ8KhwnXehdG25JpGhstQNHYHwFK8beQU
[2024-08-22T13:34:28.472692Z DEBUG sn_client::api] 3/5 initial peers found.
[2024-08-22T13:34:28.472727Z TRACE sn_client::api] Handled network event in 200.885µs: "NetworkEvent::PeerAdded(PeerId(\"12D3KooWL7rrSTqrKwiAQ8KhwnXehdG25JpGhstQNHYHwFK8beQU\"), 4)"
[2024-08-22T13:34:28.472994Z DEBUG sn_client::api] PeerAdded: 12D3KooWQWMq1LqEAcdoJujegEZbgiJWu2AKf1MF9yQdKrbdV1U1
[2024-08-22T13:34:28.473086Z DEBUG sn_client::api] 4/5 initial peers found.
[2024-08-22T13:34:28.473114Z TRACE sn_client::api] Handled network event in 184.627µs: "NetworkEvent::PeerAdded(PeerId(\"12D3KooWQWMq1LqEAcdoJujegEZbgiJWu2AKf1MF9yQdKrbdV1U1\"), 3)"
[2024-08-22T13:34:28.477398Z INFO sn_networking::event] New peer added to routing table: PeerId("12D3KooWHCEGHroqUY5TD4D9Hshx7XykZq87Xhs5K2b33f4fAbuY"), now we have #5 connected peers
[2024-08-22T13:34:28.477496Z INFO sn_networking::event] Peer PeerId("12D3KooWHCEGHroqUY5TD4D9Hshx7XykZq87Xhs5K2b33f4fAbuY") has a Some(254) distance to us
[2024-08-22T13:34:28.477670Z INFO sn_networking::event] kBucketTable has 3 kbuckets 5 peers, [(0, 1, 251), (1, 2, 254), (2, 2, 255)], estimated network size: 6
[2024-08-22T13:34:28.477705Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 5: PeerId("12D3KooWHCEGHroqUY5TD4D9Hshx7XykZq87Xhs5K2b33f4fAbuY"), is_new_peer: true old_peer: None
[2024-08-22T13:34:28.477792Z INFO sn_networking::event::kad] kad_event::RoutingUpdated 5: PeerId("12D3KooWHCEGHroqUY5TD4D9Hshx7XykZq87Xhs5K2b33f4fAbuY"), is_new_peer: false old_peer: None
[2024-08-22T13:34:28.478235Z DEBUG sn_client::api] PeerAdded: 12D3KooWHCEGHroqUY5TD4D9Hshx7XykZq87Xhs5K2b33f4fAbuY
[2024-08-22T13:34:28.478395Z INFO sn_client::api] Client connected to the Network true.
Client created.
Conected.
[2024-08-22T13:34:28.478515Z TRACE sn_client::api] Handled network event in 322.636µs: "NetworkEvent::PeerAdded(PeerId(\"12D3KooWHCEGHroqUY5TD4D9Hshx7XykZq87Xhs5K2b33f4fAbuY\"), 5)"
[...]
Register create...
[2024-08-22T13:35:35.536389Z INFO sn_transfers::wallet] Attempting to read wallet file
[2024-08-22T13:35:35.536790Z DEBUG sn_transfers::wallet::watch_only] Loaded wallet from "/home/maciek/.local/share/community.jams.desktop/wallet" with balance NanoTokens(1000000000)
Wallet created.
[2024-08-22T13:35:35.537225Z DEBUG sn_client::register] Syncing Register at RegisterAddress(139322) { meta: 139322(00010011).., owner: PublicKey(0bb8..dd1f) }!
[2024-08-22T13:35:35.537300Z DEBUG sn_client::register] VERIFYING REGISTER STORED RegisterAddress(139322) { meta: 139322(00010011).., owner: PublicKey(0bb8..dd1f) }
[2024-08-22T13:35:35.537359Z INFO sn_client::api] Verifying register: RegisterAddress(139322) { meta: 139322(00010011).., owner: PublicKey(0bb8..dd1f) }
[2024-08-22T13:35:35.537566Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:35.537742Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:35.537820Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:36.180848Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:36.180963Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:36.181004Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:37.102264Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:37.102527Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:37.102624Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:37.827721Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:37.827825Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:37.827859Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:39.238172Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:39.238364Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:39.238426Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:42.108325Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:42.108486Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:42.108551Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:46.716571Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:46.716687Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:46.716728Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:52.712546Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:52.712793Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:52.712886Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:35:59.623810Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:35:59.624148Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:35:59.624305Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:36:12.424170Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:36:12.424364Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:12.424458Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:36:30.347495Z INFO sn_networking] Getting record from network of d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f). with cfg GetRecordCfg { get_quorum: N(2), retry_strategy: Some(Balanced), target_record: "None", expected_holders: {} }
[2024-08-22T13:36:30.347718Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:30.347823Z ERROR sn_networking] When fetching record d4f30b(5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f), encountered a channel error RecvError(())
[2024-08-22T13:36:30.347956Z WARN sn_client::api] Failed to get record at RegisterAddress(139322) { meta: 139322(00010011).., owner: PublicKey(0bb8..dd1f) } from the network: InternalMsgChannelDropped
[2024-08-22T13:36:30.348082Z DEBUG sn_client::register] Failed to get register: Protocol(RegisterNotFound(RegisterAddress(139322) { meta: 139322(00010011).., owner: PublicKey(0bb8..dd1f) }))
[2024-08-22T13:36:30.348199Z DEBUG sn_client::register] Creating Register as it doesn't exist at RegisterAddress(139322) { meta: 139322(00010011).., owner: PublicKey(0bb8..dd1f) }!
[2024-08-22T13:36:30.349687Z TRACE sn_client::wallet] Paying for storage (w/backoff retries) for: [NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f)]
[2024-08-22T13:36:30.349998Z DEBUG sn_client::wallet] Pending store cost tasks: 1
[2024-08-22T13:36:30.350195Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:30.350297Z DEBUG sn_client::wallet] Storecosts retrieved for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) Err(CouldNotSendMoney("The oneshot::sender has been dropped"))
[2024-08-22T13:36:30.350714Z WARN sn_client::wallet] Cannot get store cost for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) with error CouldNotSendMoney("The oneshot::sender has been dropped")
[2024-08-22T13:36:30.350983Z WARN sn_client::wallet] Attempt to pay for data failed: "The oneshot::sender has been dropped"
[2024-08-22T13:36:30.842302Z TRACE sn_client::wallet] Paying for storage (w/backoff retries) for: [NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f)]
[2024-08-22T13:36:30.842611Z DEBUG sn_client::wallet] Pending store cost tasks: 1
[2024-08-22T13:36:30.842728Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:30.842813Z DEBUG sn_client::wallet] Storecosts retrieved for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) Err(CouldNotSendMoney("The oneshot::sender has been dropped"))
[2024-08-22T13:36:30.843105Z WARN sn_client::wallet] Cannot get store cost for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) with error CouldNotSendMoney("The oneshot::sender has been dropped")
[2024-08-22T13:36:30.843292Z WARN sn_client::wallet] Attempt to pay for data failed: "The oneshot::sender has been dropped"
[2024-08-22T13:36:31.790998Z TRACE sn_client::wallet] Paying for storage (w/backoff retries) for: [NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f)]
[2024-08-22T13:36:31.791330Z DEBUG sn_client::wallet] Pending store cost tasks: 1
[2024-08-22T13:36:31.791465Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:31.791566Z DEBUG sn_client::wallet] Storecosts retrieved for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) Err(CouldNotSendMoney("The oneshot::sender has been dropped"))
[2024-08-22T13:36:31.791934Z WARN sn_client::wallet] Cannot get store cost for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) with error CouldNotSendMoney("The oneshot::sender has been dropped")
[2024-08-22T13:36:31.792170Z WARN sn_client::wallet] Attempt to pay for data failed: "The oneshot::sender has been dropped"
[2024-08-22T13:36:33.465065Z TRACE sn_client::wallet] Paying for storage (w/backoff retries) for: [NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f)]
[2024-08-22T13:36:33.465515Z DEBUG sn_client::wallet] Pending store cost tasks: 1
[2024-08-22T13:36:33.466057Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:33.466227Z DEBUG sn_client::wallet] Storecosts retrieved for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) Err(CouldNotSendMoney("The oneshot::sender has been dropped"))
[2024-08-22T13:36:33.466655Z WARN sn_client::wallet] Cannot get store cost for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) with error CouldNotSendMoney("The oneshot::sender has been dropped")
[2024-08-22T13:36:33.467544Z WARN sn_client::wallet] Attempt to pay for data failed: "The oneshot::sender has been dropped"
[2024-08-22T13:36:36.530863Z TRACE sn_client::wallet] Paying for storage (w/backoff retries) for: [NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f)]
[2024-08-22T13:36:36.531154Z DEBUG sn_client::wallet] Pending store cost tasks: 1
[2024-08-22T13:36:36.531265Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:36.531344Z DEBUG sn_client::wallet] Storecosts retrieved for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) Err(CouldNotSendMoney("The oneshot::sender has been dropped"))
[2024-08-22T13:36:36.531674Z WARN sn_client::wallet] Cannot get store cost for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) with error CouldNotSendMoney("The oneshot::sender has been dropped")
[2024-08-22T13:36:36.531874Z WARN sn_client::wallet] Attempt to pay for data failed: "The oneshot::sender has been dropped"
[2024-08-22T13:36:41.632102Z TRACE sn_client::wallet] Paying for storage (w/backoff retries) for: [NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f)]
[2024-08-22T13:36:41.632396Z DEBUG sn_client::wallet] Pending store cost tasks: 1
[2024-08-22T13:36:41.632551Z ERROR sn_networking] Failed to send SwarmCmd: channel closed
[2024-08-22T13:36:41.632652Z DEBUG sn_client::wallet] Storecosts retrieved for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) Err(CouldNotSendMoney("The oneshot::sender has been dropped"))
[2024-08-22T13:36:41.633058Z WARN sn_client::wallet] Cannot get store cost for NetworkAddress::RegisterAddress(139322 - 5b1fc2ea7727e68fdd1cf798792e52404d4206cbe1727c3ca2ad6a298357931f) with error CouldNotSendMoney("The oneshot::sender has been dropped")
[2024-08-22T13:36:41.633329Z WARN sn_client::wallet] Attempt to pay for data failed: "The oneshot::sender has been dropped"

@loziniak
Copy link
Contributor Author

loziniak commented Aug 23, 2024

I was executing Client::new() in a tauri::Builder::setup() by tokio::Runtime::block_on() to obtain a context for async functions. And Client::receive() and ClientRegister::create_online() were in async commands.

Probably this setup was problematic, because now, when I connect also in async command fired from frontend, like the rest of commands (faucet and register), connection is not lost.

I don't close the issue in case you decided, that my first approach was ok, and it should be supported in API.

@happybeing
Copy link
Contributor

Did you try doing it before calling the builder, in main()?

Or in a LazyStatic?

I haven't bothered yet. For now I create it inside each async handler when it runs.

@loziniak
Copy link
Contributor Author

I'm using Tauri 2, so it has main.rs with main() and lib.rs with run(). Builder is by default created in run() function, and I had it implemented as a callback to setup() method. I have no experience with LazyStatics yet.

@happybeing
Copy link
Contributor

I'm using Tauri 2 as well, (it does still have main(), which is what calls run() BTW!)

So same Q applies in run().

I'll make a note of this topic and maybe try different options at some point.

One trade-off occurred to me. Keeping the client alive as you are avoids the need to connect each time, but maybe it also removes the possibility of parallel access? If every thread is queued waiting for the MutEx instead of making its own client, all fetches and other interactions might be forced to be sequential.

If you make a separate client to get each resource, they all take a bit longer to start but might overlap and be faster for that kind of access.

What do you think?

@loziniak
Copy link
Contributor Author

Autonomi uses async/await, so I wonder, maybe when you use async-aware Mutex, the calls can do their work in parallel somehow?

@happybeing
Copy link
Contributor

happybeing commented Aug 29, 2024

await is just that - the thread stops until the called function returns. The parallel part is that other threads continue.

I think Mutex is a way to ensure shared values can be written and read by different threads in a deterministic way, but that can lead to deadlocks - two threads waiting on each other.

The parallel feature is set up, usually in main() where a kind of loop is executed which checks to see if each thread can run one after the other, and skips any that are waiting for something.

That's my vague understanding, although I'm not sure if thread is the correct term.

vdash uses this approach to handle updates to multiple logfiles intermingled with an event handler which both handles keyboard input and updates the display.

It all looks like it's happening in parallel, but really it's just running the first thing that it finds has something to do until that has completed, or has hit an await, or is waiting for a lock on share data etc.

I've no idea if there is a recommended way to use the Client so I've steared clear of anything clever for now.

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

No branches or pull requests

2 participants