[ZODB-Dev] zeo 2: asyncore?

Mark McEahern marklists@mceahern.com
Thu, 5 Sep 2002 14:45:20 -0500


[Guido van Rossum]
> Can you try this on a different machine?  I'm still suspicious of Red
> Hat 7.3.

Here's the result of trying this on Red Hat 7.2.  I'm getting the same
behavior I was seeing before with a source install of Zope in the ZEO unit
tests:  They seem to hang on checkCommitLock2OnCommit.  Also, the usual
timeouts from the browser.

Here's an overview of what I did followed by detailed instructions:

1.  Install Red Hat Linux 7.2, reformat hard drive.  Select Server Install.
Packages:  KDE and Windows File Server.
2.  Remove all the emacs RPMs:

    for x in `rpm -qa | grep emacs` ; do sudo rpm -e --nodeps $x ; done

    and install emacs 21.2.1 from source tarball.  (I mention this only in
the interest of being complete.)
3.  Install Python 2.1.3 from source tarball.
4.  Install Zope 2.5.1 from source tarball.
5.  Build ZEO 2.0b1 from source tarball.
6.  Run the ZEO unit tests.  When it gets to checkCommitLock2OnCommit, it
just sits there.  Indefinitely.  Sometimes it doesn't get past
checkCommitLock2OnAbort (which is immediately before
checkCommitLock2OnCommit).  If I press Ctrl+C, the rest of the tests
pass--except those two or one, if checkCommitLock2OnAbort happens to pass.
It seems like the Abort test fails the first time, but then passes after I
cancel once.  That's not the case with the Commit test.  It has not passed
once on Red Hat 7.2 from a source build of Python 2.1.3 and Zope.
7.  Ignoring the unit tests, I proceed with an installation of ZEO.
8.  Start ZEO.  Start Zope.  Try to access http://localhost:8080/ --same
thing.  Try changing the start script for Zope to specify -a 192.168.0.2
(the ethernet address) and then use http://192.168.0.2:8080/ --same thing.
Try the hostname http://mail.internal:8080/ --same thing.

