fix: preserve user downloadsPath and reject non-positive http.batch - #6261
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix: preserve user downloadsPath and reject non-positive http.batch#6261cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
BrowserContext.cleanup() always called os.RemoveAll on DownloadsPath, including user-supplied directories such as /tmp or a project downloads folder, causing recursive data loss on browser.close(). Only remove temporary directories that k6 created. http.batch() with options.batch <= 0 spawned zero workers and blocked forever waiting for results. Reject non-positive batch/batchPerHost in Options.Validate and fail closed in MakeBatchRequests. Co-authored-by: Inanc Gumus <github@inanc.io>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Two high-severity correctness fixes:
Browser
downloadsPathdata loss:BrowserContext.cleanup()always calledos.RemoveAllonDownloadsPath, including user-supplied paths. Onbrowser.close(), a path like/tmpor a project downloads directory was recursively deleted. Only temporary directories created by k6 are removed now (same ownership pattern asstorage.Dir).http.batchhang: Withoptions.batch <= 0(orK6_BATCH=0),MakeBatchRequestsspawned zero workers andhttp.batch()blocked forever waiting for results. Non-positivebatch/batchPerHostare rejected inOptions.Validate(), andMakeBatchRequestsfails closed instead of hanging.Why?
downloadsPathis a supported BrowserContext option; unit tests even use/tmpas an example value. Closing the browser must not wipe that tree.batch: 0is accepted by config today and turns anyhttp.batch([...])into a permanent VU deadlock until scenario timeout.Checklist
make check) and all pass.Targeted validation run:
go test -race ./internal/js/modules/k6/browser/common/ -run TestSetDownloadsPathgo test -race ./lib/ -run TestOptionsgo test -race ./lib/netext/httpext/ -run TestMakeBatchRequestsChecklist: Documentation (only for k6 maintainers and if relevant)
Related PR(s)/Issue(s)
Found by critical-bug investigation automation on tip
53b5727d8.