ValueError: Unable to parse connection string: "127.0.0.1"

Asked by Nathanael Anderson

I just did a fresh install of graphite, and when I try to bring up the url, this is what I get. I checked in #django on freenode and they asked about CACHE_BACKEND = 'memcached://' + ';'.join(MEMCACHE_HOSTS) + '/?timeout=60' from the default config, but then I didn't get any leads. I don't have much python or django experience right now, so i may just not know what i'm looking at.

Client:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.2.8 (Ubuntu) mod_python/3.3.1 Python/2.5.2 Server at myserver Port 80

Server:

[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] mod_python (pid=24895, interpreter='graphite', phase='PythonHandler', handler='django.core.handlers.modpython'): Application error
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] ServerName: 'graphite'
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] DocumentRoot: '/usr/local/graphite/'
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] URI: '/'
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] Location: '/'
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] Directory: None
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] Filename: '/usr/local/graphite/'
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] PathInfo: ''
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] Traceback (most recent call last):
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target\n result = _execute_target(config, req, object, arg)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target\n result = object(arg)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 177, in handler\n return ModPythonHandler()(req)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 145, in __call__\n self.load_middleware()
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/core/handlers/base.py", line 29, in load_middleware\n mod = __import__(mw_module, {}, {}, [''])
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/middleware/gzip.py", line 3, in <module>\n from django.utils.cache import patch_vary_headers
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/utils/cache.py", line 22, in <module>\n from django.core.cache import cache
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/core/cache/__init__.py", line 54, in <module>\n cache = get_cache(settings.CACHE_BACKEND)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/core/cache/__init__.py", line 52, in get_cache\n return cache_class(host, params)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/var/lib/python-support/python2.5/django/core/cache/backends/memcached.py", line 13, in __init__\n self._cache = memcache.Client(server.split(';'))
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/usr/lib/python2.5/site-packages/python_memcached-1.43-py2.5.egg/memcache.py", line 153, in __init__\n self.set_servers(servers)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/usr/lib/python2.5/site-packages/python_memcached-1.43-py2.5.egg/memcache.py", line 174, in set_servers\n self.servers = [_Host(s, self.debuglog) for s in servers]
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] File "/usr/lib/python2.5/site-packages/python_memcached-1.43-py2.5.egg/memcache.py", line 810, in __init__\n raise ValueError('Unable to parse connection string: "%s"' % host)
[Sun Jun 29 11:17:00 2008] [error] [client 192.168.129.13] ValueError: Unable to parse connection string: "127.0.0.1"

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
chrismd
Solved:
Last query:
Last reply:
Revision history for this message
anshul (anshul-k) said :
#1

Even I have got the same error. After turning Debug On on mod_python... this is what I get... Any help?

MOD_PYTHON ERROR

ProcessId: 12899
Interpreter: 'graphite'

ServerName: 'graphite'
DocumentRoot: '/usr/local/graphite/'

URI: '/'
Location: '/'
Directory: None
Filename: '/usr/local/graphite/'
PathInfo: ''

Phase: 'PythonHandler'
Handler: 'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", line 177, in handler
    return ModPythonHandler()(req)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", line 145, in __call__
    self.load_middleware()

  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 29, in load_middleware
    mod = __import__(mw_module, {}, {}, [''])

  File "/usr/lib/python2.5/site-packages/django/middleware/gzip.py", line 3, in <module>
    from django.utils.cache import patch_vary_headers

  File "/usr/lib/python2.5/site-packages/django/utils/cache.py", line 22, in <module>
    from django.core.cache import cache

  File "/usr/lib/python2.5/site-packages/django/core/cache/__init__.py", line 54, in <module>
    cache = get_cache(settings.CACHE_BACKEND)

  File "/usr/lib/python2.5/site-packages/django/core/cache/__init__.py", line 52, in get_cache
    return cache_class(host, params)

  File "/usr/lib/python2.5/site-packages/django/core/cache/backends/memcached.py", line 13, in __init__
    self._cache = memcache.Client(server.split(';'))

  File "/usr/lib/python2.5/site-packages/python_memcached-1.43-py2.5.egg/memcache.py", line 153, in __init__
    self.set_servers(servers)

  File "/usr/lib/python2.5/site-packages/python_memcached-1.43-py2.5.egg/memcache.py", line 174, in set_servers
    self.servers = [_Host(s, self.debuglog) for s in servers]

  File "/usr/lib/python2.5/site-packages/python_memcached-1.43-py2.5.egg/memcache.py", line 810, in __init__
    raise ValueError('Unable to parse connection string: "%s"' % host)

ValueError: Unable to parse connection string: "127.0.0.1"

Revision history for this message
Best chrismd (chrismd) said :
#2

Turns out this is a bug. The python-memcached module changed its API such that a port is now required. You can make this change manually for now, and I will fix it in trunk.

In settings.py, the line:

MEMCACHE_HOSTS = ["127.0.0.1"]

Should be changed to:

MEMCACHE_HOSTS = ["127.0.0.1:11211"]

Revision history for this message
Nathanael Anderson (wirelessdreamer) said :
#3

That took care of the problem, thanks for the quick reply.