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

Utf8Error on get operation #75

Open
carolfly86 opened this issue Aug 11, 2020 · 1 comment
Open

Utf8Error on get operation #75

carolfly86 opened this issue Aug 11, 2020 · 1 comment

Comments

@carolfly86
Copy link

Hi,

I have a simple code to get document by key:

match block_on(_collection.get(key, GetOptions::default())) {
        Ok(r) => {
            let decoded: db::WritableEnvironment = match r.content(){
                Ok(environment) => environment,
                Err(e) => {
                    warn!("Unable to get couchbase document");
                    return Err(e.into());
                }
            };
            Ok(Some(decoded.into()))
        },
        Err(e) => {
            match e {
                CouchbaseError::DocumentNotFound {ctx: _} =>{
                    info!("couchbase document not found");
                    Ok(None)
                }
                _ => {
                    info!("get failed! {}", e);
                    Err(e.into())
                }            
            }
        }
    } 

This occasionally fails with below error:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 14, error_len: Some(1) }', /Users/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/couchbase-1.0.0-alpha.3/src/io/lcb/callbacks.rs:185:42

my couchbase document keys consists of 7 digits sha, double colons, and a short string containing character and digits.
For example the above error message is caused by trying to get this key 9a59b6e::S555

However, this error happens occasionally for different keys, and it may succeed in the next run.
Any idea what it could be? I'm using the 1.47.0-nightly version of rustc.

@daschl
Copy link
Contributor

daschl commented Aug 24, 2020

@carolfly86 thanks for reporting! Are you on master or a specific version of the sdk?

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