qiurunze123/miaosha · error · GlobleException

10001

10001

Error message

系统错误

What it means

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.

Source

Thrown at miaosha-v2/miaosha-web/src/main/java/com/geekq/miaosha/controller/GoodsController.java:66

    @Autowired
    private com.geekq.api.service.GoodsService goodsServiceRpc;

    /**
     * QPS:1267 load:15 mysql
     * 5000 * 10
     * QPS:2884, load:5
     */
    @RequireLogin(seconds = 5, maxCount = 5, needLogin = true)
    @RequestMapping(value = "/to_list", produces = "text/html")
    @ResponseBody
    public String list(HttpServletRequest request, HttpServletResponse response, Model model, MiaoshaUser user) {
        model.addAttribute("user", user);

        //订单服务化接口 miaosha-order
        ResultGeekQOrder<List<GoodsVoOrder>> resultGoods = goodsServiceRpc.listGoodsVo();

        if (!AbstractResultOrder.isSuccess(resultGoods)) {
            throw new GlobleException(ResultStatus.SYSTEM_ERROR);
        }
        List<GoodsVoOrder> goodsList = resultGoods.getData();
        model.addAttribute("goodsList", goodsList);
        return render(request, response, model, "goods_list", GoodsKey.getGoodsList, "");
    }

    @RequestMapping(value = "/to_detail2/{goodsId}", produces = "text/html")
    @ResponseBody
    public String detail2(HttpServletRequest request, HttpServletResponse response, Model model, MiaoshaUser user,
                          @PathVariable("goodsId") long goodsId) {
        model.addAttribute("user", user);

        //取缓存
        String html = redisService.get(GoodsKey.getGoodsDetail, "" + goodsId, String.class);
        if (!StringUtils.isEmpty(html)) {
            return html;
        }
        //手动渲染

View on GitHub (pinned to e58017658e)

Solutions

  1. Verify miaosha-order-provider is running and registered in the Dubbo registry (check ZooKeeper/Nacos node list).
  2. Check the provider's application logs for '获取订单数据失败' to identify the underlying DB exception.
  3. Confirm the provider's database connection pool and GoodsMapper.listGoodsVo() SQL are valid.
  4. If using mock mode, ensure GoodsServiceMock.listGoodsVo() returns a non-null success result (it does) but note getGoodsVoByGoodsId returns null — disable mock in production.
  5. Increase the Dubbo consumer timeout if the provider is slow under load.

Example fix

// before
ResultGeekQOrder<List<GoodsVoOrder>> resultGoods = goodsServiceRpc.listGoodsVo();
if (!AbstractResultOrder.isSuccess(resultGoods)) {
    throw new GlobleException(ResultStatus.SYSTEM_ERROR);
}

// after — distinguish RPC failure from timeout and retry/fallback
ResultGeekQOrder<List<GoodsVoOrder>> resultGoods;
try {
    resultGoods = goodsServiceRpc.listGoodsVo();
} catch (Exception e) {
    log.error("Goods RPC call failed", e);
    throw new GlobleException(ResultStatus.SYSTEM_ERROR);
}
if (!AbstractResultOrder.isSuccess(resultGoods)) {
    log.error("Goods RPC returned error: {}", resultGoods.getMessage());
    throw new GlobleException(ResultStatus.SYSTEM_ERROR);
}
Defensive patterns

Strategy: retry

Validate before calling

// Health-check the provider before relying on the RPC result
ResultGeekQOrder<List<GoodsVoOrder>> resultGoods = goodsServiceRpc.listGoodsVo();
if (!AbstractResultOrder.isSuccess(resultGoods) || resultGoods.getData() == null) {
    log.error("Goods RPC unavailable, falling back to local goodsService");
    List<GoodsVo> localGoods = goodsService.listGoodsVo();
    model.addAttribute("goodsList", localGoods);
} else {
    model.addAttribute("goodsList", resultGoods.getData());
}

Type guard

// Check RPC result shape before consuming
if (resultGoods != null
    && resultGoods.getStatus() == ResultStatusOrder.SUCCESS
    && resultGoods.getData() != null) {
    // safe to consume resultGoods.getData()
}

Try / catch

ResultGeekQOrder<List<GoodsVoOrder>> resultGoods;
try {
    resultGoods = goodsServiceRpc.listGoodsVo();
} catch (Exception rpcEx) {
    log.error("Goods RPC threw exception", rpcEx);
    throw new GlobleException(ResultStatus.SYSTEM_ERROR);
}
if (!AbstractResultOrder.isSuccess(resultGoods)) {
    log.error("Goods RPC returned error: {}", resultGoods.getMessage());
    throw new GlobleException(ResultStatus.SYSTEM_ERROR);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of qiurunze123/miaosha@e58017658e (2026-08-14). Data as JSON: /api/errors/ab47d3c13596acb6. Report an issue: GitHub.