{"record":{"id":"ab47d3c13596acb6","repo":"qiurunze123/miaosha","slug":"10001-ab47d3","errorCode":"10001","errorMessage":"系统错误","messagePattern":"系统错误","errorType":"exception","errorClass":"GlobleException","httpStatus":null,"severity":"error","filePath":"miaosha-v2/miaosha-web/src/main/java/com/geekq/miaosha/controller/GoodsController.java","lineNumber":66,"sourceCode":"    @Autowired\n    private com.geekq.api.service.GoodsService goodsServiceRpc;\n\n    /**\n     * QPS:1267 load:15 mysql\n     * 5000 * 10\n     * QPS:2884, load:5\n     */\n    @RequireLogin(seconds = 5, maxCount = 5, needLogin = true)\n    @RequestMapping(value = \"/to_list\", produces = \"text/html\")\n    @ResponseBody\n    public String list(HttpServletRequest request, HttpServletResponse response, Model model, MiaoshaUser user) {\n        model.addAttribute(\"user\", user);\n\n        //订单服务化接口 miaosha-order\n        ResultGeekQOrder<List<GoodsVoOrder>> resultGoods = goodsServiceRpc.listGoodsVo();\n\n        if (!AbstractResultOrder.isSuccess(resultGoods)) {\n            throw new GlobleException(ResultStatus.SYSTEM_ERROR);\n        }\n        List<GoodsVoOrder> goodsList = resultGoods.getData();\n        model.addAttribute(\"goodsList\", goodsList);\n        return render(request, response, model, \"goods_list\", GoodsKey.getGoodsList, \"\");\n    }\n\n    @RequestMapping(value = \"/to_detail2/{goodsId}\", produces = \"text/html\")\n    @ResponseBody\n    public String detail2(HttpServletRequest request, HttpServletResponse response, Model model, MiaoshaUser user,\n                          @PathVariable(\"goodsId\") long goodsId) {\n        model.addAttribute(\"user\", user);\n\n        //取缓存\n        String html = redisService.get(GoodsKey.getGoodsDetail, \"\" + goodsId, String.class);\n        if (!StringUtils.isEmpty(html)) {\n            return html;\n        }\n        //手动渲染","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/qiurunze123/miaosha/blob/e58017658e549b63fc4db2160d2325ccd7f8435b/miaosha-v2/miaosha-web/src/main/java/com/geekq/miaosha/controller/GoodsController.java#L48-L84","documentation":"Thrown by GoodsController.list() (miaosha-v2) when the RPC call goodsServiceRpc.listGoodsVo() returns a non-success ResultGeekQOrder. Maps to ResultStatus.SYSTEM_ERROR (code 10001, '系统错误'). goodsServiceRpc is a Dubbo-style remote reference to com.geekq.api.service.GoodsService implemented by GoodsServiceImpl in miaosha-order-provider. The provider catches its own DB exceptions and returns ResultStatusOrder.ORDER_GET_FAIL (code 40004), which makes AbstractResultOrder.isSuccess() return false. There is also a GoodsServiceMock that returns an empty list on success but null from getGoodsVoByGoodsId.","triggerScenarios":"GET /goods/to_list when the order-provider's GoodsMapper.listGoodsVo() throws (DB connection failure, SQL error) and the provider returns ORDER_GET_FAIL; or the Dubbo provider is down and the mock fallback is not configured; or the provider returns null (mock's getGoodsVoByGoodsId returns null), causing isSuccess() to return false.","commonSituations":"miaosha-order-provider service is not running or not registered with the Dubbo registry; database behind the provider is unreachable; network partition between web and provider; Dubbo registry (ZooKeeper/Nacos) is down; GoodsServiceMock is activated (mock returns null for getGoodsVoByGoodsId); provider timeout exceeds the consumer's configured timeout.","solutions":["Verify miaosha-order-provider is running and registered in the Dubbo registry (check ZooKeeper/Nacos node list).","Check the provider's application logs for '获取订单数据失败' to identify the underlying DB exception.","Confirm the provider's database connection pool and GoodsMapper.listGoodsVo() SQL are valid.","If using mock mode, ensure GoodsServiceMock.listGoodsVo() returns a non-null success result (it does) but note getGoodsVoByGoodsId returns null — disable mock in production.","Increase the Dubbo consumer timeout if the provider is slow under load."],"exampleFix":"// before\nResultGeekQOrder<List<GoodsVoOrder>> resultGoods = goodsServiceRpc.listGoodsVo();\nif (!AbstractResultOrder.isSuccess(resultGoods)) {\n    throw new GlobleException(ResultStatus.SYSTEM_ERROR);\n}\n\n// after — distinguish RPC failure from timeout and retry/fallback\nResultGeekQOrder<List<GoodsVoOrder>> resultGoods;\ntry {\n    resultGoods = goodsServiceRpc.listGoodsVo();\n} catch (Exception e) {\n    log.error(\"Goods RPC call failed\", e);\n    throw new GlobleException(ResultStatus.SYSTEM_ERROR);\n}\nif (!AbstractResultOrder.isSuccess(resultGoods)) {\n    log.error(\"Goods RPC returned error: {}\", resultGoods.getMessage());\n    throw new GlobleException(ResultStatus.SYSTEM_ERROR);\n}","handlingStrategy":"retry","validationCode":"// Health-check the provider before relying on the RPC result\nResultGeekQOrder<List<GoodsVoOrder>> resultGoods = goodsServiceRpc.listGoodsVo();\nif (!AbstractResultOrder.isSuccess(resultGoods) || resultGoods.getData() == null) {\n    log.error(\"Goods RPC unavailable, falling back to local goodsService\");\n    List<GoodsVo> localGoods = goodsService.listGoodsVo();\n    model.addAttribute(\"goodsList\", localGoods);\n} else {\n    model.addAttribute(\"goodsList\", resultGoods.getData());\n}","typeGuard":"// Check RPC result shape before consuming\nif (resultGoods != null\n    && resultGoods.getStatus() == ResultStatusOrder.SUCCESS\n    && resultGoods.getData() != null) {\n    // safe to consume resultGoods.getData()\n}","tryCatchPattern":"ResultGeekQOrder<List<GoodsVoOrder>> resultGoods;\ntry {\n    resultGoods = goodsServiceRpc.listGoodsVo();\n} catch (Exception rpcEx) {\n    log.error(\"Goods RPC threw exception\", rpcEx);\n    throw new GlobleException(ResultStatus.SYSTEM_ERROR);\n}\nif (!AbstractResultOrder.isSuccess(resultGoods)) {\n    log.error(\"Goods RPC returned error: {}\", resultGoods.getMessage());\n    throw new GlobleException(ResultStatus.SYSTEM_ERROR);\n}","preventionTips":["Monitor miaosha-order-provider health and Dubbo registry registration.","Set appropriate Dubbo consumer timeouts and retries for the goods service.","Disable GoodsServiceMock in production or fix its getGoodsVoByGoodsId to return valid data.","Add circuit-breaker logic (e.g., Hystrix/Resilience4j) around the RPC call.","Log the RPC error message to distinguish provider-side failures from network failures."],"tags":["rpc","dubbo","goods","dependency-unavailable","miaosha-v2","system-error"],"backgroundTag":null,"analyzedSha":"e58017658e549b63fc4db2160d2325ccd7f8435b","analyzedAt":"2026-08-14T05:22:03.691Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}