Skip to content

AttributeError: module 'select' has no attribute 'epoll' #2848

Description

@kushalmraut

version : trio==0.22.2

[2023-10-10 12:06:56 +0000] [4254] [INFO] Worker exiting (pid: 4254)
[2023-10-10 12:07:00 +0000] [4232] [INFO] Shutting down: Master
[2023-10-10 12:07:00 +0000] [4232] [INFO] Reason: Worker failed to boot.
[2023-10-10 12:07:04 +0000] [4264] [DEBUG] Current configuration:
 config: None
 bind: ['unix:/run/anahit.sock']
 backlog: 2048
 workers: 1
 worker_class: gevent
 threads: 1
 worker_connections: 1000
 max_requests: 0
 max_requests_jitter: 0
 timeout: 120
 graceful_timeout: 30
 keepalive: 2
 limit_request_line: 4094
 limit_request_fields: 100
 limit_request_field_size: 8190
 reload: False
 reload_engine: auto
 reload_extra_files: []
 spew: False
 check_config: False
 preload_app: False
 sendfile: None
 reuse_port: False
 chdir: /home/anahit_web/anahit_website/app
 daemon: False
 raw_env: []
 pidfile: None
 worker_tmp_dir: None
 user: 1000
 group: 33
 umask: 0
 initgroups: False
 tmp_upload_dir: None
 secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
 forwarded_allow_ips: ['127.0.0.1']
 accesslog: /home/anahit_web/logs/access.log
 disable_redirect_access_to_syslog: False
 access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
 errorlog: /home/anahit_web/logs/anahit_gunicorn.log
 loglevel: debug
 capture_output: True
 logger_class: gunicorn.glogging.Logger
 logconfig: None
 logconfig_dict: {}
 syslog_addr: udp://localhost:514
 syslog: False
 syslog_prefix: None
 syslog_facility: user
 enable_stdio_inheritance: True
 statsd_host: None
 dogstatsd_tags: 
 statsd_prefix: 
 proc_name: None
 default_proc_name: anahit.wsgi:application
 pythonpath: None
 paste: None
 on_starting: <function OnStarting.on_starting at 0x7f93d1e15440>
 on_reload: <function OnReload.on_reload at 0x7f93d1e15580>
 when_ready: <function WhenReady.when_ready at 0x7f93d1e156c0>
 pre_fork: <function Prefork.pre_fork at 0x7f93d1e15800>
 post_fork: <function Postfork.post_fork at 0x7f93d1e15940>
 post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f93d1e15a80>
 worker_int: <function WorkerInt.worker_int at 0x7f93d1e15bc0>
 worker_abort: <function WorkerAbort.worker_abort at 0x7f93d1e15d00>
 pre_exec: <function PreExec.pre_exec at 0x7f93d1e15e40>
 pre_request: <function PreRequest.pre_request at 0x7f93d1e15f80>
 post_request: <function PostRequest.post_request at 0x7f93d1e16020>
 child_exit: <function ChildExit.child_exit at 0x7f93d1e16160>
 worker_exit: <function WorkerExit.worker_exit at 0x7f93d1e162a0>
 nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f93d1e163e0>
 on_exit: <function OnExit.on_exit at 0x7f93d1e16520>
 proxy_protocol: False
 proxy_allow_ips: ['127.0.0.1']
 keyfile: None
 certfile: None
 ssl_version: 2
 cert_reqs: 0
 ca_certs: None
 suppress_ragged_eofs: True
 do_handshake_on_connect: False
 ciphers: None
 raw_paste_global_conf: []
 strip_header_spaces: False
[2023-10-10 12:07:04 +0000] [4264] [INFO] Starting gunicorn 20.0.2
[2023-10-10 12:07:04 +0000] [4264] [DEBUG] Arbiter booted
[2023-10-10 12:07:04 +0000] [4264] [INFO] Listening at: unix:/run/anahit.sock (4264)
[2023-10-10 12:07:04 +0000] [4264] [INFO] Using worker: gevent
[2023-10-10 12:07:04 +0000] [4285] [INFO] Booting worker with pid: 4285
[2023-10-10 12:07:04 +0000] [4264] [DEBUG] 1 workers
[2023-10-10 12:07:21 +0000] [4285] [ERROR] Exception in worker process
Traceback (most recent call last):
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
  worker.init_process()
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/workers/ggevent.py", line 162, in init_process
  super().init_process()
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/workers/base.py", line 119, in init_process
  self.load_wsgi()
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
  self.wsgi = self.app.wsgi()
        ^^^^^^^^^^^^^^^
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/app/base.py", line 66, in wsgi
  self.callable = self.load()
          ^^^^^^^^^^^
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
  return self.load_wsgiapp()
      ^^^^^^^^^^^^^^^^^^^
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
  return util.import_app(self.app_uri)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/gunicorn/util.py", line 358, in import_app
  mod = importlib.import_module(module)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
  return _bootstrap._gcd_import(name[level:], package, level)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
 File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
 File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
 File "<frozen importlib._bootstrap_external>", line 940, in exec_module
 File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
 File "/home/anahit_web/anahit_website/app/anahit/wsgi.py", line 16, in <module>
  application = get_wsgi_application()
         ^^^^^^^^^^^^^^^^^^^^^^
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
  django.setup(set_prefix=False)
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
  apps.populate(settings.INSTALLED_APPS)
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/django/apps/registry.py", line 124, in populate
  app_config.ready()
 File "/home/anahit_web/anahit_website/app/apps/users/apps.py", line 9, in ready
  from . import signals
 File "/home/anahit_web/anahit_website/app/apps/users/signals.py", line 11, in <module>
  from common.utils import send_email_notification
 File "/home/anahit_web/anahit_website/app/common/utils.py", line 28, in <module>
  from discord_webhook import DiscordWebhook
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/discord_webhook/__init__.py", line 5, in <module>
  from .async_webhook import AsyncDiscordWebhook
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/discord_webhook/async_webhook.py", line 13, in <module>
  import httpx # noqa
  ^^^^^^^^^^^^
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpx/__init__.py", line 2, in <module>
  from ._api import delete, get, head, options, patch, post, put, request, stream
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpx/_api.py", line 4, in <module>
  from ._client import Client
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpx/_client.py", line 30, in <module>
  from ._transports.default import AsyncHTTPTransport, HTTPTransport
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpx/_transports/default.py", line 30, in <module>
  import httpcore
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpcore/__init__.py", line 1, in <module>
  from ._api import request, stream
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpcore/_api.py", line 5, in <module>
  from ._sync.connection_pool import ConnectionPool
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpcore/_sync/__init__.py", line 1, in <module>
  from .connection import HTTPConnection
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 12, in <module>
  from .._synchronization import Lock
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/httpcore/_synchronization.py", line 13, in <module>
  import trio
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/trio/__init__.py", line 19, in <module>
  from ._core import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED # isort: skip
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/trio/_core/__init__.py", line 21, in <module>
  from ._local import RunVar
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/trio/_core/_local.py", line 5, in <module>
  from . import _run
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/trio/_core/_run.py", line 2543, in <module>
  from ._io_epoll import EpollIOManager as TheIOManager
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/trio/_core/_io_epoll.py", line 189, in <module>
  class EpollIOManager:
 File "/home/anahit_web/anahit_311/lib/python3.11/site-packages/trio/_core/_io_epoll.py", line 190, in EpollIOManager
  _epoll = attr.ib(factory=select.epoll)
               ^^^^^^^^^^^^
AttributeError: module 'select' has no attribute 'epoll'

I am getting above error if I specify the workers in gunicorn config.

ExecStart= gunicorn_path \
          --log-level debug \
          --enable-stdio-inheritance \
          --capture-output \
          --access-logfile access_log_path \
          --error-logfile error_log_path\
          --worker-class gevent \
          --workers 2 \
          --timeout 120 \
          --bind unix: <socket> \
          project.wsgi:application

gunicorn service file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions