fix(ncm): weapi挂死根因修复 (agent-207, 6缺陷叠加) — ①超时改CLOCK_MONOTONIC(墙钟NTP回拨致poll超长阻塞) ②响应头解析隔行跳行漏Content-Length ③请求头缓冲1KB→8KB ④cookie值截断192B致MUSIC_U不完整被当游客(改ptr+len不截断+按名去重) ⑤split处NUL覆盖body首字节 ⑥Content-Length:0直接DONE; status_check硬上限6s; 803后worker线程取uid/nick落盘(修uid恒空)
ncm→bf6d2a79 已部署; 真机1次验证(风控合规): status_check 721ms rc=0 uid=408996274; user_playlist 2.5s rc=0 count=64
This commit is contained in:
1 parent
4ff8c8baa3
commit
a651df0e9b
19 files changed
+466
-71
No files matched your search
@@ -0,0 +1,38 @@
|
||||
/* monotonic_test.c — 宿主验证 ncm_now_ms(REALTIME) 与 ncm_monotonic_ms(MONOTONIC)。
|
||||
* 演示:用墙钟算 deadline 在「NTP 拨钟回退 Δ」时,(deadline-now) 被放大成巨大 rem;
|
||||
* 用单调钟则不受影响(每次至多等剩余 deadline)。
|
||||
*/
|
||||
#include "ncm.h"
|
||||
#include "ncm_common.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void) {
|
||||
int64_t w0 = ncm_now_ms();
|
||||
int64_t m0 = ncm_monotonic_ms();
|
||||
usleep(50 * 1000);
|
||||
int64_t w1 = ncm_now_ms();
|
||||
int64_t m1 = ncm_monotonic_ms();
|
||||
printf("REALTIME advance: %lld ms\n", (long long)(w1 - w0));
|
||||
printf("MONOTONIC advance: %lld ms\n", (long long)(m1 - m0));
|
||||
if (w1 <= w0 || m1 <= m0) { printf("FAIL: clock not advancing\n"); return 1; }
|
||||
|
||||
/* 模拟 NTP 把墙钟拨回 Δ=6h 后,(deadline-now) 的变化 */
|
||||
int64_t base_w = w0;
|
||||
int64_t base_m = m0;
|
||||
int64_t tmo = 15000;
|
||||
int64_t dline_w = base_w + tmo, dline_m = base_m + tmo;
|
||||
int64_t jump = 6 * 3600 * 1000; /* 拨回 6 小时 */
|
||||
|
||||
/* REALTIME:now 回退 jump → rem 巨大 */
|
||||
int64_t now_w = base_w - jump;
|
||||
uint32_t rem_w = (uint32_t)(dline_w - now_w);
|
||||
/* MONOTONIC:now 不受跳变影响 */
|
||||
int64_t now_m = base_m;
|
||||
uint32_t rem_m = (uint32_t)(dline_m - now_m);
|
||||
printf("REALTIME rem after -6h jump = %u ms (%.1f h)\n", rem_w, rem_w / 3600000.0);
|
||||
printf("MONOTONIC rem after -6h jump = %u ms (%.2f s)\n", rem_m, rem_m / 1000.0);
|
||||
if (rem_w > rem_m) printf("OK: REALTIME overflow confirmed, MONOTONIC unaffected\n");
|
||||
else { printf("FAIL: expected REALTIME rem to blow up\n"); return 1; }
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user