JCR 0.7.2 and Pylons > 0.9.7 - solution

Help
2010-03-04
2012-12-15
  • John Dickson
    John Dickson
    2010-03-04

    Hi folks

    JCR 0.7.2 is incompatible with changes made in recent Pylons versions.  Pylons is the web framework used by JCR.

    Symptoms may include:

    - JCR will not start, but instead shows a stack trace on the console
    - JCR starts, but the login page redirects continuously until stopped by the browser.

    The solution is to downgrade Pylons to version 0.9.7, and to make the appropriate changes to the dependent libraries used by Pylons.  Here's how (examples assume you're running Ubuntu Linux):

    1. Remove all old libraries from the Python site-packages directory (this is extracted from a shell script):

        # adjust this to suit your installation
        PYTHON_SITE_PACKAGES=/usr/lib/python2.5/site-packages

        # IMPORTANT - the order of these must be right!
        for f in Pygments AuthKit SQLAlchemy Pylons Tempita WebTest WebError WebOb Mako \
                nose decorator simplejson FormEncode PasteScript PasteDeploy Paste Beaker WebHelpers Routes
            echo "-----------------------------------"
            echo "Removing $f"
            sudo easy_install -m $f
            if ; then
                sudo rm -fR $PYTHON_SITE_PACKAGES/$f*
            else
                echo "**** Failed to remove package $f ****"
            fi
        done

      You'll find that you need to enter the root password once when running these commands.

    2. Install Pylons 0.9.7

        sudo easy_install Pylons==0.9.7

    3. Remove JCR:

        sudo easy_install -m jcr
        sudo rm -fR $PYTHON_SITE_PACKAGES/jcr*

    4. Re-install JCR

        sudo easy_install -f . jcr   # or using whichever DB you wanted

    5. Complete the remaining installation steps as per the documentation (create config file, initialise, start).

    The next version of JCR will support the most recent changes to Pylons.

    Cheers ……………………………….. JD

     
  • marchey
    marchey
    2010-03-05

    This solved the exceptions on starting jcr (invalid imports, etc), but its still suffering from the redirect loop problem trying to login from firefox.  Any suggestions on how to proceed?  thanks.

     
  • I can reproduce this.

    on RHEL5.2, 64bit.

    I've followed standard install procedure, just installed Pylons 0.9.7 before jcr.

    The log shows that login keeps being redirected for /login:

    10:55:19,448 INFO  base  Session expired - forwarding to login page: /login
    10:55:19,450 DEBUG middleware  Response time:  0.003s, URL: /
    10:55:19,581 INFO  base  Session expired - forwarding to login page: /login
    10:55:19,582 DEBUG middleware  Response time:  0.002s, URL: /login
    10:55:19,586 INFO  base  Session expired - forwarding to login page: /login
    10:55:19,587 DEBUG middleware  Response time:  0.002s, URL: /login
    10:55:19,590 INFO  base  Session expired - forwarding to login page: /login

    firefox detects the loop, IE goes on forever.

    Any ideas?
    Jeroen.

     
  • Commenting out the "redirect_to(url)" in __redirectIfSessionExpired in basy.py gives a 404 on /login.

     
  • John Dickson
    John Dickson
    2010-04-07

    Hi folks

    I'm really sorry about not being around to deal with this one.  But I'll be back from Nepal on Sunday, so I hope to resolve it then.

    Cheers ……………………………………… JD

     
  • John Dickson
    John Dickson
    2010-04-11

    Hi folks

    I'm now back from my trip, and trying to reproduce this redirect issue.  Once again, my apologies for the delay.

    Unfortunately I haven't been able to reproduce the problem.  It would therefore help a lot if those of you experiencing the issue could post a more detailed bug report.  In particular:

    - Operating system, version and architecture
    - Python version
    - Output from 'ls -l /your/python/site-packages', e.g. 'ls -l /usr/lib/python2.5/site-packages'
    - Log output from JCR on startup
    - The URL you type into the browser to connect to JCR
    - If at all possible, a transcript of all HTTP request and response headers in the session, e.g. captured using the Firefox 'Live HTTP Headers' plugin.

    Thanks in advance for your help in tracking this down.

    Cheers ……………………………… JD

     
  • John Dickson
    John Dickson
    2010-04-11

    Hi folks

    Having looked through the code, there's one thing you could try if you're still having problems with this issue - I don't know if it will resolve the issue, but it's worth a go.

    Due to the libraries used by JCR, there are actually *2* sessions - Authkit maintains one, for authentication data, while Paste maintains a second one containing all the usual web session attributes.  The problem could be caused by these getting out of sync.  To ensure that this isn't the case:

    - Stop JCR (and verify that it's stopped, using 'ps')
    - Remove the contents of the 'data/' directory under the JCR install directory, e.g. (with great care) 'rm -fR /opt/jcr-0.7.2/data/*'
    - Start JCR, and see whether the problem remains.

    Please let me know in either case, i.e. whether this assists or not.

    Cheers ………………………………….. JD

     

  • Anonymous
    2010-04-11

    I'm trying to use jcr in my project, but I have the same problem( can't redirect to login page).
    I tried on 2 system, ubuntu 9.04 and debian 5.
    On ubuntu, I install jcr by easy_install automatically,
    On debian, I download all dependent packages and install manually, because I can't solve the proxy server problem with easy_install.

    On debian it's the same result with jvriesman.
    On ubuntu, when connect server by explore, the server print some call stack trace message, but it's too long, I sent it to you by message.

    Hope it's useful for you.

     
  • John Dickson
    John Dickson
    2010-04-11

    Hi, mystery Ubuntu/Debian user  :)

    1) I still haven't received your stack trace message.  If you're having problems, please send it direct to
        captsens at gmail dot com
    2) Could you please forward the information I listed in post number 6 above?.  This will help me to diagnose the problem.

    Thanks in advance.

    Cheers …………………………. JD

     
  • About removing anything in the data dir, there is nothing in it:

    # ls -laR
    .:
    total 16
    drwxrwxr-x  4 jcr jcr 4096 Apr  6 10:36 .
    drwxr-xr-x 13 jcr jcr 4096 Apr  6 10:38 ..
    drwxrwxr-x  2 jcr jcr 4096 Apr  6 10:36 cache
    drwxrwxr-x  2 jcr jcr 4096 Apr  6 10:36 sessions

    ./cache:
    total 8
    drwxrwxr-x 2 jcr jcr 4096 Apr  6 10:36 .
    drwxrwxr-x 4 jcr jcr 4096 Apr  6 10:36 ..

    ./sessions:
    total 8
    drwxrwxr-x 2 jcr jcr 4096 Apr  6 10:36 .
    drwxrwxr-x 4 jcr jcr 4096 Apr  6 10:36 ..

     
  • $ cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 5.3 (Tikanga)
    $ rpm -q python
    python-2.4.3-24.el5
    $ ls -l /usr/lib/python2.4/site-packages/
    total 1252
    -rw-r-r- 1 root root  32246 Dec 11  2008 audit.py
    -rw-r-r- 1 root root  28639 Dec 11  2008 audit.pyc
    -rw-r-r- 1 root root  28639 Dec 11  2008 audit.pyo
    drwxr-xr-x 4 root root   4096 Apr  6 10:14 AuthKit-0.4.5-py2.4.egg
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 Beaker-1.5.3-py2.4.egg
    -rwxr-xr-x 1 root root   4996 Jun 20  2007 cracklibmodule.so
    drwxr-xr-x 3 root root   4096 Apr  6 10:11 decorator-3.1.2-py2.4.egg
    -rw-r-r- 1 root root    867 Apr  6 10:14 easy-install.pth
    drwxr-xr-x 2 root root   4096 Apr  6 09:57 elementtree
    -rw-r-r- 1 root root  57867 Apr  6 10:14 elementtree-1.2.7_20070827_preview-py2.4.egg
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 FormEncode-1.2.2-py2.4.egg
    drwxr-xr-x 2 root root   4096 Apr  6 09:57 iniparse
    -rw-r-r- 1 root root  39388 Oct 21  2008 instnum.py
    -rw-r-r- 1 root root  30738 Oct 21  2008 instnum.pyc
    -rw-r-r- 1 root root  30738 Oct 21  2008 instnum.pyo
    drwxr-xr-x 4 root root   4096 Apr  6 10:14 jcr-0.7.2.egg
    drwxr-xr-x 2 root root   4096 Apr  6 10:00 libsvn
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 Mako-0.3.2-py2.4.egg
    drwxr-xr-x 5 root root   4096 Apr  6 10:11 nose-0.11.3-py2.4.egg
    drwxr-xr-x 5 root root   4096 Apr  6 10:11 Paste-1.7.3-py2.4.egg
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 PasteDeploy-1.3.3-py2.4.egg
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 PasteScript-1.7.3-py2.4.egg
    drwxr-xr-x 2 root root   4096 Apr  6 09:58 pirut
    -rw-r-r- 1 root root 185732 Apr  6 10:14 psycopg2-2.2.0-py2.4-linux-x86_64.egg
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 Pygments-1.3.1-py2.4.egg
    drwxr-xr-x 4 root root   4096 Apr  6 10:10 Pylons-0.9.7-py2.4.egg
    -rw-r-r- 1 root root 288912 Apr  6 10:14 python_openid-2.2.4-py2.4.egg
    drwxr-xr-x 2 root root   4096 Apr  6 09:58 rhn
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 Routes-1.12.1-py2.4.egg
    drwxr-xr-x 2 root root   4096 Apr  6 09:58 rpmUtils
    drwxr-xr-x 2 root root   4096 Apr  6 09:58 setroubleshoot
    drwxr-xr-x 4 root root   4096 Apr  6 10:05 setuptools-0.6c11-py2.4.egg
    -rw-r-r- 1 root root     30 Apr  6 10:05 setuptools.pth
    -rw-r-r- 1 root root 114186 Apr  6 10:11 simplejson-2.1.1-py2.4-linux-x86_64.egg
    drwxr-xr-x 3 root root   4096 Apr  6 09:58 sos
    drwxr-xr-x 4 root root   4096 Apr  6 10:14 SQLAlchemy-0.4.8-py2.4.egg
    drwxr-xr-x 2 root root   4096 Apr  6 10:00 svn
    -rw-r-r- 1 root root  28216 Apr  6 10:11 Tempita-0.4-py2.4.egg
    drwxr-xr-x 2 root root   4096 Apr  6 09:58 urlgrabber
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 WebError-0.10.2-py2.4.egg
    drwxr-xr-x 4 root root   4096 Apr  6 10:11 WebHelpers-1.0b5-py2.4.egg
    -rw-r-r- 1 root root 139137 Apr  6 10:11 WebOb-0.9.8-py2.4.egg
    -rw-r-r- 1 root root  44903 Apr  6 10:11 WebTest-1.2-py2.4.egg
    drwxr-xr-x 2 root root   4096 Apr  6 09:58 yum

     
  • How was nepal?

     
  • No out put on the command line (not even with -v option), is htere a way to make paster tell us more?

    this is the HTTP header capture:

    http://jcr.eot:5000/

    GET / HTTP/1.1
    Host: jcr.eot:5000
    User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.2) Gecko/2008092400 Red Hat/3.0.2-3.el5 Firefox/3.0.2
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive

    HTTP/1.0 302 Found
    Server: PasteWSGIServer/0.5 Python/2.4.3
    Date: Mon, 12 Apr 2010 07:30:10 GMT
    Content-Type: text/html; charset=UTF-8
    Location: http://jcr.eot:5000/login
    Content-Length: 233


    http://jcr.eot:5000/login

    GET /login HTTP/1.1
    Host: jcr.eot:5000
    User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.2) Gecko/2008092400 Red Hat/3.0.2-3.el5 Firefox/3.0.2
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive

    HTTP/1.0 302 Found
    Server: PasteWSGIServer/0.5 Python/2.4.3
    Date: Mon, 12 Apr 2010 07:30:10 GMT
    Content-Type: text/html; charset=UTF-8
    Location: http://jcr.eot:5000/login
    Content-Length: 233


    http://jcr.eot:5000/login

    etc…etc..

    GET /login HTTP/1.1
    Host: jcr.eot:5000
    User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.2) Gecko/2008092400 Red Hat/3.0.2-3.el5 Firefox/3.0.2
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive

    HTTP/1.0 302 Found
    Server: PasteWSGIServer/0.5 Python/2.4.3
    Date: Mon, 12 Apr 2010 07:30:10 GMT
    Content-Type: text/html; charset=UTF-8
    Location: http://jcr.eot:5000/login
    Content-Length: 233

     
  • Output of strace, startup, login with loop and shutdown:

    strace paster serve -v jcr.ini >strace.loop.jcr 2>&1

    http://www.mapser.net/strace.loop.jcr.gz

     
  • John Dickson
    John Dickson
    2010-04-12

    Hi Jeroen

    Thanks very much for all that information - exactly what I needed!  Reproduced it first time!

    The problem is the version of the Routes component installed - you have version 1.12.1, while I have version 1.10.3.  It appears that there's been an incompatible change.

    The fix is simple - get easy_install to change the Routes version:

      sudo easy_install Routes==1.10.3

    Could you please confirm whether that resolves the issue (and whether you have other issues)?  If this sorts it out I'll post updated workaround instructions.

    FYI, here are the other differences I found between your libraries and mine - if you have any other problems it may be worth downgrading these using the same mechanism:

        - WebHelpers 0.6.4 (JD) vs 1.0b5 (Jeroen)
        - decorator-3.0.0 vs 3.1.2
        - Paste 1.7.2 vs 1.7.3
        - simplejson 2.0.9 vs 2.1.1

    And Nepal was wonderful, thank you - I basically didn't think about software for 5 weeks, and it takes something pretty damn good to stop me thinking about software!  Highly recommended.

    Good luck with the fix - I hope it works.

    Cheers …………………………. JD

     
  • Downgrading to Routes version 1.10.3 works!

    Thanks a lot.

     

  • Anonymous
    2010-04-12

    After changed the Routes version, it works fine now , thank you very much.
    ---------From the mystery Ubuntu/Debian user