Skip to content

Connections are beeing dropped while gthread worker restart #3380

Open
@michdan

Description

@michdan

I have noticed that from time to time, while gthread worker is about to be restarted and when there is an instant traffic there are connection errors:
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

I was debbuging it, just added more logs and this is what I found:

  | [2025-04-11 11:14:21 +0000] [12] [DEBUG] POST /
  | [2025-04-11 11:14:21 +0000] [12] [INFO] Autorestarting worker after current request.
  | 192.168.117.1 - - [11/Apr/2025:11:14:21 +0000] "POST /?sleep=0.2&i=25 HTTP/1.1" 200 13 "-" "python-requests/2.32.3"
  | [2025-04-11 11:14:21 +0000] [12] [DEBUG] Closing connection.
  | [2025-04-11 11:14:21 +0000] [12] [DEBUG] 2025-04-11 11:14:21.658864: Accepted connection from ('192.168.117.1', 38358) on ('0.0.0.0', 8401), self.alive: False
  | [2025-04-11 11:14:21 +0000] [12] [INFO] Worker exiting (pid: 12)
  | [2025-04-11 11:14:21 +0000] [19] [INFO] Booting worker with pid: 19

We can see that between setting alive to False and worker exiting, there is new request beeing accepted while flag alive is already False.
This is due to a fact that poller is stii handling new requests.
I have prepared a fix proposal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions