PHP/MongoDB 错误:未捕获异常“MongoCursorException”

发布于 2024-12-22 14:09:52 字数 258 浏览 3 评论 0原文

所以我使用 MongoLab 作为我的数据库主机,最近我遇到了这个问题。每当我第一次加载应用程序并在第一次运行时清除缓存时,我都会收到以下错误消息:

致命错误:未捕获带有消息的异常“MongoCursorException” “无法发送查询:连接已被对等方重置”

在我再次刷新页面并且应用程序加载时没有任何问题。我想知道是否有人知道此错误的原因或有任何解决方案来解决此问题。

谢谢,节日快乐。

So i'm using MongoLab as my DB Host and recently I have been running into this issue. Whenever I load up my application for the first time with a cleared cache on the first run, I receive this error message:

Fatal error: Uncaught exception 'MongoCursorException' with message
'couldn't send query: Connection reset by peer'

After I refresh the page again and the application loads without any issues. I was wondering if anyone knew the reason for this error or had any fixes to resolve this.

Thanks and Happy Holidays.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十雾 2024-12-29 14:09:52

您在哪里托管您的应用程序代码?

可能发生的情况是,第一个连接需要一段时间(比设置的超时时间长)才能连接到 MongoLab 主机。然后建立连接,以便第二个请求使用它。

Where are you hosting your app code?

What is likely happening is that the first connection is taking a while (longer than the set timeout) to connect to the MongoLab host. The connection is then established so that the second request uses it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文