Faust with Django connection closed problem

オープン
#666 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
18/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
django, kafka, postgresql, python

調査の方向性

The payload shows only logs from a long-running Faust agent that uses the Django ORM, with psycopg2 'connection already closed' and 'server closed the connection unexpectedly' errors. No Faust agent code or reproduction steps are included, so start by reproducing with a Faust agent that runs ORM queries over a long period. Then look at how Django manages DB connections in async or long-lived processes, such as close_old_connections and CONN_MAX_AGE. Done means a documented or tested approach that keeps connections valid across an agent's lifetime. The issue has no maintainer response and asks an open question, so it needs design decisions first.

索引モデルが issue の本文から書いたものです。

説明

I'm using Faust in combination with a Django backend. Faust is integrated as a Django app but runs in a separate container, similar to how Celery workers operate — except in this case, it's Faust with Kafka.

Inside my Faust agents, I'm performing asynchronous operations using Django's ORM. After the system runs for a while, I begin encountering connection closed errors during ORM operations. This seems related to how database connections are managed in long-lived async processes.
any idea how to handle this?
logs:

920 | psycopg2.InterfaceError: connection already closed |  
-- | -- | --
  |   | 2025-09-12 09:56:15.920 | django.db.utils.InterfaceError: connection already closed |  
  |   | 2025-09-12 09:56:15.920 | psycopg2.InterfaceError: connection already closed |  
  | 
 | Fields |   | container_name | processor_agent.1.dic96f1ikb3zgicm8nl9l7ih7 |   | filename | /var/log/docker/9cd7bc50abb53e57aabebe6f7f7b71df007ae4be86155ac89313e551c0fda5e3/json.log |   | host | XXXXXXX |   | source | stderr |   | swarm_service | processor_agent |   | swarm_stack | alertify
Fields
  | container_name | processor_agent.1.dic96f1ikb3zgicm8nl9l7ih7
  | filename | /var/log/docker/9cd7bc50abb53e57aabebe6f7f7b71df007ae4be86155ac89313e551c0fda5e3/json.log
  | host | XXXXXXXXX
  | source | stderr
  | swarm_service | processor_agent
  | swarm_stack | xxxx
  |   | 2025-09-12 09:56:15.920 | django.db.utils.OperationalError: server closed the connection unexpectedly |  
  |   | 2025-09-12 09:56:15.920 | psycopg2.OperationalError: server closed the connection unexpectedly |  
  |   | 2025-09-12 09:40:40.671 | elastic_transport.ConnectionError: Connection error caused by: ProtocolError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))) |  
  |   | 2025-09-12 09:40:40.671 | urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) |  
  |   | 2025-09-12 09:40:40.671 | raise RemoteDisconnected("Remote end closed connection without" |  
  |   | 2025-09-12 09:40:40.671 | http.client.RemoteDisconnected: Remote end closed connection without response |  
  |   | 2025-09-12 09:40:40.671 | raise RemoteDisconnected("Remote end closed connection without" |  
  |   | 2025-09-12 09:00:02.668 | elastic_transport.ConnectionError: Connection error caused by: ProtocolError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))) |  
  |   | 2025-09-12 09:00:02.668 | urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) |  
  |   | 2025-09-12 09:00:02.668 | raise RemoteDisconnected("Remote end closed connection without" |  
  |   | 2025-09-12 09:00:02.668 | http.client.RemoteDisconnected: Remote end closed connection without response |  
  |   | 2025-09-12 09:00:02.668 | raise RemoteDisconnected("Remote end closed connection without" |  
  |   | 2025-09-12 09:00:02.428 | django.db.utils.OperationalError: server closed the connection unexpectedly |  
  |   | 2025-09-12 09:00:02.428 | psycopg2.OperationalError: server closed the connection unexpectedly |  
  |   | 2025-09-12 09:00:02.428 | [2025-09-12 10:00:02,374] [7] [ERROR] 🔥 Error processing alert 'XXXXXXXXX': server closed the connection unexpectedly |  
  |   | 2025-09-12 09:00:02.346 | psycopg2.InterfaceError: connection already closed |  
  |   | 2025-09-12 09:00:02.346 | django.db.utils.InterfaceError: connection already closed
主要言語
Python
スター
1.9k
フォーク
205
平均マージ
2時間 2分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

faust-streaming/faust のほかの issue

faust-streaming/faust の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。