mher / flower

Real-time monitor and web admin for Celery distributed task queue
https://flower.readthedocs.io
Other
6.48k stars 1.09k forks source link

greenlet.error: cannot switch to a different thread when grequests installed #819

Closed Verisana closed 4 years ago

Verisana commented 6 years ago

Checklist

Error: [E 180720 20:27:22 gen:854] Multiple exceptions in yield list Traceback (most recent call last): File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/tornado/gen.py", line 849, in callback result_list.append(f.result()) File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result return self.get_result() File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in get_result raise self._exception File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/celery/app/control.py", line 140, in conf return self._request('conf', with_defaults=with_defaults) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/celery/app/control.py", line 95, in _request timeout=self.timeout, reply=True, File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/celery/app/control.py", line 454, in broadcast limit, callback, channel=channel, File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/pidbox.py", line 315, in _broadcast serializer=serializer) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/pidbox.py", line 280, in _publish maybe_declare(self.reply_queue(channel)) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/common.py", line 129, in maybe_declare return _maybe_declare(entity, declared, ident, channel, orig) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/common.py", line 135, in _maybe_declare entity.declare(channel=channel) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/entity.py", line 605, in declare self._create_queue(nowait=nowait, channel=channel) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/entity.py", line 616, in _create_queue self.queue_bind(nowait=nowait, channel=channel) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/entity.py", line 661, in queue_bind channel=channel, nowait=nowait) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/kombu/entity.py", line 673, in bind_to nowait=nowait, File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/amqp/channel.py", line 928, in queue_bind wait=None if nowait else spec.Queue.BindOk, File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/amqp/abstract_channel.py", line 59, in send_method return self.wait(wait, returns_tuple=returns_tuple) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/amqp/abstract_channel.py", line 79, in wait self.connection.drain_events(timeout=timeout) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/amqp/connection.py", line 491, in drain_events while not self.blocking_read(timeout): File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/amqp/connection.py", line 496, in blocking_read frame = self.transport.read_frame() File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/amqp/transport.py", line 243, in read_frame frame_header = read(7, True) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/amqp/transport.py", line 418, in _read s = recv(n - len(rbuf)) File "/home/assanix/.virtualenvs/autobot/lib/python3.6/site-packages/gevent/_socket3.py", line 382, in recv self._wait(self._read_event) File "src/gevent/_hub_primitives.py", line 265, in gevent.hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 266, in gevent.__hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 252, in gevent.hub_primitives._primitive_wait File "src/gevent/_hub_primitives.py", line 46, in gevent.hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_hub_primitives.py", line 46, in gevent.__hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_hub_primitives.py", line 55, in gevent.hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_waiter.py", line 151, in gevent.waiter.Waiter.get File "src/gevent/_greenlet_primitives.py", line 59, in gevent.greenlet_primitives.SwitchOutGreenletWithLoop.switch File "src/gevent/_greenlet_primitives.py", line 59, in gevent.greenlet_primitives.SwitchOutGreenletWithLoop.switch File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch File "src/gevent/greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch greenlet.error: cannot switch to a different thread [E 180720 20:27:24 workers:22] cannot switch to a different thread

It is repeating.

celery report: software -> celery:4.2.0 (windowlicker) kombu:4.2.1 py:3.6.5 billiard:3.5.0.3 py-amqp:2.3.2 platform -> system:Linux arch:64bit, ELF imp:CPython loader -> celery.loaders.app.AppLoader settings -> transport:amqp results:rpc:///

