Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail self.connect() under django #11

Open
mamcx opened this issue Feb 7, 2014 · 2 comments
Open

Fail self.connect() under django #11

mamcx opened this issue Feb 7, 2014 · 2 comments

Comments

@mamcx
Copy link

mamcx commented Feb 7, 2014

I use this lib to publish in real time some data inside a django (1.6) app. Running under the devserver, I get (several of these):

Exception in thread Thread-1256:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 808, in __bootstrap_inner
    self.run()
  File "/Users/mamcx/Proyectos/BestSeller/CloudApi/ENV/src/python-firebasin-master/firebasin/connection.py", line 40, in run
    self.connect()
  File "/Users/mamcx/Proyectos/BestSeller/CloudApi/ENV/src/python-firebasin-master/firebasin/connection.py", line 68, in connect
    self.data.connect()
  File "/Users/mamcx/Proyectos/BestSeller/CloudApi/ENV/lib/python2.7/site-packages/ws4py/client/__init__.py", line 209, in connect
    self.sock.connect(self.bind_addr)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 333, in connect
    self._real_connect(addr, False)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 320, in _real_connect
    socket.connect(self, addr)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
gaierror: [Errno 8] nodename nor servname provided, or not known

I check the code on .connect, and see that before it it just sleep for a while, but NOT really check if the handshake succes:

  # Just hang out until the handshake gives us the actual websocket URL
        while not self.url:
            time.sleep(0.1)
@abeisgoat
Copy link
Owner

Hi Mamcx,

Thanks for contributing with this report!

I'm not familiar with Django, but I don't see anything in our code that would be causing this. Can you provide a complete code sample so I can debug further?

@mamcx
Copy link
Author

mamcx commented Feb 12, 2014

I have not figured how build a test that reproduce this outside django. This is my actual code:

from datetime import datetime

from django.http import HttpResponse, HttpResponseNotModified
from django.conf import settings

from firebasin import Firebase


def sendFirebase(schema, table, isDeleted, x_stationId):
    server = Firebase('%s/%s/sync' % (settings.FIREBASE_URL, schema))

    data = dict(
        table=table,
        date=datetime.now().isoformat(),
        x_stationId=x_stationId,
        isDeleted=isDeleted
    )

    server.set(data)


def syncRecord(request):
    sendFirebase('sample', 'table', True, 1)

    return HttpResponse()

This is running on the django devserver and with gunicorn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants