douban / greenify

Make blocking C library work with gevent
BSD 3-Clause "New" or "Revised" License
430 stars 58 forks source link

blocking function ~~~ #3

Closed CMGS closed 9 years ago

CMGS commented 10 years ago

Exception AssertionError: AssertionError('Impossible to call blocking function in the event loop callback',) in 'greenify.wait_gevent' ignored

某种大并发大流量的情况下会发生

hongqn commented 10 years ago

求复现步骤

CMGS commented 10 years ago

还是那个改过之后的mysql-python,平时用没问题,用tsung跑大量测试,然后就会出现了。。。

On Fri, Apr 25, 2014 at 2:37 PM, Qiangning Hong notifications@github.comwrote:

求复现步骤

— Reply to this email directly or view it on GitHubhttps://github.com/douban/greenify/issues/3#issuecomment-41362955 .

-CMGS A simple coder. Love travel, sports especially outdoor sports and computer technology. Have a dream that one day can tour around.

mckelvin commented 9 years ago

这个issue没有下文了吗?

@CMGS 可以给出复现代码以及gevent、mysql-python的版本吗?(Dockerfile就更棒了!)最新版本的greenify不需要patch原始文件的代码,可以在运行时monkey patch内存中的.so文件中的connect等函数。

CMGS commented 9 years ago

@mckelvin 最新的 greenify 我知道~~似乎内网 master 的版本已经修正过了……当时用的是 1.0 rc3 吧, mysql-python 1.2.5,复现代码我得找找。。。年代久远了= =

mckelvin commented 9 years ago

@CMGS

内网 master 的版本已经修正过了

是指内网的 code:greenify@master 已经修复了github上这个 #3 ?现在code:greenify@master 和github上的代码是同步的。

CMGS commented 9 years ago

@mckelvin 恩,这个版本就是新的动态 hook 的版本……我记得xtao跟我说过。我刚才翻了下代码,没找到当时的测试脚本= =,不过可以随时写个恩……

mckelvin commented 9 years ago

@CMGS 表示暂时无法复现。

当时复现的基础代码是:

#!/usr/local/bin/python2.7
#coding:utf-8

import greenify
greenify.greenify()

from MySQLdb import connect

c = [connect(user='root'),
    connect(user='root')]

def app(e, s):
    s('200 OK', [])
    print 'in'
    conn = c.pop()
    cursor = conn.cursor()
    cursor.execute('SELECT SLEEP(10) LIMIT 1;')
    cursor.close()
    c.append(conn)
    return 'yw'

先记录下。

windreamer commented 9 years ago

目前先close, 可以复现再reopen