odoo 8.0 on pypy-5.0.1 cause segmentation fault.

Issue #2270 resolved
Jeffery Chenn created an issue

try to run odoo 8.0 on pypy 5.0.1, it failed because segmentation fault.

have installed those packages.

Babel==1.3 cffi==1.5.2 Cython==0.23.5 decorator==3.4.0 docutils==0.12 feedparser==5.1.3 gdata==2.0.18 gevent==1.1.0 greenlet==0.4.7 jcconv==0.2.3 Jinja2==2.7.3 lxml==3.6.0 Mako==1.0.0 MarkupSafe==0.23 mock==1.0.1 passlib==1.6.2 Pillow==2.5.1 psutil==2.1.1 psycogreen==1.0 psycopg2cffi==2.7.3 pydot==1.0.2 pyparsing==1.5.7 pyPdf==1.13 pyserial==2.7 Python-Chart==1.39 python-dateutil==1.5 python-ldap==2.4.15 python-openid==2.2.5 python-stdnum==1.3 pytz==2014.4 pyusb==1.0.0b1 PyYAML==3.11 qrcode==5.0.1 readline==6.2.4.1 reportlab==3.1.44 requests==2.6.0 simplejson==3.5.3 six==1.10.0 unittest2==0.5.1 vatnumber==1.2 vobject==0.6.6 Werkzeug==0.9.6 xlwt==0.7.5

odoo with demo data can running, but crashed when click some menu, such messaging inbox, and opportunities.

i'm new to pypy, have no idea to catch those problem.

