Code Monkey home page Code Monkey logo

Comments (4)

apendleton avatar apendleton commented on August 16, 2024

If you had just mentioned that there was a race condition somewhere in carmen-cache leading to invalid reads, I would have guessed that it was in coalesce, which calls __get (or __getTruncated) in a thread other than the main thread, while the main thread might potentially be mutating the cache structures __get would access, either with calls to unload, or with calls to loadSync which cause cache eviction (as the cache has a limited size). In particular, I think there's a race condition opportunity here between the cache membership check and the cache fetch in _get, where if _get is called from coalesce it might be running in the thread pool, and in the intervening time the entry could get evicted or unloaded from the cache in the main thread.

But that's not what's going on here, if the crash is in the has and _get NAN_METHODs. has, _get, loadSync, and unload should all only get called from JS, so they should all be running on the main thread, and the latter two are the only things that might invalidate cache contents as far as I know, so I'm pretty confused as to how mutation could be occurring during a call to has or _get, as I don't think it should be possible for any of the mutating functions to be called at the same time as those two. It's super weird.

from carmen-cache.

springmeyer avatar springmeyer commented on August 16, 2024

Thank you for the thoughts! Right in this case neither of the asynchronous functions are being invoked (coalesce or merge). But i'll be digging into this more late tonight or tomorrow am to see if i can surface any more clues.

from carmen-cache.

springmeyer avatar springmeyer commented on August 16, 2024

Recapping: because this is so mysterious I suspect memory corruption is causing it (so the bug might be elsewhere and only manifesting in get/has calls because they are called so often and will fall prey to memory being messed up elsewhere). Therefore, my game plan is:

  • Solve all the overflow issues flags by the sanitizers first: #75, #79 and #83
  • Instrument libc++ with the address sanitizer
  • Then revisit this test to try to replicate again.

from carmen-cache.

springmeyer avatar springmeyer commented on August 16, 2024

Recapping here:

Solve all the overflow issues flags by the sanitizers first: #75, #79 and #83

This was done in #86

Instrument libc++ with the address sanitizer

Still not go around to this. Ticketed at mapbox/mason#411

Then revisit this test to try to replicate again.

No plans to at this point. Going to hope that the actual bug was fixed in #86.

from carmen-cache.

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.