OperationalError: (2001, “Can't create UNIX socket (24)”)

匿名 (未验证) 提交于 2019-12-03 01:12:01

问题:

I am using django-1.2 and python-2.6 and I am using mysql server.

After working for a while - selecting and updating records, I got this error:

Exception in thread Thread-269: Traceback (most recent call last):   File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner   File "dispatcher.py", line 42, in run   File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 80, in __len__     File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 271, in iterator     File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 677, in results_iter     File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 731, in execute_sql     File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py", line 75, in cursor     File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 297, in _cursor     File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect     File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 187, in __init__   OperationalError: (2001, "Can't create UNIX socket (24)") 

here are lines 41,42 of my dispatcher.py:

dataList = Mydata.objects.filter(date__isnull=True)[:chunkSize] print '%s - DB worker finished reading %s entrys' % (datetime.now(),len(dataList)) 

Any clue why I get this error?
I tried googling but could not find an answer.

I am connecting to the db using django - (I am using localhost)

回答1:

On my machine, errno==24 is defined like

#define EMFILE          24      /* Too many open files */ 

Which means you are running out of filedescriptors. Your app is "leaking" filedescriptors by opening them (and not closing them) again and again.



回答2:

Maybe you're not forgetting to close file. But have too many files opened at the same time.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!