ac4af582301a4e8a29245dbba767eba31334ddf9
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3ed3605ba0 |
netproxy: a global proxy switch drops the idle connections of the sync and the icon fetch (#4824)
ggbdpq's patch (gua2100 on Discord), reviewed and landed with test changes. What changed - netproxy.Watch gives the dispatch's per-request check for a moved global proxy (#4523) to transports magpie keeps for itself. The sync (davsync) uses http.DefaultTransport, so when one of its requests finds the proxy moved, it now drops the idle connections itself. Before this, only a DefaultClient request dropped them, and a backup kept going through the old proxy's HTTP/2 connection. - FetchIcon now closes the pool of the client that only the fetch used. Nothing closed it before. - Review changes: the davsync test restores settings.json afterwards, and the icon test's wait for idle is bounded at 20s, not 2s, to leave room under load. Run at the pushed head (on mote, base |
||
|
|
a73df419d8 |
davsync: a GitHub blob POST on a slow but live line is no longer cut off at 30 s
What changed: the stall watchdog saw a request as one whose body may outlast the whole metadata limit only by method (GET, PUT), and gave every other request a flat 30 s (#657's rule held for WebDAV and S3, whose remaining requests move a few KB at most). GitHub's uploads ride a POST: each blob POST hauls up to 16 MiB of file as about 21 MB of base64, and a flat 30 s needs 550 KB/s to get one part through (#4576: on a slower line the sync failed on the same POST at every attempt, automatic, at start and manual, and never recovered -- the usage day file froze in the morning while the machine kept working). A request hauling a big body (64 KiB or more) now gets the same moving-aware budget as a PUT: the watchdog is put back each time bytes move, and after the body is all handed over the answer gets 60 s on top of as long as the write took. The metadata requests (the GitHub tree, commit and ref POSTs and PATCH, WebDAV PROPFIND/MKCOL/MOVE/DELETE -- kilobytes at most) keep their 30 s in all. Run: TestGitHubSlowBlobUploadIsNotCutShort (a 272 KB base64 body through a line at 320 KB/s, watchdogs shortened to 1 s/300 ms) fails on the old code with "the server didn't answer in 300ms (POST)", the shape of #4576's error, and passes now; TestGitHubSmallPostKeepsTheLimit pins the small POSTs to the old limit either way. go test -tags nogui ./internal/davsync, vet and builds for darwin, GOOS=linux and GOOS=windows pass. Not tried against a real slow line to GitHub. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
d5d72a82af |
imagemcp, davsync: slow-download tests leave room for growing the download's buffer (#3419)
TestFourKImageByURLIsSaved, TestStalledDownloadSaysWhereTheImageIs and
TestSlowTransferIsNotCutShort shorten a download watchdog to 1 s or
300 ms. Each watchdog is put back when bytes come, and the time it
counts includes this process storing them: FetchImage's buf.Write, and
the GET's io.ReadAll, which in Go 1.26 fills fresh chunks half the size
of what has come. At the real 60 s that is nothing. At 1 s and 300 ms
these went red here, beside a full suite on a Linux box, with the line
never stopped:
big_image_test.go:153: after 4.096s: image 1 was drawn but couldn't
be downloaded (nothing came for 1s, after 4.2 MB)
big_image_test.go:207: image 1 ... (nothing came for 300ms, after
8.2 MB), the 4K image that comes in full
big_image_test.go:207: image 1 ... (nothing came for 300ms, after
0.0 MB), the same
stall_test.go:180: slow download: the server sent and took nothing
for 1s (GET): the line or the server stopped (twice)
A probe beside a full suite wrote 256 KB pieces into a bytes.Buffer up
to 10 MB, as FetchImage does. Of 262,440 writes, 20 were held over
300 ms: 19 grew the buffer from 8 to 16 MB (up to 1.3 s), and one was a
fresh buffer's first write (2.7 s). A goroutine sleeping 10 ms beside
them woke at most 57 ms late, so the time went into the memory, not
into waiting to run. A second probe touched fresh memory: 16 MB was
held up to 454 ms, 4 MB up to 278 ms, 1 MB and 256 KB at most 1 ms.
Now:
- TestFourKImageByURLIsSaved: the stall is 5 s (was 1 s), and the 4K
image comes in 256 KB pieces 200 ms apart (was 100 ms), about 8 s,
so the download still outlasts the stall that plays #1576's 2-minute
cap. The check that it was the slow one is now "longer than the
stall" (was 3 s).
- TestStalledDownloadSaysWhereTheImageIs: the stall is 1 s (was
300 ms), the stuck server sends 1 MB before it stops (was 3 MB), and
the image that comes in full is the small png the other tests serve
(was the 9.8 MB 4K one, whose buffer the 8.2 MB red was growing).
- TestSlowTransferIsNotCutShort: the backup is 2 MB at 512 KB/s, 64 KB
every 125 ms (was 24 MB at 6.4 MB/s), still about 4 s each way under
the same 1 s watchdog; the largest fresh chunk the read back fills is
then under 1 MB.
What was run (tree 8e4ecb44, on
|
||
|
|
30a8ce2915 |
davsync tests: TestSlowTransferIsNotCutShort's watchdog is a second, not 300 ms, over ~24 MB each way
A line that never stops is all this test sends, so a 300 ms watchdog only
catches the runner itself pausing: red on macOS in run 37693090857 at
7.99s, near the end of the GET, where a full run takes 7.23s and 8 runs
under 3x CPU oversubscription here all passed. The server's 40 ms gap is
still 25x inside the watchdog, the PUT's tail is still twice it, and with
allSent's extension taken out the test still fails ("took nothing for 1s
(PUT)").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
e22d5eef81 |
davsync tests: the slow transfer's line is narrow both ways, so a download on macOS doesn't burst through the tuned-up buffers past the 300ms watchdog (TestSlowTransferIsNotCutShort red on macos-latest in main's run 37693090857: "took nothing for 300ms (GET)"; b1cba654 narrowed only the upload's way)
|
||
|
|
b1cba65477 |
davsync tests: the slow transfer runs on a line with small buffers, and the PUT's tail is the server's to hold (TestSlowTransferIsNotCutShort red on ubuntu in PR #1030's run 37466034290: "the server sent and took nothing for 300ms (PUT)")
The test scales the watchdog from 60 s down to 300 ms and sends 20 MB at 6.4 MB/s, taking each of magpie's reads of the body as the line moving. On Linux the line's buffers aren't scaled with it: the kernel hands a writer room in bursts, waking it once a third of its send buffer has drained, and it tunes that buffer up to 4 MB (the receiver's window opens in steps the same way). A probe on magpie's body reads in a golang:1.26.3 container showed gaps of 130–290 ms between two of them while the line never stopped, every run; one over 300 ms failed the test. That is the test's ratio, not the watchdog's: at the real 60 s, a burst that long needs a line under ~25 KB/s. Not a race (the same in -race and without).
narrowLine serves the fake WebDAV server and gives the client with both ends' buffers held to 128 KB (SetWriteBuffer on the client's connection, SetReadBuffer on the server's), so a burst is a chunk or two. The MBs that used to sit in the buffers after magpie had handed the body over, which is what allSent's longer wait is for, are now the server's own tail: it answers the PUT twice the watchdog after the body is in. The server also grows its buffer to the body's length up front.
On Linux (golang:1.26.3, 14 CPUs): before, 5 of 30 runs failed (-race -count=10 -cpu 1,2,4); after, 30 of 30 pass, and -race -count=20 -cpu 1,2,8 of TestSlowTransferIsNotCutShort, TestStalledTransferFailsPromptly and TestMetadataRequestHasALimit with four busy loops beside them pass. With allSent changed to put the watchdog back by stallAfter alone, the test fails 3 of 3 ("took nothing for 300ms (PUT)"), so the tail is still tested. go test -race ./internal/davsync (darwin), go vet and gofmt -l pass. No change outside the test.
|
||
|
|
f1224a055e | sync: a backup on a slow line is no longer cut off at 2 minutes; a server that stops moving is (#657, irx999: a 43 MB backup with many skills to a WebDAV server on a 2.4 Mbps VPS, 305 KB/s, needs 2.4 minutes and every sync failed) — a sync had a fixed deadline in all (2 minutes from the gateway's loop and magpie webdav/s3 sync, 90 s from Settings › Sync now), so a large backup on a slow line never got through, however steadily it moved. WebDAV and S3 requests now go through a watchdog instead (stall.go): the backup's GET and PUT fail once nothing has moved either way for 60 s, each byte of the body sent or read putting it back, and after a PUT's body is all handed over the answer gets 60 s on top of as long as the write took (at least 4 minutes), for what still sits in the system's buffers to leave; the other requests (PROPFIND, MKCOL, HEAD, MOVE, DELETE) have 30 s in all. A stall says so ("the server sent and took nothing for 1m0s (PUT)"). Sync now and the CLI have no deadline; the gateway's loop keeps an hour as a backstop; a wait for another magpie's sync stays 30 s. TestSlowTransferIsNotCutShort (20 MB up and down at a steady trickle, over 5 times the watchdog each way), TestStalledTransferFailsPromptly (a server stopping mid-PUT and mid-GET fails within a second) and TestMetadataRequestHasALimit fail on the old code (no watchdog: the stalled ones hang) and pass. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried against a real slow WebDAV server. |