V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
jianglibo
V2EX  ›  程序员

用一个例子说明 AI 的能力

  •  
  •   jianglibo ·
    PRO
    · 3 小时 40 分钟前 · 499 次点击

    我是写 C++的,我的 xxx 的应用服务器是自己写的,当然是基于 boost beast ,但也是从 http 流读取 bytes 这个颗粒度开始。今天发现一个问题,就是几个连续的请求会随机出现一个失败。这种情况比较难以复现,并且从 haproxy->xxx 应用服务器存在各种可能性。因为 boost beast 仅支持 http/1.1 ,我禁用了 haproxy 的 http2.0 ,应该不是 http2.0 的问题。然后叫 AI 登场,当然需要给他足够的信息,从生产环境获取 haproxy 的日志和 xxx 应用的日志,然后结合项目的代码,基本上确定了问题所在。

    Analyzed session errors and request failures Correlated — this log nails the root cause.

    In bbserver_72.log:320-329, the failing /apiv1/users/1/certificates request is preceded by code=5101 what='bad method' and only then you see the downstream {"code":5018,"what":"No Session found"}. So 5018 is a symptom, not the root failure, for this case. It lines up exactly with HAProxy: h.log:110767-110770 shows POST .../issues 200 at 10:48:46.977, then GET /apiv1/users/1/certificates returning 500 at 10:48:47.053, while GET .../acme-accounts is 200 at 10:48:47.054. What this pattern strongly suggests:

    bbserver sometimes receives “garbage” bytes where it expects the next HTTP request line, so Boost.Beast throws "bad method" (5101). The most common real-world reason is: a previous request with a body was responded to without fully draining its body on a keep-alive connection, so the next request starts mid-body and the method parse explodes. Where to fix (likely):

    http_session_monad.hpp:309-333 uses http::async_read_header(...) in parse_header_only() and does not drain any body. If you ever return a response after only parsing headers (auth failure/early exit/etc.) while the client sent a body, you can poison that connection for the next request. If you want, I can implement a robust fix in bbserver (either drain/discard body when header-only is used, or force Connection: close on early-return paths). As a fast mitigation, we can also change HAProxy to close backend connections ( http-reuse never / option http-server-close) to avoid reusing a poisoned keep-alive stream.

    其实我大致也是怀疑这个方向,但是从令人眼花缭乱的日志中,根据各个时间点推理出结论。AI 确实已经超越机器。

    2 条回复    2026-01-28 23:13:11 +08:00
    zooo
        1
    zooo  
       3 小时 17 分钟前
    什么意思,你表达的是 AI 帮你解决掉了复杂的 bug 问题么?
    xpn282
        2
    xpn282  
       46 分钟前
    我说说我自己吧,我是主营国际品牌男装男鞋小商家,通过 AI ,我是用 Nano Banana Pro ,我现在可以拿到比品牌官网更精美的商品效果图、场景图、模特图,真的不只是媲美,很多时候是超越官网效果图。
    我以前只能眼馋官网图(有版权不让用)、大商家(他们有自己的美工团队)。自己以前只能用自己的实拍图,我毫无美工功底。放在以前对于我这种小卖家来说是不敢想象的。

    现在我只需要拍好商品的六面白底图,其他全部丢给 AI 。包括但不限于效果图、商品标题、商品详情文案等等……
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2480 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 16:00 · PVG 00:00 · LAX 08:00 · JFK 11:00
    ♥ Do have faith in what you're doing.