gunicorn 19.4.1版本以下使用gthread模式报错,Entry point(‘gunicorn.workers‘,’gthread‘) not found

时间:2024-03-27 18:12:25

 gunicorn版本导致使用 -k gthread 报错

在supervisor中配置gunicorn,大致为gunicorn -k gthread  -w 8 --thread 8 ****

执行时报错:Entry point(‘gunicorn.workers‘,’gthread‘) not found

gunicorn 19.4.1版本以下使用gthread模式报错,Entry point(‘gunicorn.workers‘,’gthread‘) not found

搜索解决方案中,主要有

1. python2需要下载futures

使用的python 2.X,需要下载futures支持gthread模式

gunicorn 19.4.1版本以下使用gthread模式报错,Entry point(‘gunicorn.workers‘,’gthread‘) not found

  2. 升级gunicorn版本至19.4.1

若已经下载futures,仍报错,查看gunicorn版本是否大于19.4.1 ,gunicorn19.4.1已修复该缺陷。

gunicorn上的issue:

https://github.com/benoitc/gunicorn/issues/1011

gunicorn 19.4.1版本以下使用gthread模式报错,Entry point(‘gunicorn.workers‘,’gthread‘) not found

gunicorn官方解决方案:

https://github.com/GoogleCloudPlatform/python-compat-runtime/pull/38

gunicorn 19.4.1版本以下使用gthread模式报错,Entry point(‘gunicorn.workers‘,’gthread‘) not found

Add the 'gthread' worker to the gunicorn.workers.SUPPORTED_WORKERS 

gunicorn 19.4.1版本以下使用gthread模式报错,Entry point(‘gunicorn.workers‘,’gthread‘) not found

3. gunicorn配置删除 -k gthread

https://github.com/benoitc/gunicorn/pull/1538

如果不想升级版本,那么只需要删掉配置中的模式指定语句,-k gthread

gunicorn -k gthread  -w 8 --thread 8 ****    ——>  gunicorn  -w 8 --thread 8 ****

只要threads参数配置大于1 ,那么gthread 会替代sync模式

gunicorn 19.4.1版本以下使用gthread模式报错,Entry point(‘gunicorn.workers‘,’gthread‘) not found