Hmm, now I'm beginning to wonder whether my fake TLD for internal addresses
is the problem.  My dhcp server is also running dnscache (from djbdns) to
serve these names.  What's weird about that is Zope without ZEO works just
fine (i.e., if I don't place the custom_zodb.py in instance home).  So maybe
this is a red herring.

Cheers,

// mark

-- Detailed instructions --

Installing Python and Zope from a full source distribution

1.  Install Python 2.1.3.

    Download the source tarball for Python 2.1.3:

        $ cd /var/tmp
        $ wget http://www.python.org/ftp/python/2.1.3/Python-2.1.3.tgz

    Unpack the tarball:

        $ tar -zxvf Python-2.1.3.tgz

    Configure, make, install:

        $ cd Python-2.1.3
        $ ./configure --with-threads --without-pymalloc
        $ make
        $ sudo make altinstall

    In the tail end of the output from sudo make altinstall on Red
    Hat 7.2, I saw this:

    <output>
    warning: install: modules installed to
    '/usr/local/lib/python2.1/lib-dynload/', which is not in Python's
    module search path (sys.path) -- you'll have to change the search
    path yourself
    </output>

    However, that doesn't seem to be a problem:

    <output>
    $ python2.1
    Python 2.1.3 (#1, Sep  5 2002, 12:57:41)
    [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> print sys.path

    ['', '/usr/local/lib/python2.1',
    '/usr/local/lib/python2.1/plat-linux2',
    '/usr/local/lib/python2.1/lib-tk',
**  '/usr/local/lib/python2.1/lib-dynload',
    '/usr/local/lib/python2.1/site-packages']
    >>>
    </output>

    From Zope's doc/INSTALL.txt, "The python you run Zope with *must*
    have threads compiled in..."

    On pymalloc:

        http://lists.zope.org/pipermail/zope-dev/2002-May/016487.html

    TODO:  Enable large file support?  See:

        http://www.zope.org/Members/beacon/install_instructions

2.  Download the source distribution for Zope 2.5.1:

    $ cd /var/tmp
    $ wget http://www.zope.org/Products/Zope/2.5.1/Zope-2.5.1-src.tgz

3.  Unpack the tarball:

    $ tar -zxvf Zope-2.5.1-src.tgz

4.  Move it to /usr/local and omit src from the name:

    $ sudo mv /var/tmp/Zope-2.5.1-src /usr/local/Zope-2.5.1

5.  Make a symbolic link for Zope:

    $ sudo ln -s /usr/local/Zope-2.5.1 /usr/local/Zope

6.  Link in the python libraries:

    $ cd /usr/local/Zope
    $ ln -s /usr/local/lib/python2.1/ lib/.

7.  Make a symbolic link to the python2.1 binary:

    $ mkdir bin
    $ ln -s /usr/local/bin/python2.1 bin/python

8.  (skip this for now)

    Finally add a link to the ZServer module inside the Zope
    path--this is needed to make the unit testrunner work:

    $ ln -s /usr/local/Zope-2.5.1/ZServer/ lib/python/.

    (TODO:  Another reference I saw suggested this is not necessary.
    Find that reference.)

9.  Build Zope:

    $ python2.1 wo_pcgi.py

    <output>
    ...
        The initial user name and password are 'admin'
        and 'Ou9TIOtq'.

        You can change the name and password through the web
        interface or using the 'zpasswd.py' script.
    </output>

10. Create zope user and group:

    $ sudo /usr/sbin/groupadd zope
    $ sudo /usr/sbin/useradd -M -g zope -s /sbin/nologin zope

11. Copy start file

    $ cp $cvs/start_src_install /usr/local/Zope/start

    This is what start_src_install looks like:
    <code>
    #! /bin/sh
    reldir=`dirname $0`
    INST_HOME=`cd $reldir; pwd`
    export INST_HOME
    export STUPID_LOG_FILE='/var/tmp/zope.log'
    exec /usr/local/bin/python2.1 \
      $INST_HOME/z2.py \
      -u zope
      "$@" \
    </code>

12. Change ownership of /usr/local/Zope-2.5.1/.

    $ sudo chown -R zope:zope /usr/local/Zope-2.5.1/.

13. Make sure only the zope user can write to var:

    $ cd /usr/local/Zope
    $ sudo chmod -R 700 var/

13. Start Zope:

    $ sudo /usr/local/Zope/start

$Id: README.ZEO,v 1.11 2002/09/05 18:44:48 mmceahern Exp $

Installing ZEO 2

All of these commands are issued as a normal user--those prefixed by
sudo run as root and require configuring /etc/sudoers.

1.  Install Zope (see above).

2.  Make sure it's not running:

    $ sudo /sbin/service zope stop

    or, for a source install:

    $ sudo /usr/local/Zope/stop

3.  Download ZEO to /var/tmp:

    $ cd /var/tmp
    $ wget http://www.zope.org/Products/ZEO/ZEO-2.0b1.tar.gz

4.  Unpack the tarball:

    $ tar -zxvf ZEO-2.0b1.tar.gz

5.  Run the unit tests.

    $ cd ZEO
    $ export PYTHONPATH='/usr/local/Zope/lib/python'
    $ python2.1 setup.py build
    $ python2.1 test.py -v -v

6.  Run setup:

    $ sudo python2.1 setup.py install --home=/usr/local/Zope/

7.  Copy files.

    custom_zodb.py --> /usr/local/Zope/.
    StorageConfig.py --> /usr/local/Zope/lib/python/ZEO/.
    zeo_start --> /usr/local/Zope/.
    zeo_stop --> /usr/local/Zope/.

    (see below for content)

8.  Start ZEO:

    $ sudo /usr/local/Zope/zeo_start

    Start Zope:

    $ sudo /usr/local/Zope/start

<custom_zodb.py>
use_unix_sockets = 0

if use_unix_sockets:
    from ZEO.ClientStorage import ClientStorage
    socket = "/var/zope/var/zeo.soc"
    Storage = ClientStorage(socket, storage="main")
else:
    from ZEO.ClientStorage import ClientStorage
    zeo_server = '192.168.0.2'
    port = 8800
    Storage = ClientStorage((zeo_server, port), storage="main")

<StorageConfig.py>
import ZODB.FileStorage
main_storage = ZODB.FileStorage.FileStorage("/usr/local/Zope/var/Data.fs")

<zeo_start>
#!/bin/sh
reldir=`dirname $0`

use_unix_sockets=0

if [ $use_unix_sockets == 1 ] ; then
    socket_file=/var/zope/var/zeo.soc
    if [ -S $socket_file ] ; then
        rm $socket_file
    fi
    exec python2.1 $reldir/lib/python/ZEO/start.py \
        -S main=StorageConfig:main_storage -u zope -U $socket_file \
        ZEO_SERVER_PID=$reldir/var/ZEO_SERVER.pid \
        STUPID_LOG_FILE=$reldir/var/ZEO_EVENTS.log \
        "$@"
else
    exec python2.1 $reldir/lib/python/ZEO/start.py \
        -S main=StorageConfig:main_storage -u zope -p 8800 -h 192.168.0.2 \
        ZEO_SERVER_PID=$reldir/var/ZEO_SERVER.pid \
        STUPID_LOG_FILE=$reldir/var/ZEO_EVENTS.log \
        "$@"
fi

<zeo_stop>
#!/bin/sh
reldir=`dirname $0`
kill `cat $reldir/var/ZEO_SERVER.pid`

-