使用from eurasia import socket2 socket2.install(),py-redis 不能连接上 redis server

15 views
Skip to first unread message

bawbaw hu

unread,
Dec 23, 2010, 8:02:11 PM12/23/10
to eurasi...@googlegroups.com
因为我要使用 urllib.urlopen 去做异步 http 调用,
其中我参考了手册中
使用
from eurasia import socket2
socket2.install()
但是只要一使用这个,就会出现底下的错误讯息,不能连接上 redis server

HproseException: Traceback (most recent call last):
File "/usr/bin/python2.7/lib/python2.7/site-packages/hprose-1.2-py2.7.egg/hprose/httpserver.py", line 83, in handler self._doInvoke(reader, writer, session, environ)
File "/usr/bin/python2.7/lib/python2.7/site-packages/hprose-1.2-py2.7.egg/hprose/server.py", line 100, in _doInvoke result = function(*functionArgs) File "./test.py", line 615, in daemon_process_bingo_data db_nums = get_bingo_nums('today')
File "./test.py", line 123, in get_bingo_nums return client.hlen(get_key(date_str))
File "build/bdist.linux-i686/egg/redis/client.py", line 1180, in hlen return self.execute_command('HLEN', name)
File "build/bdist.linux-i686/egg/redis/client.py", line 332, in execute_command **options
File "build/bdist.linux-i686/egg/redis/client.py", line 320, in _execute_command self.connection.send(command, self)
File "build/bdist.linux-i686/egg/redis/client.py", line 82, in send self.connect(redis_instance)
File "build/bdist.linux-i686/egg/redis/client.py", line 63, in connect raise ConnectionError(error_message) ConnectionError: Error 0 connecting localhost:6379. Success. )
message"Traceback (most recent call last):\n ..."

Wilhelm Shen

unread,
Dec 23, 2010, 9:45:24 PM12/23/10
to eurasi...@googlegroups.com
你试试下载最新的快照,应该能解决这个问题。

http://code.google.com/p/eurasia/downloads/detail?name=eurasia-3.1-snapshot.tar.bz2

> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“eurasia-users”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 eurasi...@googlegroups.com
> 要取消订阅此网上论坛,请发送电子邮件至 eurasia-user...@googlegroups.com
> 若有更多问题,请通过 http://groups.google.com/group/eurasia-users?hl=zh-CN 访问此网上论坛。
>

bawbaw hu

unread,
Dec 24, 2010, 1:11:29 AM12/24/10
to eurasi...@googlegroups.com
我换上后,一样不能正常呢,错误讯息如下
console.dir(HproseException: Traceback (most recent call last): File "/usr/bin/python2.7/lib/python2.7/site-packages/hprose-1.2-py2.7.egg/hprose/httpserver.py", line 83, in handler self._doInvoke(reader, writer, session, environ) File "/usr/bin/python2.7/lib/python2.7/site-packages/hprose-1.2-py2.7.egg/hprose/server.py", line 111, in _doInvoke result = function(functionName, functionArgs) File "./test.py", line 626, in cache_call return cache_func(func, args = arges, index_key = range(len(arges)), ttl = 700) File "/var/www/python/test_pyquery/utility/local/__init__.py", line 65, in cache_func rs = function(*args) if serialize is None else serialize(function(*args)) File "./test.py", line 224, in cal_number_nums for info in get_bingo_info(date_str, nums): File "./test.py", line 112, in get_bingo_info infos = client.hmget(get_key(date_str), get_bingo_numbers_by_date(date_str, nums, desc)) File "build/bdist.linux-i686/egg/redis/client.py", line 1208, in hmget return self.execute_command('HMGET', name, *keys) File "build/bdist.linux-i686/egg/redis/client.py", line 332, in execute_command **options File "build/bdist.linux-i686/egg/redis/client.py", line 320, in _execute_command self.connection.send(command, self) File "build/bdist.linux-i686/egg/redis/client.py", line 82, in send self.connect(redis_instance) File "build/bdist.linux-i686/egg/redis/client.py", line 63, in connect raise ConnectionError(error_message) ConnectionError: Error 0 connecting localhost:6379. Success. )

message"Traceback (most recent call last):\n ..."
name"HproseException"


Wilhelm Shen <wile...@gmail.com> 於 2010年12月24日上午10:45 寫道:
你试试下载最新的快照,应该能解决这个问题。

