用一个例子说明 AI 的能力

4 小时 55 分钟前
 jianglibo

我是写 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 确实已经超越机器。

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

现在我只需要拍好商品的六面白底图,其他全部丢给 AI 。包括但不限于效果图、商品标题、商品详情文案等等……
xuanwu
20 分钟前
莫名想起某些算命者的路子。或者说只要信,就会自动从听到的话里找到「说中」的部分而无视其他。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1189121

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX