Git Product home page Git Product logo

Comments (2)

jamadden avatar jamadden commented on July 16, 2024

Could this be because of a RelStorage cache problem?

Unlikely. This is a low-level SystemError that can only be produced by C code doing incorrect thing; it arises from a call to something like PyArg_Parse being given a non-tuple --- C functions get a object args argument that they break apart using a call like that.

Given the traceback, it's likely that obj is a component of an OOBTree, and you can definitely get an error like this if you pass the C code of OOBTree something it doesn't like (which is really a bug in OOBTree); the Python implementation does better:

>>> from BTrees import OOBTree
>>> OOBTree.Bucket().__setstate__(1)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
SystemError: new style getargs format but argument is not a tuple
>>> OOBTree.BucketPy().__setstate__(1)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
│                                                                                                  │
│ //lib/python3.10/site-packages/BTrees/_base.py:467 in   │
│ __setstate__                                                                                     │
│                                                                                                  │
│    464 │   │   return (data, )                                                                   │
│    465 │                                                                                         │
│    466 │   def __setstate__(self, state):                                                        │
│ ❱  467 │   │   if not isinstance(state[0], tuple):                                               │
│    468 │   │   │   raise TypeError("tuple required for first state element")                     │
│    469 │   │                                                                                     │
│    470 │   │   self.clear()                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'int' object is not subscriptable

So most likely there's a mismatch between the type of state and the class of obj. The database, and the cache, is keyed primarily by OID (_p_oid), and that's why I say it being a caching problem is unlikely; instead, I would be suspicious of something playing low-level tricks with OIDs, or manipulating the database directly (e.g., assigning an OID directly, leading to a class mismatch with what's in the local Connection's ghost cache, or restoring a backup while running). A restart (or clearing the ghost cache) would force a new ghost object to be created with the right class as read from the database.

Closing for now, but if this is something you can still reproduce, feel free to re-open and we can look at some more steps for debugging (in particular, we'd want to get the state value and ideally the entire pickled row from the database for that OID at the same time).

from relstorage.

tflorac avatar tflorac commented on July 16, 2024

Hi Jason,
I'll try to reproduce the problem. But as far as I can remember, this only occurs in production (where I use Apache and mod_wsgi) and not in development (where I just use Pyramid's "pserve" to run the application).
Best regards,
Thierry

from relstorage.

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.