Problem:
Iroh docs stop responding/returning value on some devices (low end Android phones).
I can reliably reproduce by having such code repeated a lot of times:
let status = docs
.open(doc_id)
.await
.unwrap()
.unwrap()
.status()
.await
.unwrap();
after n attempts this stops returning values and hangs suspended.
I see suspiciously growing handles count on a Document Status. Should this be continuously increasing counter?
Full suspicious code block
Here's some explanatory text before the code.
#[tokio::test]
async fn test_app() {
let secret_key = { SecretKey::generate(&mut rand::rng()) };
let endpoint = Endpoint::empty_builder(RelayMode::Disabled)
.secret_key(secret_key)
.bind()
.await
.unwrap();
let mdns = MdnsDiscovery::builder().build(endpoint.id()).unwrap();
endpoint.discovery().add(mdns.clone());
let pinger = iroh_ping::Ping::new();
let blobs_store = MemStore::new();
let gossip = Gossip::builder().spawn(endpoint.clone());
let docs = Docs::memory()
.spawn(endpoint.clone(), (*blobs_store).clone(), gossip.clone())
.await
.unwrap();
let _router = Router::builder(endpoint.clone())
.accept(iroh_ping::ALPN, pinger.clone())
.accept(iroh_blobs::ALPN, BlobsProtocol::new(&blobs_store, None))
.accept(iroh_gossip::ALPN, gossip.clone())
.accept(iroh_docs::ALPN, docs.clone())
.spawn();
let doc_id = docs.create().await.unwrap().id();
for _ in 0..100 {
let doc = docs.open(doc_id).await.unwrap().unwrap(); // Does this leak the memory even if the resource is dropped?
// doc.close().await.unwrap();
}
let status = docs
.open(doc_id)
.await
.unwrap()
.unwrap()
.status()
.await
.unwrap();
assert_eq!(1, status.handles);
}
Problem:
Iroh docs stop responding/returning value on some devices (low end Android phones).
I can reliably reproduce by having such code repeated a lot of times:
after
nattempts this stops returning values and hangs suspended.I see suspiciously growing
handlescount on a Document Status. Should this be continuously increasing counter?Full suspicious code block
Here's some explanatory text before the code.