Comments (26)

  1. Armin Rigo

    Can you give us a step-by-step way to reproduce the crash? Something like: pip install odoo, then run oodo.py args..., then click here or there.

  2. Jeffery Chenn reporter

    the step to reproduce this error.

    install ubuntu 14.0.4 LTS , then install postgresql database and git tools. update odoo 8.0 source code from http://github.com/odoo/odoo.git and save code in /opt/odoo/ . download pypy-5.0.1 for Linux 64, and extract it to /opt/pypy/. download get-pip.py save into /tmp/, and change to /opt/pypy/bin, then run ./pypy /tmp/get-pip.py to install pip tool.

    because some python lib need to compile from source, so need to install dev tools, and run command sudo apt-get install libxml2 libxslt-dev libpq-dev libldap2-dev libsasl2-dev

    change /opt/odoo/requirements.txt as change psycopg2 to psycopg2cffi and add new line as psycopg2cffi-compact, then install python lib via sudo /opt/pypy/bin/pip install -r /opt/odoo/requirements.txt.

    now, pypy for odoo is reday. next, should to create database for odoo, and run odoo daemon.

    use command sudo -u postgres createuser --createdb --no-createrole --no-superuser --pwprompt odoo to create postgres user odoo and assign a password, such like 1234. now edit odoo.conf file and save in /opt/odoo/, the content of odoo.conf is

    [options]
    ; This is the password that allows database operations:
    ; admin_passwd = admin
    db_host = 127.0.0.1
    db_port = 5432
    db_user = odoo
    db_password = 1234
    

    change to odoo directory, use command /opt/pypy/bin/pypy odoo.py -c odoo.conf to start the odoo service.

    notes.

    if lxml-3.3.5 is not working, please upgrade it to lxml-3.6.

    if odoo raise opcocde LOOKUP_METHOD is not allowed and/or opcocde CALL_METHOD is not allowed, please edit /opt/odoo/openerp/tools/safe_eval.py to add those two opcode into var _SAFE_OPCODES

    _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
        'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR',
        'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'DELETE_NAME',
        'JUMP_FORWARD', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE', 'JUMP_ABSOLUTE',
        'MAKE_FUNCTION', 'SLICE+0', 'SLICE+1', 'SLICE+2', 'SLICE+3', 'BREAK_LOOP',
        'CONTINUE_LOOP', 'RAISE_VARARGS', 'YIELD_VALUE',
        # New in Python 2.7 - http://bugs.python.org/issue4715 :
        'JUMP_IF_FALSE_OR_POP', 'JUMP_IF_TRUE_OR_POP', 'POP_JUMP_IF_FALSE',
        'POP_JUMP_IF_TRUE', 'SETUP_EXCEPT', 'END_FINALLY',
        'LOAD_FAST', 'STORE_FAST', 'DELETE_FAST', 'UNPACK_SEQUENCE',
        'LOAD_GLOBAL', 'LOOKUP_METHOD','CALL_METHOD',# Only allows access to restricted globals
        ] if x in opmap))
    

    type url as http://ip_address_of_odoo_box:8069 to openerp odoo application, create a new database with demonstration data.

    login odoo, and click inbox, odoo should crash because segmentation fault.

  3. Armin Rigo

    I followed your instructions (I had to do a few more edits to requirements.txt). Now I get a page "Apps - Odoo", that says I'm logged in as "Administrator", with a choice of 32 apps. I don't see any "inbox", so I don't know where I should click. Also, I may be missing the "login odoo" part: if I click "Administrator", "Log out", I get an e-mail/password form; but this form doesn't accept the name "odoo", it only accepts "admin"/"1234" and then I'm back at the previous page. I can't find the inbox.

  4. Jeffery Chenn reporter

    sorry for those lost no details information.. once you have created a database with load demonstration data option checked, you can login odoo use the password you typed on database creation form.

    after login odoo, you can go to page "apps - odoo" to install odoo apps, such as CRM, once crm have been installed, it should install " messaging - inbox " for the dependency.

  5. Lucas Fernandez Seivane

    I get a very similar error, I cannot even create the database, I get a segfault. But in the web it is reported to work

  6. Armin Rigo

    I'm trying again today, but now I'm getting these errors (which I didn't get previously) and I don't know how to fix them: can you help?

    OperationalError: could not connect to server: Connection refused
            Is the server running on host "127.0.0.1" and accepting
            TCP/IP connections on port 5432?
    

    Also, when I try again to run createuser or dropuser, I keep getting the same error.

  7. Lucas Fernandez Seivane

    Did you reinstall the machine, change the version of postgresql or something db related? 5432 is a psql port

  8. Armin Rigo

    I'm running this in a Ubuntu chroot. Maybe the first time the "sudo apt-get" command started the server for me. I rebooted the machine in the meantime, so now when I simply chroot into Ubuntu, this service is not automatically restarted.

    Ah, I can probably look around and figure out how to restart it manually from the config files written by Ubuntu. If nothing else I can uninstall and reinstall it...

    (The point is precisely that I don't want to install random things like a Postgres server always running on my real machine. I could also use a real VM instead of a chroot, which wouldn't have this problem...)

  9. Armin Rigo

    Ok, crash reproduced. It seems to occur in lxml.etree. That means I will again have to look at lxml :-) It is a known source of crashes in PyPy's CPython C API emulation layer. That's mostly because it uses a lot of this API in ways that are sometimes hard to predict (but perfectly correct).

  10. Jeffery Chenn reporter

    i have try to replace ctypes lxml with cffi lxml, not success also for faced segmentation fault.

  11. Armin Rigo

    I found and fixed two bugs in the CPython C API emulation layer of PyPy. Now at least it seems to run without crashes any more. Thanks a lot for reporting the problem! Please try with a trunk version of PyPy (or with the next official release, 5.2) and reopen this issue if you still see problems.

    (Note that it takes many minutes to "install" some apps. I don't know if it also takes so long on CPython, or if they are very heavily dependent on lxml or other emulated libraries, or if there is yet another reason for slowness.)

  12. Daniel Reis

    I just stumbled upon this issue, running latest Odoo stable, version 9.0.

    Tried again with latest nightly build but got the same error:

    (pypyc-env)➜  ~ pypy odoo/odoo.py -d pypy-v9
    2016-05-18 11:27:50,580 14397 INFO ? openerp: OpenERP version 9.0c
    2016-05-18 11:27:50,581 14397 INFO ? openerp: addons paths: ['/home/nitrous/.local/share/Odoo/addons/9.0', u'/home/nitrous/odoo/openerp/addons',
    u'/home/nitrous/odoo/addons']
    2016-05-18 11:27:50,581 14397 INFO ? openerp: database: default@default:default
    2016-05-18 11:27:51,069 14397 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
    2016-05-18 11:27:51,092 14397 INFO pypy-v9 openerp.modules.loading: loading 1 modules...
    2016-05-18 11:27:51,748 14397 INFO pypy-v9 openerp.modules.module: module base: creating or updating database tables
    2016-05-18 11:27:53,248 14397 INFO pypy-v9 openerp.modules.loading: loading base/base_data.xml
    2016-05-18 11:27:54,204 14397 INFO pypy-v9 openerp.modules.loading: loading base/res/res_currency_data.xml
    2016-05-18 11:27:55,453 14397 INFO pypy-v9 openerp.modules.loading: loading base/res/res_country_data.xml
    2016-05-18 11:28:05,279 14397 INFO pypy-v9 openerp.modules.loading: loading base/security/base_security.xml
    2016-05-18 11:28:05,816 14397 INFO pypy-v9 openerp.modules.loading: loading base/base_menu.xml
    2016-05-18 11:28:06,447 14397 INFO pypy-v9 openerp.modules.loading: loading base/res/res_config.xml
    2016-05-18 11:28:06,587 14397 INFO pypy-v9 openerp.modules.loading: loading base/res/res.country.state.csv
    2016-05-18 11:28:07,551 14397 INFO pypy-v9 openerp.modules.loading: loading base/ir/ir_actions.xml
    2016-05-18 11:28:09,372 14397 INFO pypy-v9 openerp.modules.loading: loading base/ir/ir_config_parameter_view.xml
    2016-05-18 11:28:09,697 14397 INFO pypy-v9 openerp.modules.loading: loading base/ir/ir_cron_view.xml
    2016-05-18 11:28:10,149 14397 INFO pypy-v9 openerp.modules.loading: loading base/ir/ir_filters.xml
    2016-05-18 11:28:10,563 14397 INFO pypy-v9 openerp.modules.loading: loading base/ir/ir_mail_server_view.xml
    2016-05-18 11:28:10,906 14397 INFO pypy-v9 openerp.modules.loading: loading base/ir/ir_model_view.xml
    [1]    14397 segmentation fault (core dumped)  pypy odoo/odoo.py -d pypy-v9
    (pypyc-env)➜  ~ pypy -V
    Python 2.7.10 (79a62ec1d193, May 17 2016, 22:07:28)
    [PyPy 5.2.0-alpha0 with GCC 4.8.2]
    

    The install was a little different from the explained above, and I have it working on a virtualenv. It was tested on a nitrous.io cloud instance, and I could provide access to it, if that can help.

  13. Armin Rigo

    Maybe on the cloud instance you didn't rebuild all the dependencies, but you did in the virtualenv?

  14. Daniel Reis

    I installed all the dependencies using pip, after activating the virtualenv with pypy. What do you suggest me to do to help reproduce the problem?

  15. Jeffery Chenn reporter

    when run odoo with multi-worker mode, it raise a exception.

    2016-05-19 03:14:23,924 14486 ERROR ? openerp.service.server: Worker (14486) Exception occured, exiting...
    Traceback (most recent call last):
      File "/opt/odoo/odoo8/openerp/service/server.py", line 754, in run
        self.process_limit()
      File "/opt/odoo/odoo8/openerp/service/server.py", line 727, in process_limit
        resource.setrlimit(resource.RLIMIT_CPU, (cpu_time + config['limit_time_cpu'], hard))
      File "/opt/pypy/lib_pypy/resource.py", line 89, in setrlimit
        if lib.my_setrlimit(resource, limits[0], limits[1]) == -1:
    TypeError: expected integer, got float object
    
  16. Phyo Arkar Lwin

    Same problem with latest odoo 9.0c nightly build.

    Running without worker mode , crashes while creating new database. Here are the changes made to make it run on pypy:

    modified requriements.txt :
    
    Babel==1.3 
    Jinja2==2.7.3 
    Mako==1.0.1 
    MarkupSafe==0.23 
    Pillow==2.7.0 
    Python-Chart==1.39 
    PyYAML==3.11 
    Werkzeug==0.9.6 
    argparse==1.2.1 
    decorator==3.4.0 
    docutils==0.12 
    feedparser==5.1.3 
    gdata==2.0.18 
    gevent>=1.1 #changed
    greenlet==0.4.7 
    jcconv==0.2.3 
    lxml==3.4.1 
    mock==1.0.1 
    ofxparse==0.14 
    passlib==1.6.2 
    psutil==2.2.0 
    psycogreen>=1.0 
    psycopg2cffi>=2.5.4 #changed
    pyPdf==1.13 
    pydot==1.0.2 
    pyparsing==2.0.3 
    pyserial==2.7 
    python-dateutil==2.4.0 
    python-ldap==2.4.19 
    python-openid==2.2.5 
    pytz==2014.10 
    pyusb==1.0.0b2 
    qrcode==5.1 
    reportlab==3.1.44 
    requests==2.6.0 
    six==1.9.0 
    suds-jurko==0.6 
    vatnumber==1.2 
    vobject==0.6.6 
    wsgiref==0.1.2 
    xlwt==0.7.5
    

    mobidfied odoo.py and added:

    from psycopg2cffi import compat
    compat.register()
    

    Running with

    pypy odoo.py --workers=3 crashes with TypeError: expected integer, got float object

  17. Armin Rigo

    Sorry jeffery9, when I first read your latest comment I thought it was still about the segfault. But this TypeError is a completely different problem, which is easily fixed (done in aa0294523cbe).

    About the segfault problem: I remember following the instructions, finding one cause of segfault, fixing it, and then not getting the segfault any more. If similar steps still give a (different) segfault, then it is a different bug, and we'd need different instructions about how to produce it. http://pypy.readthedocs.io/en/latest/faq.html#how-should-i-report-a-bug --- ideally, in a new bug report, which can of course copy and adapt some of the instructions given here. Thanks!

  18. Armin Rigo

    Yes, I fixed the issue that was reported. It is possible that there is more issues, but the OP didn't report them, so I have no way to know. Please try and report any issue (in a new issue). Thanks!

  19. Log in to comment