GithubHelp home page GithubHelp logo

Object not found. about walrus HOT 15 CLOSED

coleifer avatar coleifer commented on August 18, 2024 2
Object not found.

from walrus.

Comments (15)

jerinzam avatar jerinzam commented on August 18, 2024

Any solution for this

from walrus.

coleifer avatar coleifer commented on August 18, 2024

That's really odd... can you set up a script I can try to reproduce this?

from walrus.

johndlong avatar johndlong commented on August 18, 2024

Just speculating, but are there any save operations going on in a separate thread/process?

The model save operation does a delete as part of the update process. This could potentially introduce very small timing windows where other processes would experience exactly these failures.

from walrus.

johndlong avatar johndlong commented on August 18, 2024

Another thought. Would a lua script that sets all the key/value pairs of a model in an atomic operation potentially avoid having to do that delete operation during a save?

from walrus.

coleifer avatar coleifer commented on August 18, 2024

👍

from walrus.

rudaporto avatar rudaporto commented on August 18, 2024

I have the same issue when using a Model to share status between two or more workers.

So, can I say that now Walrus models are not thread-safe?

from walrus.

coleifer avatar coleifer commented on August 18, 2024

So, can I say that now Walrus models are not thread-safe?

Has nothing to do with thread-safety. Redis is single-threaded, after all.

from walrus.

lovetoburnswhen avatar lovetoburnswhen commented on August 18, 2024

I also run into KeyErrors when there are two workers interacting with the same db: one is iterating through a Model.query() result while the other one is modifying/deleting model objects.

from walrus.

coleifer avatar coleifer commented on August 18, 2024

Yea there's no isolation. I strongly advise to use a relational db.

from walrus.

jhorman avatar jhorman commented on August 18, 2024

I am experiencing this as well. Isn't this something solved by doing the save using a pipeline. I think the problem is just finding the data in one index before it is in another. Pipelines atomically write.

from walrus.

lovetoburnswhen avatar lovetoburnswhen commented on August 18, 2024

I got around this by

  1. Managing my own "namespaces" with a field on the Model to enforce isolation by restricting each client to a certain namespace.

  2. Bypassing the Model API and interacting with Redis directly (only appropriate for certain cases). Huge performance boost since instead of doing model.load(...) for model in models... you can do something like:

with db.pipeline() as pipe:
    for id_key in id_keys:
        pipe.hgetall(id_key)

    model_data_dicts = pipe.execute()

from walrus.

jhorman avatar jhorman commented on August 18, 2024

Yeah, definitely a nice performance boost, but sort of sep from the main issue. As is, without using a basic pipeline, I think save is basically broken. Iterating the collection from any other thread/process can fail since it isn't fully written to redis yet.

from walrus.

coleifer avatar coleifer commented on August 18, 2024

I strongly advise to use a relational db.

No one should be using the walrus models code. I need to put a warning in the docs to that effect. It was an experiment and yeah it kinda works, but it's definitely nothing I would ever use myself and that is a big red flag to me.

from walrus.

jhorman avatar jhorman commented on August 18, 2024

That statement confuses me honestly. There are many use cases for Redis in which a modeled approach to transient data makes sense, to hide the complexity of the various data structures. That is how I landed here. I was doing the sorts of things you are doing, on my own, but then found Walrus. I have a case in which I most definitely do not want a relational database (very high throughput of transient objects).

I get though that it is your project and you want to deprecate that feature.

from walrus.

coleifer avatar coleifer commented on August 18, 2024

55dc768

https://walrus.readthedocs.io/en/latest/models.html

deprecate that feature.

I do not intend to "deprecate" anything, and I did not intend to give that impression. What I do want to convey is that the implementation has a lot of rough edges and is too flaky for me to ever want to use it. I feel it is necessary to put a warning up that the code is "experimental"-quality, so that people can re-evaluate walrus if they are expecting some kind of stability guarantee.

from walrus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.