ITADN

Closing PostgreSQL connection deadlocks listen(_:)

#601Openbillyean 创建于 2025-11-06
B
billyeancommented
### Describe the issue Closing PostgreSQL connection deadlocks listen(_:) ### Vapor version latest ### Operating system and version macOS 26.01 ### Swift version Swift 6.2 ### Steps to reproduce Reproduction: 1. The code looks like that: try await self.postgresClient.withConnection { connection in 148: log.debug("Notifications: Starting listening", metadata: [ "topic": "\(topic)", "psql.conn.id": "\(connection.id)", "psql.conn.isClosed": "\(connection.isClosed)" ]) sequence = try await connection.listen(topic.stringValue) 154: log.debug("Notifications: Now listening", metadata: [ "topic": "\(topic)", "psql.conn.id": "\(connection.id)", "psql.conn.isClosed": "\(connection.isClosed)" ]) 2. brew services restart postgresql 3. The error log similar to the log above gets generated, and the system goes into a deadlock. ### Outcome client goes to infinite waiting ### Additional notes Hash a PR for the fix https://github.com/vapor/postgres-nio/pull/600
1 条评论