Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError + all system memory consumed #23

Open
philipn opened this issue Mar 17, 2012 · 5 comments
Open

RuntimeError + all system memory consumed #23

philipn opened this issue Mar 17, 2012 · 5 comments

Comments

@philipn
Copy link

philipn commented Mar 17, 2012

Using psycopg2-ctypes and pypy I see:

Exception RuntimeError: RuntimeError('maximum recursion depth exceeded',) in method __del__ of <psycopg2ct._impl.cursor.Cursor object at 0x000000000623a230> ignored

printed by the django development server. It only happens sometimes, and when it does happen it causes the server to lock up and all memory on my system to be consumed. I can't seem to generate a traceback

This doesn't always happen. Sometimes (for tiny pages in my app) I can get pypy/django/psycopg-ctypes to respond without issue. But for DB-heavy pages it seems to throw this and then just stall.

@gtaylor
Copy link

gtaylor commented Mar 17, 2012

Try setting DEBUG to False and see if you still run into this.

@philipn
Copy link
Author

philipn commented Mar 17, 2012

I am seeing this with DEBUG = False as well.

@dvarrazzo
Copy link
Collaborator

Would it be possible to get a traceback of it? You may wrap the __del__ method content in a try-except and print it when it happens using the "traceback" method.

@philipn
Copy link
Author

philipn commented Mar 20, 2012

I tried repeatedly to get a traceback and failed. #pypy said that the del method is weird and it's not unexpected that I wouldn't be able to get one.

On Mar 20, 2012, at 10:15 AM, Daniele [email protected] wrote:

Would it be possible to get a traceback of it? You may wrap the del method content in a try-except and print it when it happens using the "traceback" method.


Reply to this email directly or view it on GitHub:
#23 (comment)

@dvarrazzo
Copy link
Collaborator

This is only a shot in the dark: the method is:

    def __del__(self):
        if self._pgres:
            libpq.PQclear(self._pgres)
            self._pgres = None

this is absolutely not thread safe. Could you test with something like:

    def __del__(self):
        pgres = self.__dict__.pop('_pgres', None)
        if pgres is not None:
            libpq.PQclear(pgres)

which is sort of atomic, as long pop is?

Again, this is only shotgun debugging, not that I really understand what's going on, nor it makes any sense at all. Bug in PyPy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants