No entry or class found for 'MongoProxy.InsertOne'

未关闭
#59 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
mongodb, php
领域
backend, database

调研方向

从报告的 MongoProxy.InsertOne 失败开始,跟踪 vendor/hyperf/di/src/Container.php:79 中经过 SocketIPCReceiver.php 第 130 行和第 85 行的容器查找过程。应用运行一段时间后重新复现该错误,然后将其与提供的 insertOne 方法进行比较。完成的标准是理解反复出现的查找失败,并且 Mongo 插入路径不再产生此异常。

由索引模型根据 Issue 内容生成。

描述

运行一段时间后,报错 ,hyperf 版本是2.2最新版本
log.ERROR: Insert Document hybrid error 'Hyperf\Di\Exception\NotFoundException: No entry or class found for 'MongoProxy.InsertOne'(0) in /app/web/accept/vendor/hyperf/di/src/Container.php:79
Stack trace:
#0 /app/web/accept/vendor/hyperf/di/src/Container.php(127): Hyperf\Di\Container->make()
#1 /app/web/accept/vendor/hyperf/gotask/src/IPC/SocketIPCReceiver.php(130): Hyperf\Di\Container->get()
#2 /app/web/accept/vendor/hyperf/gotask/src/IPC/SocketIPCReceiver.php(85): Hyperf\GoTask\IPC\SocketIPCReceiver->dispatch()
#3 {main}' on 'Hyperf\GoTask\Relay\CoroutineSocketRelay'

    public function __construct(ContainerInterface $container,MongoClient $client)
    {
        $this->container = $container;
        $this->logger =$container->get(LoggerFactory::class)->get("log");
        $this->database = $client->database('test');
    }

    public function insertOne(string $collect,array $data)
    {
        try{
            return $this->database->collection($collect)->insertOne($data);
        }catch (\Throwable $e){
            $this->logger->error("Insert Document {$collect} ".$e->getMessage());
        }
        return null;
    }
主要语言
PHP
星标
255
派生
29
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hyperf/gotask 的其他 Issue

查看 hyperf/gotask 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。