GithubHelp home page GithubHelp logo

Comments (3)

jamadden avatar jamadden commented on June 3, 2024 1

Hi! I'm a maintainer of gevent and I've also contributed to this library. My organization runs a gevent-patched system that heavily uses transaction and I don't recall that we've run into any trouble. I also don't think we have any special code, aside from an assert in one of our modules:

assert issubclass(transaction.ThreadTransactionManager, gevent.local.local)

This makes sure that the monkey-patching has been done soon enough. The trick, as gevent tries to document, is to make sure that monkey-patching is done immediately during process startup, before any other imports. In our case, we have modified pserve to do the patching, but that might differ in a given environment.

Our assert code is slightly more general than that to account for other thread-local things we're aware of. I can share it if that would be helpful.

from transaction.

miohtama avatar miohtama commented on June 3, 2024 1

I moved gevent.monkey.patch_all() to very early in my program and managed to resolve the issue.

from transaction.

miohtama avatar miohtama commented on June 3, 2024

@jamadden Here is the description of the sympton: ThreadTransactionManager gives same _txn even if the thread differs.

Thread is <ServiceThread(xxx, started 4449301920)>, manager is <transaction._manager.ThreadTransactionManager object at 0x1072e0e88>, Tx is <transaction._transaction.Transaction object at 0x109373fd0>
Thread is <ServiceThread(yyy, started 4449302072)>, manager is <transaction._manager.ThreadTransactionManager object at 0x1072e0e88>, Tx is <transaction._transaction.Transaction object at 0x109373fd0>

This is using threads started with threading.Thread.start.

I'd assume I need to get patched threading.Thread?

from transaction.

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.