Giter Site home page Giter Site logo

Not threadsafe about fast-skiplist HOT 3 CLOSED

sean-public avatar sean-public commented on August 11, 2024
Not threadsafe

from fast-skiplist.

Comments (3)

sean-public avatar sean-public commented on August 11, 2024

As the README indicates, it currently offers "fine-grained locking on insert and delete combined with optimistic search" which is why, for example, getPrevElementNodes does not acquire a lock.

A new version is being tested with streamlined across-the-board optimistic locking via revision number incremented on writes and optionally supplied with write requests -- returning an error when the versions don't match that can be acted upon in the client (à la Elasticsearch). I apologize for the delay in getting the new version on Github, it's part of a larger ongoing project in a private repo.

I'll update this issue when it's merged in to be sure you're notified.

from fast-skiplist.

jaffee avatar jaffee commented on August 11, 2024

Hey @sean-public thanks for getting back to me - I don't actually need thread safety for my use, so I'm just stripping out all locking in a fork, but I do want to point this out because I think it's very important. I'd also like to say, that concurrency issues aside, I really like this library - it's a nice implementation with lots of benchmarks and the code is tiny!

Instead of trying to explain in this issue, I've simply made a pull request with a test which shows one of the possible data races happening: #4

This article: https://golang.org/doc/articles/race_detector.html has more information on what precisely constitutes a data race, and why even "innocent" races on primitive types can lead to problems.

from fast-skiplist.

0joshuaolson1 avatar 0joshuaolson1 commented on August 11, 2024

Why was this issue closed? SetMaxLevel isn't documented as thread-unsafe.

from fast-skiplist.

Related Issues (11)

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.