couchbase-rs
couchbase-rs copied to clipboard
Support multiple bucket open
The lcb run loop needs to keep track on N buckets (also taking into account GCCCP on the first one) and then also loop all of them for readiness. Also we need code in place that dispatches it to the right one
I'm dealing with this issue currently. I guess the workaround is to spawn multiple processes. My use case is connecting to two clusters, and one bucket in each.
@brigand I fixed it on master, can you try if that works for you?
I'm on the latest code from master, so maybe it's a separate issue with multiple clusters.
Using tokio=0.2, #[tokio::main]
, the latest stable compiler, brew install libcouchbase --head
.
I unfortunately didn't commit the broken code, but this is the error from when I tried to connect to two clusters in one process.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: 1048', /Users/.../.cargo/git/checkouts/couchbase-rs-9bae2babc4d89f61/769b1dc/couchbase/src/io/lcb/mod.rs:86:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'attempt to subtract with overflow', /Users/.../.cargo/git/checkouts/couchbase-rs-9bae2babc4d89f61/769b1dc/couchbase/src/io/lcb/callbacks.rs:325:61
thread '[warn] event_base_loop: reentrant invocation. Only one event_base_loop can run on each event_base at once.
tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Canceled', /Users/../.cargo/git/checkouts/couchbase-rs-9bae2babc4d89f61/769b1dc/couchbase/src/api/mod.rs:416:9
@brigand unfortunately I think brew install libcouchbase is installing lcb2, not lcb3 which is needed. this change has been closed but it needs to go again at some point: https://github.com/Homebrew/homebrew-core/pull/49103
Note that it might be easier for you if you just use couchbase-rs
with the libcouchbase-static
feature enabled, then you don't need to care about the dependency .. or you just build it from source and install it
Actually, now that I read this again --head
might install lcb3, but to be on the safe side can you try with static again? If it still fails is there a standalone prog you can provide so I can try to reproduce?
The callback attempt to subtract with overflow is weird but that looks like a real issue that I'll try to fix on master
I think my connection to the couchbase server is actually the problem here, and it's just a bug with error reporting.
I was running it with a port-forwarding layer between the client and couchbase server, and it's likely doing something weird to the connection. Even with separate processes I get "A generic / unknown error happened" when talking to that instance, but the code works fine with a local instance of couchbase.
Likely a user error on my part.
@brigand we do not support running a proxy/port forwarding between client and server, and the reason is the client looks at a config it gets from the server, including ports - you'll just be running into issues down the road, please don't do it :)
w.r.t the actual issue, yeah, I think the unwraps need to be fixed and proper error reporting needs to be in place. I'll close this ticket then and will open a new one with your bootstrap diagnostics issue so we can track it properly.