Code Monkey home page Code Monkey logo

Comments (5)

mernst-github avatar mernst-github commented on June 18, 2024 3

This is gone in 3.5.3, thanks!

from cats-effect.

durban avatar durban commented on June 18, 2024 2

After some reading, it turns out, that it is "well-known" (LOL), that removing from a linked list with a single CAS is incorrect; we just didn't notice it :-). There is some reading about it here and in the gigantic comment in the openjdk ConcurrentSkipListMap. The short version is that fixing it requires marking the next pointer with a CAS before unlinking the element. (Fun fact: our TimerSkipList already does this, as it is a port of (some of) CSLM.)

We can do the marking for CallbackStack if we need to. But doing something simpler/faster by using the fact that the CallbackStack is not a general purpose linked list is probably a good idea (like what you discussed).

from cats-effect.

mernst-github avatar mernst-github commented on June 18, 2024

Probably worth carrying over from #3935 that this corrupts the IODeferred clearCounter and leads to unreliable pack invocations, effectively a memory leak.
I don't have deep insights into the design of the callback stack, but on first glance I would try to avoid concurrent packs altogether (code bails anyway when it detects one), I find it hard to reason about its safety. Guarding pack at the stack root with an atomic (without atomics for the actual linked stack) sounds more robust to me.

from cats-effect.

armanbilge avatar armanbilge commented on June 18, 2024

but on first glance I would try to avoid concurrent packs altogether (code bails anyway when it detects one) ... Guarding pack at the stack root with an atomic (without atomics for the actual linked stack) sounds more robust to me.

Thanks, this is a really interesting idea!! @samspills and I are giving it a try :)

from cats-effect.

armanbilge avatar armanbilge commented on June 18, 2024

Thanks for all your help!

from cats-effect.

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.