ABSOLUTE_URL_OVERRIDES: { } ADMINS: [('admin', 'admin@example.com')] ALLOWED_HOSTS: [] APPEND_SLASH: True AUTHENTICATION_BACKENDS: ('django.contrib.auth.backends.ModelBackend',) AUTH_PASSWORD_VALIDATORS: '****' AUTH_USER_MODEL: 'profiles.Profile' BASE_DIR: '/home/assanix/Documents/autobot' CACHES: { 'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} CACHE_MIDDLEWARE_ALIAS: 'default' CACHE_MIDDLEWARE_KEY_PREFIX: '****' CACHE_MIDDLEWARE_SECONDS: 600 CELERY_BEAT_SCHEDULE: { 'ad_bot_runner': {'schedule': 5.0, 'task': 'btcbot.tasks.ad_bot_runner'}} CELERY_BROKER_URL: 'amqp://guest:****@localhost:5672//' CELERY_RESULT_BACKEND: 'rpc:///' CELERY_TASK_ROUTES: { 'btcbot.tasks.ad_bot_runner': {'queue': 'ad_bot_runner'}, 'btcbot.tasks.buy_ad_bot_execution': {'queue': 'buy_ad_bot_execution'}, 'btcbot.tasks.sell_ad_bot_execution': {'queue': 'sell_ad_bot_execution'}} CELERY_TIMEZONE: 'Asia/Yekaterinburg' CSRF_COOKIE_AGE: 31449600 CSRF_COOKIE_DOMAIN: None CSRF_COOKIE_HTTPONLY: False CSRF_COOKIE_NAME: 'csrftoken' CSRF_COOKIE_PATH: '/' CSRF_COOKIE_SAMESITE: 'Lax' CSRF_COOKIE_SECURE: False CSRF_FAILURE_VIEW: 'django.views.csrf.csrf_failure' CSRF_HEADER_NAME: 'HTTP_X_CSRFTOKEN' CSRF_TRUSTED_ORIGINS: [] CSRF_USE_SESSIONS: False DATABASES: { 'default': { 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql', 'HOST': 'localhost', 'NAME': 'autobot', 'OPTIONS': {}, 'PASSWORD': '****', 'PORT': '', 'TEST': { 'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': 'botbtc_db'}} DATABASE_ROUTERS: '****' DATA_UPLOAD_MAX_MEMORY_SIZE: 2621440 DATA_UPLOAD_MAX_NUMBER_FIELDS: 1000 DATETIME_FORMAT: 'N j, Y, P' DATETIME_INPUT_FORMATS: ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y'] DATE_FORMAT: 'N j, Y' DATE_INPUT_FORMATS: ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y'] DEBUG: True DEBUG_PROPAGATE_EXCEPTIONS: False DECIMAL_SEPARATOR: '.' DEFAULT_CHARSET: 'utf-8' DEFAULT_CONTENT_TYPE: 'text/html' DEFAULT_EXCEPTION_REPORTER_FILTER: 'django.views.debug.SafeExceptionReporterFilter' DEFAULT_FILE_STORAGE: 'django.core.files.storage.FileSystemStorage' DEFAULT_FROM_EMAIL: 'webmaster@localhost' DEFAULT_INDEX_TABLESPACE: '' DEFAULT_TABLESPACE: '' DISALLOWED_USER_AGENTS: [] EMAIL_BACKEND: 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST: '127.0.0.1' EMAIL_HOST_PASSWORD: '****' EMAIL_HOST_USER: '' EMAIL_PORT: '1025' EMAIL_SSL_CERTFILE: None EMAIL_SSL_KEYFILE: '****' EMAIL_SUBJECT_PREFIX: '[Django] ' EMAIL_TIMEOUT: None EMAIL_USE_LOCALTIME: False EMAIL_USE_SSL: False EMAIL_USE_TLS: False FILE_CHARSET: 'utf-8' FILE_UPLOAD_DIRECTORY_PERMISSIONS: None FILE_UPLOAD_HANDLERS: ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler'] FILE_UPLOAD_MAX_MEMORY_SIZE: 2621440 FILE_UPLOAD_PERMISSIONS: None FILE_UPLOAD_TEMP_DIR: None FIRST_DAY_OF_WEEK: 0 FIXTURE_DIRS: [] FORCE_SCRIPT_NAME: None FORMAT_MODULE_PATH: None FORM_RENDERER: 'django.forms.renderers.DjangoTemplates' IGNORABLE_404_URLS: [] INSTALLED_APPS: ['info_data.apps.InfoDataConfig', 'btcbot.apps.BtcbotConfig', 'profiles.apps.ProfilesConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] INTERNAL_IPS: ['127.0.0.1'] LANGUAGES: [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')] LANGUAGES_BIDI: ['he', 'ar', 'fa', 'ur'] LANGUAGE_CODE: 'en-us' LANGUAGE_COOKIE_AGE: None LANGUAGE_COOKIE_DOMAIN: None LANGUAGE_COOKIE_NAME: 'django_language' LANGUAGE_COOKIE_PATH: '/' LOCALE_PATHS: [] LOGGING: { } LOGGING_CONFIG: 'logging.config.dictConfig' LOGIN_REDIRECT_URL: '/' LOGIN_URL: '/accounts/login/' LOGOUT_REDIRECT_URL: None MANAGERS: [] MEDIA_ROOT: '' MEDIA_URL: '' MESSAGE_STORAGE: 'django.contrib.messages.storage.fallback.FallbackStorage' MIDDLEWARE: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] MIGRATION_MODULES: { } MONTH_DAY_FORMAT: 'F j' NUMBER_GROUPING: 0 PASSWORD_HASHERS: '****' PASSWORD_RESET_TIMEOUT_DAYS: '****' PREPEND_WWW: False ROOT_URLCONF: 'autobot.urls' SECRET_KEY: '****' SECURE_BROWSER_XSS_FILTER: False SECURE_CONTENT_TYPE_NOSNIFF: False SECURE_HSTS_INCLUDE_SUBDOMAINS: False SECURE_HSTS_PRELOAD: False SECURE_HSTS_SECONDS: 0 SECURE_PROXY_SSL_HEADER: None SECURE_REDIRECT_EXEMPT: [] SECURE_SSL_HOST: None SECURE_SSL_REDIRECT: False SERVER_EMAIL: 'root@localhost' SESSION_CACHE_ALIAS: 'default' SESSION_COOKIE_AGE: 1209600 SESSION_COOKIE_DOMAIN: None SESSION_COOKIE_HTTPONLY: True SESSION_COOKIE_NAME: 'sessionid' SESSION_COOKIE_PATH: '/' SESSION_COOKIE_SAMESITE: 'Lax' SESSION_COOKIE_SECURE: False SESSION_ENGINE: 'django.contrib.sessions.backends.db' SESSION_EXPIRE_AT_BROWSER_CLOSE: False SESSION_FILE_PATH: None SESSION_SAVE_EVERY_REQUEST: False SESSION_SERIALIZER: 'django.contrib.sessions.serializers.JSONSerializer' SETTINGS_MODULE: 'autobot.settings' SHORT_DATETIME_FORMAT: 'm/d/Y P' SHORT_DATE_FORMAT: 'm/d/Y' SIGNING_BACKEND: 'django.core.signing.TimestampSigner' SILENCED_SYSTEM_CHECKS: [] STATICFILES_DIRS: ['/home/assanix/Documents/autobot/static'] STATICFILES_FINDERS: ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder'] STATICFILES_STORAGE: 'django.contrib.staticfiles.storage.StaticFilesStorage' STATIC_ROOT: '/home/assanix/Documents/autobot/static_files' STATIC_URL: '/static/' TEMPLATES: [{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/home/assanix/Documents/autobot/templates/'], 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages']}}] TEST_NON_SERIALIZED_APPS: [] TEST_RUNNER: 'django.test.runner.DiscoverRunner' THOUSAND_SEPARATOR: ',' TIME_FORMAT: 'P' TIME_INPUT_FORMATS: ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M'] TIME_ZONE: 'Asia/Yekaterinburg' USE_I18N: True USE_L10N: True USE_THOUSAND_SEPARATOR: False USE_TZ: True USE_X_FORWARDED_HOST: False USE_X_FORWARDED_PORT: False WSGI_APPLICATION: 'autobot.wsgi.application' X_FRAME_OPTIONS: 'SAMEORIGIN' YEAR_MONTH_FORMAT: 'F Y' is_overridden: <bound method Settings.is_overridden of <Settings "autobot.settings">>

Steps to reproduce

  1. install grequests
  2. start flower
  3. open workers page.

Expected behavior

open workers page

Actual behavior

Unknown worker or open the page, but error is still exists

dmitri-vlasov commented 6 years ago

+1 I've faced with the same issue with grequests module installed when starting flower from command line:

Multiple exceptions in yield list Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/tornado/gen.py", line 883, in callback result_list.append(f.result()) File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 425, in result return self.get_result() File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 384, in get_result raise self._exception File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.6/site-packages/celery/app/control.py", line 97, in scheduled return self._request('scheduled') File "/usr/local/lib/python3.6/site-packages/celery/app/control.py", line 81, in _request timeout=self.timeout, reply=True, File "/usr/local/lib/python3.6/site-packages/celery/app/control.py", line 436, in broadcast limit, callback, channel=channel, File "/usr/local/lib/python3.6/site-packages/kombu/pidbox.py", line 315, in _broadcast serializer=serializer) File "/usr/local/lib/python3.6/site-packages/kombu/pidbox.py", line 280, in _publish maybe_declare(self.reply_queue(channel)) File "/usr/local/lib/python3.6/site-packages/kombu/common.py", line 129, in maybe_declare return _maybe_declare(entity, declared, ident, channel, orig) File "/usr/local/lib/python3.6/site-packages/kombu/common.py", line 135, in _maybe_declare entity.declare(channel=channel) File "/usr/local/lib/python3.6/site-packages/kombu/entity.py", line 604, in declare self._create_exchange(nowait=nowait, channel=channel) File "/usr/local/lib/python3.6/site-packages/kombu/entity.py", line 611, in _create_exchange self.exchange.declare(nowait=nowait, channel=channel) File "/usr/local/lib/python3.6/site-packages/kombu/entity.py", line 185, in declare nowait=nowait, passive=passive, File "/usr/local/lib/python3.6/site-packages/amqp/channel.py", line 614, in exchange_declare wait=None if nowait else spec.Exchange.DeclareOk, File "/usr/local/lib/python3.6/site-packages/amqp/abstract_channel.py", line 59, in send_method return self.wait(wait, returns_tuple=returns_tuple) File "/usr/local/lib/python3.6/site-packages/amqp/abstract_channel.py", line 79, in wait self.connection.drain_events(timeout=timeout) File "/usr/local/lib/python3.6/site-packages/amqp/connection.py", line 491, in drain_events while not self.blocking_read(timeout): File "/usr/local/lib/python3.6/site-packages/amqp/connection.py", line 496, in blocking_read frame = self.transport.read_frame() File "/usr/local/lib/python3.6/site-packages/amqp/transport.py", line 243, in read_frame frame_header = read(7, True) File "/usr/local/lib/python3.6/site-packages/amqp/transport.py", line 418, in _read s = recv(n - len(rbuf)) File "/usr/local/lib/python3.6/site-packages/gevent/_socket3.py", line 382, in recv self._wait(self._read_event) File "src/gevent/_hub_primitives.py", line 265, in gevent.hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 266, in gevent.__hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 252, in gevent.hub_primitives._primitive_wait File "src/gevent/_hub_primitives.py", line 46, in gevent.hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_hub_primitives.py", line 46, in gevent.__hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_hub_primitives.py", line 55, in gevent.hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_waiter.py", line 151, in gevent.waiter.Waiter.get File "src/gevent/_greenlet_primitives.py", line 59, in gevent.greenlet_primitives.SwitchOutGreenletWithLoop.switch File "src/gevent/_greenlet_primitives.py", line 59, in gevent.greenlet_primitives.SwitchOutGreenletWithLoop.switch File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch File "src/gevent/greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch greenlet.error: cannot switch to a different thread

I've tried to money patch the flower file / task file with:

from gevent import monkey monkey.patch_all() but it wasn't helped.

ChandlerLui commented 5 years ago

your question is too long, buddy.

dmitri-vlasov commented 5 years ago

your question is too long, buddy.

Not a question is long, but description. But it's nevermind. Question is simple - why flower doesn't start if grequests are installed?

ChandlerLui commented 5 years ago

your question is too long, buddy.

Not a question is long, but description. But it's nevermind. Question is simple - why flower doesn't start if grequests are installed?

I dont know either, i got a error about grequests, so i google it ,then i found you.did your problem solved yet?

ChandlerLui commented 5 years ago

your question is too long, buddy.

Not a question is long, but description. But it's nevermind. Question is simple - why flower doesn't start if grequests are installed?

and I didt use celery, i use pycharm to run it, and project run successfully, but if request, the "greenlet.error: cannot switch to a different thread" error is show up, monkey patch_all is no use either, and i found grequests have already used monkey.patch_all(). Im still solve this problem,if i got answer,i would tell you .