StreamServer doesn't exapt/handle any connections

51 views
Skip to first unread message

Dominic Lüchinger

unread,
Jun 20, 2013, 6:52:46 PM6/20/13
to ginkg...@googlegroups.com
Dear members

I've tried to install ginkgo and test a simple example but I failed.

This is what I tested
===============

Running Xubuntu 12.10

$mkdir project-folder/
$cd project-folder
$virtualenv .virtualenv --no-site-packages
$source .virtualenv/bin/activate
$python --version
# Python 2.7.4
$sudo apt-get install python-dev libevent-dev
$pip install gevent ginkgo

$cat << 'EOF' > quickstart.py
import logging
from ginkgo import Service
from ginkgo.async.gevent import StreamServer

logger = logging.getLogger(__name__)

class HelloWorldServer(Service):
    def __init__(self):
        self.add_service(StreamServer(('0.0.0.0', 7000), self.handle))

    def handle(self, socket, address):
        logger.debug("New connection {}".format(address))
        while True:
            socket.send("Hello World\n")
            self.async.sleep(1)
EOF

$ginkgo quickstart.HelloWorldServer

## Second console
$nc localhost 7000


The problem at this point is, that no connection is handled. I expect receiving every second "Hello World". But netcat receives nothing. The connection between netcat and the server is somehow in a limbo state. If I quit the server, netcat realizes, that the connection is gone and exits.

Does someone see a thing that I'm doing wrong?

------------ pip list -----------
argparse (1.2.1)
distribute (0.6.34)
gevent (0.13.8)
Ginkgo (0.6.0dev)
greenlet (0.4.1)
wsgiref (0.1.2)
---------------------------------

Thank you for the help and kind regards

Dominic

erik...@gmail.com

unread,
Feb 18, 2014, 5:28:41 AM2/18/14
to ginkg...@googlegroups.com
Hello
Im experiencing the same thing, the local HelloWorld-example is working, but the StreamServer is not yielding anything.

running ubuntu 13.10 in vmware. 

virtualenv:
Ginkgo==0.6.0dev
argparse==1.2.1
gevent==1.0
greenlet==0.4.2
nose==1.3.0
wsgiref==0.1.2

The same was true when installing into the global python. (list of pip freeze too long to post :) ). Same also true when running ginkgo with sudo.

All test (all 6) successful on "make test" though.

Is this a dead project by now - if so, are there any successors carrying on with the same idea?

/Erik

erik...@gmail.com

unread,
Feb 25, 2014, 3:12:38 PM2/25/14
to ginkg...@googlegroups.com

Hi 
I got it to work by changing the default async to gevent instead of threading. I have no idea what error might cause the connect to be accepted but the handle not triggered. I haven't checked a lot of scenarios, but at least identified that it is not general but somehow linked to the threading module. 

/Erik


On Friday, June 21, 2013 12:52:46 AM UTC+2, Dominic Lüchinger wrote:
Reply all
Reply to author
Forward
0 new messages