Solving Server crashes within inspect module when using external debugging/optimization tools

Bug #568257 reported by Alberto Garcia (Factor Libre)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

openerp 5.0.9

Traceback (most recent call last):
  File "openerp-server.py", line 99, in <module>
    pooler.get_db_and_pool(db, update_module=tools.config['init'] or tools.config['update'])
  File "/home/gptmanage/webapps/openerp_server/bin/pooler.py", line 40, in get_db_and_pool
    addons.load_modules(db, force_demo, status, update_module)
  File "/home/gptmanage/webapps/openerp_server/bin/__init__.py", line 678, in load_modules

  File "/home/gptmanage/webapps/openerp_server/bin/sql_db.py", line 316, in cursor
    return Cursor(self._pool, self.dbname, serialized=serialized)
  File "/home/gptmanage/webapps/openerp_server/bin/sql_db.py", line 95, in __init__
    self.__caller = tuple(stack()[2][1:3])
  File "/usr/local/lib/python2.5/inspect.py", line 884, in stack
    return getouterframes(sys._getframe(1), context)
  File "/usr/local/lib/python2.5/inspect.py", line 865, in getouterframes
    framelist.append((frame,) + getframeinfo(frame, context))
  File "/usr/local/lib/python2.5/inspect.py", line 840, in getframeinfo
    lines, lnum = findsource(frame)
  File "/usr/local/lib/python2.5/inspect.py", line 510, in findsource
    if pat.match(lines[lnum]): break
IndexError: list index out of range
Exception exceptions.AttributeError: "'cursor' object has no attribute '_Cursor__caller'" in <bound method Cursor.__del__ of <sql_db.Cursor object at 0x89e594c>> ignored

Revision history for this message
Samuel Bissig (Toradex) (samuel.b) wrote :

I got something similar when I try to run the code (5.0.9) with a debuger (pydev):

Exception exceptions.AttributeError: "'cursor' object has no attribute '_Cursor__caller'" in <bound method Cursor.__del__ of <sql_db.Cursor object at 0xa7e024c>> ignored

When I am running the code not in the debug mode everthing works fine.

Revision history for this message
Alberto Garcia (Factor Libre) (agarcia-flibre) wrote :

I have changed the db_name parameter in openerp config file and work

Revision history for this message
Samuel Bissig (Toradex) (samuel.b) wrote :

I solved the issue by removing the line 95 from sql_db.py temporally:

self.__caller = tuple(stack()[2][1:3])

The problem is, that the pydev debuger does not like the call of stack() function for some reasons.

So I am able to debug 5.0.9 with pydev again.

Changed in openobject-server:
status: New → Confirmed
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Yo lo resolví modificando "C:\python25\Lib\inspect.py"

--- C:\python25\Lib\inspect.py workcopy
+++ C:\python25\Lib\inspect.py workcopy
@@ -507,6 +507,8 @@
         lnum = object.co_firstlineno - 1
         pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)')
         while lnum > 0:
+ if len(lines) < lnum:
+ break
             if pat.match(lines[lnum]): break
             lnum = lnum - 1
         return lines, lnum

Revision history for this message
Samantha (samantha-z-mathews) wrote :

a real showstopper for my team of developpers.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

I am converting this bug to a question, as other people could have the same issue

summary: - can initiate server
+ Solving Server crashes within inspect module when using external
+ debugging/optimization tools
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

(Sorry, Launchpad crashes at the moment during the conversion to a question - so I will close it as Invalid for now, because this is not an OpenERP bug)
In the mean time, here's the answer I would have posted on the question:

Many python-code altering tools interfere with the inspect module on which OpenERP relies (another known one is Psyco) and thus break it. Unfortunately this is not a dependency we can easily lift, and the issue really comes from the way these tools break inspect's vision of python frames. The workaround is to disable these tools (unless you find a way to do a brutal patch, such as suggested in comment #4).

However, please note that our developers use Eclipse with PyDev and are perfectly able to run the OpenERP server within the debugger, so it may be some other specific tool your are using that interferes with this.

Changed in openobject-server:
status: Confirmed → Invalid
Revision history for this message
Daniel Campos (Avanzosc) (dani-ds) wrote :

In my case I have the trouble with the python-psyco compiler, change it and problem solved.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.