gpt4 book ai didi

ruby-on-rails - 在 rake 任务中接收到 "ActiveRecord::StatementInvalid: PG::ConnectionBad: PQconsumeInput() could not receive data from server: Connection timed out"

转载 作者:行者123 更新时间:2023-11-29 11:29:58 24 4
gpt4 key购买 nike

在我的 rake 任务中,我通过 pgbouncer 设置连接到 postgresql。对于某些查询,我收到此错误:

ActiveRecord::StatementInvalid: PG::ConnectionBad: PQconsumeInput() could not receive data from server: Connection timed out

在我的 pgbouncer 日志中,我看到了这个条目:

closing because: client unexpected eof (age=3110)

我在我的 config/database.yml 文件中禁用了准备好的语句,并在我的 pgbouncer 配置文件中启用了 transaction pool_mode。当我直接连接到 postgres 时,我没有收到此错误。

同样在我的 rake 任务中,我正在创建多个线程。我尝试按照 here 的建议在我的线程中运行 ActiveRecord::Base.connection.reconnect! 。这也没有帮助。

我正在使用具有 this fix 的 rails 版本 4.2.5。我仍然收到此错误“无法从服务器接收数据:连接超时”。

最佳答案

这是由于客户端的网络问题造成的。无法重现,因为我们将服务器和客户端都迁移到了 Google Cloud Platform。早些时候我们的服务器在 DigitalOcean 中,而我们的客户端在 GCP 中。

关于ruby-on-rails - 在 rake 任务中接收到 "ActiveRecord::StatementInvalid: PG::ConnectionBad: PQconsumeInput() could not receive data from server: Connection timed out",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38294359/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com