http://code.google.com/p/eurasia/downloads/detail?name=eurasia-3.1-snapshot.tar.bz2

Wilhelm Shen

unread,
Dec 24, 2010, 4:10:41 AM12/24/10
to eurasi...@googlegroups.com
发现快照没有及时更新,现在快照已修正。

或者直接替换 socket2.py 文件。

http://eurasia.googlecode.com/svn-history/r356/branches/3.1/socket2.py

bawbaw hu

unread,
Dec 24, 2010, 6:19:00 AM12/24/10
to eurasi...@googlegroups.com
谢谢沈大,目前更后后的确好用了

Wilhelm Shen <wile...@gmail.com> 於 2010年12月24日下午5:10 寫道:
发现快照没有及时更新,现在快照已修正。

或者直接替换 socket2.py 文件。

http://eurasia.googlecode.com/svn-history/r356/branches/3.1/socket2.py

bawbaw hu

unread,
Dec 24, 2010, 7:40:06 AM12/24/10
to eurasi...@googlegroups.com
更新后,另外再测试之前异步 io 的东东,还是一样的错误
使用手册中的代码
from eurasia.core import file
from eurasia.web import httpserver, mainloop

def handler(httpfile):
    bufsize = 8192
    test_txt = open('test.txt')
    fd = file(test_txt.fileno())

    httpfile.start_response('200 OK', [('Content-Type', 'text/plain')])
    # 每次从文件读取 bufsize,返回给浏览器
    data = fd.read(bufsize)
    while data:
        httpfile.sendall(data)
        data = fd.read(bufsize)
    httpfile.close()

httpd = httpserver(':8080', handler)
httpd.start()
mainloop()


报出的错误为

Traceback (most recent call last):
  File "./test.py", line 21, in <module>
    mainloop()
OSError: [Errno 1] Operation not permitted

Wilhelm Shen

unread,
Dec 25, 2010, 1:18:25 AM12/25/10
to eurasi...@googlegroups.com
经测试这应该是 pyev ( http://code.google.com/p/pyev/ ) 或者 libev 的一个 bug。

通过从当前版本 pyev 0.5.3-3.8 降级到 pyev 0.5.0-3.8,Operation not permitted
的报错不再出现。但是即便在不出错的情况下 (前几次访问时) 文件 IO 似乎并不是
立即可读的,对此我目前也比较困惑。

另外,使用 core.file 来处理管道(os.popen)和 socket 则没什么问题。这说明
eurasia 的程序逻辑似乎并没有什么问题。对此,我需要进一步研究一下。

老光

unread,
Dec 26, 2010, 8:13:33 PM12/26/10
to eurasi...@googlegroups.com
老大加油咯! 我也是对异步文件IO一直比较感兴趣,我一直在看咯!

沈崴

unread,
Dec 29, 2010, 4:33:54 AM12/29/10
to eurasia-users
经过检查,如果使用 epoll 作为 backend 就会发生 Operation not permitted,
如果使用 select 作为 backend 则工作正常。

正在进一步解决。

On 12月27日, 上午1时13分, 老光 <yaoguangm...@cq.chinatelecom.com.cn> wrote:
> 老大加油咯! 我也是对异步文件IO一直比较感兴趣,我一直在看咯!
>
> ----- Original Message -----
> From: "Wilhelm Shen" <wilei...@gmail.com>
> To: <eurasi...@googlegroups.com>
> Sent: Saturday, December 25, 2010 2:18 PM
> Subject: Re: [eurasia-users] 使用from eurasia import socket2 socket2.install(),py-redis 不能连接上 redis server
>

> > 经测试这应该是 pyev (http://code.google.com/p/pyev/) 或者 libev 的一个 bug。


>
> > 通过从当前版本 pyev 0.5.3-3.8 降级到 pyev 0.5.0-3.8,Operation not permitted
> > 的报错不再出现。但是即便在不出错的情况下 (前几次访问时) 文件 IO 似乎并不是
> > 立即可读的,对此我目前也比较困惑。
>
> > 另外,使用 core.file 来处理管道(os.popen)和 socket 则没什么问题。这说明
> > eurasia 的程序逻辑似乎并没有什么问题。对此,我需要进一步研究一下。
>

Reply all
Reply to author
Forward
0 new messages