ydb-platform / ydb-rs-sdk

Apache License 2.0
52 stars 18 forks source link

No ConnectionRefused Error #180

Closed makorne closed 7 months ago

makorne commented 7 months ago

I tried examples without started docker with ydb

cargo run --color=always --example basic-select-upsert
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/examples/basic-select-upsert`  

cargo run --color=always --example basic-upsert-many-rows
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/examples/basic-upsert-many-rows`     

cargo run --color=always --example topic-writer
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/examples/topic-writer`

They never end...

But basic-logs example works as should - with ConnectionRefused Error:

cargo run --color=always --example basic-logs
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/examples/basic-logs`
2024-03-16T07:46:26.878109Z TRACE ydb::client_common: token renewed
2024-03-16T07:46:26.878107Z TRACE ydb::discovery: timer discovery wait token
2024-03-16T07:46:26.878107Z TRACE ydb::client: waiting_token
2024-03-16T07:46:26.878155Z TRACE ydb::discovery: timer discovery first token done with result: Ok(())
2024-03-16T07:46:26.878160Z TRACE ydb::client: wait discovery
2024-03-16T07:46:26.878173Z TRACE ydb::discovery: start discovery shared state
2024-03-16T07:46:26.878185Z TRACE ydb::discovery: loop
2024-03-16T07:46:26.878234Z TRACE background_discovery{interval=60s}: ydb::discovery: rekby-discovery
2024-03-16T07:46:26.878271Z TRACE background_discovery{interval=60s}:discovery_now: ydb::discovery: discovery locking
2024-03-16T07:46:26.878298Z TRACE background_discovery{interval=60s}:discovery_now: ydb::discovery: creating grpc client
2024-03-16T07:46:26.878604Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::service: sending request to buffer worker
2024-03-16T07:46:26.878665Z TRACE tower::buffer::worker: worker polling for next message
2024-03-16T07:46:26.878675Z TRACE tower::buffer::worker: processing new request
2024-03-16T07:46:26.878683Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: resumed=false worker received request; waiting for service readiness
2024-03-16T07:46:26.878702Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; idle
2024-03-16T07:46:26.878730Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; connecting
2024-03-16T07:46:26.878753Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: hyper::client::connect::http: Http::connect; scheme=Some("http"), host=Some("localhost"), port=Some(Port(2136))
2024-03-16T07:46:26.878793Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; not ready
2024-03-16T07:46:26.878799Z DEBUG hyper::client::connect::dns: resolving host="localhost"
2024-03-16T07:46:26.878806Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: service.ready=false delay
2024-03-16T07:46:26.879028Z TRACE tower::buffer::worker: worker polling for next message
2024-03-16T07:46:26.879038Z TRACE tower::buffer::worker: resuming buffered request
2024-03-16T07:46:26.879044Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: resumed=true worker received request; waiting for service readiness
2024-03-16T07:46:26.879058Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; connecting
2024-03-16T07:46:26.879106Z DEBUG background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: hyper::client::connect::http: connecting to [::1]:2136
2024-03-16T07:46:26.879304Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: mio::poll: registering event source with poller: token=Token(0), interests=READABLE | WRITABLE    
2024-03-16T07:46:26.879345Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; not ready
2024-03-16T07:46:26.879357Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: service.ready=false delay
2024-03-16T07:46:26.879379Z TRACE tower::buffer::worker: worker polling for next message
2024-03-16T07:46:26.879384Z TRACE tower::buffer::worker: resuming buffered request
2024-03-16T07:46:26.879389Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: resumed=true worker received request; waiting for service readiness
2024-03-16T07:46:26.879399Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; connecting
2024-03-16T07:46:26.879415Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: mio::poll: deregistering event source from poller    
2024-03-16T07:46:26.879442Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: hyper::client::connect::http: connect error for [::1]:2136: ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
2024-03-16T07:46:26.879462Z DEBUG background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: hyper::client::connect::http: connecting to 127.0.0.1:2136
2024-03-16T07:46:26.879541Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: mio::poll: registering event source with poller: token=Token(16777216), interests=READABLE | WRITABLE    
2024-03-16T07:46:26.879564Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; not ready
2024-03-16T07:46:26.879575Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: service.ready=false delay
2024-03-16T07:46:26.879596Z TRACE tower::buffer::worker: worker polling for next message
2024-03-16T07:46:26.879600Z TRACE tower::buffer::worker: resuming buffered request
2024-03-16T07:46:26.879605Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: resumed=true worker received request; waiting for service readiness
2024-03-16T07:46:26.879615Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; connecting
2024-03-16T07:46:26.879628Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: mio::poll: deregistering event source from poller    
2024-03-16T07:46:26.879648Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: hyper::client::connect::http: connect error for 127.0.0.1:2136: ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
2024-03-16T07:46:26.879678Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: poll_ready; error
2024-03-16T07:46:26.879689Z DEBUG background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: reconnect::poll_ready: hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))
2024-03-16T07:46:26.879707Z DEBUG background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: service.ready=true processing request
2024-03-16T07:46:26.879728Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: Reconnect::call
2024-03-16T07:46:26.879738Z DEBUG background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tonic::transport::service::reconnect: error: error trying to connect: tcp connect error: Connection refused (os error 111)
2024-03-16T07:46:26.879756Z TRACE background_discovery{interval=60s}:discovery_now:list_endpoints{database="local"}: tower::buffer::worker: returning response future
2024-03-16T07:46:26.879775Z TRACE tower::buffer::worker: worker polling for next message
2024-03-16T07:46:26.879832Z TRACE background_discovery{interval=60s}: ydb::discovery: rekby-res: Err(TransportGRPCStatus(Status { code: Unknown, message: "interceptor transport error: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError(\"tcp connect error\", Os { code: 111, kind: ConnectionRefused, message: \"Connection refused\" })))", source: Some(interceptor transport error: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })))) }))
rekby commented 7 months ago

Hello, thanks for the report.

ydb methods have infinite retries by default. You can manage it by standard tokio timeout. It didn't in examples for simplify code.