Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(artifacts): correctly handle artifacts with 0-byte files with wandb-core #7321

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

moredatarequired
Copy link
Contributor

@moredatarequired moredatarequired commented Apr 5, 2024

Description

  • I updated CHANGELOG.md, or it's not applicable

Testing

How was this PR tested?

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.26%. Comparing base (1dc2c8c) to head (bf7e284).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7321      +/-   ##
==========================================
+ Coverage   76.23%   76.26%   +0.03%     
==========================================
  Files         512      512              
  Lines       54338    54341       +3     
==========================================
+ Hits        41422    41441      +19     
+ Misses      12555    12535      -20     
- Partials      361      365       +4     
Flag Coverage Δ
func 43.76% <0.00%> (+0.02%) ⬆️
system 64.48% <0.00%> (-0.05%) ⬇️
unit 57.94% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ore/internal/filetransfer/file_transfer_default.go 65.04% <100.00%> (+1.04%) ⬆️

... and 14 files with indirect coverage changes

Comment on lines +98 to +105
if task.Size == 0 {
// *Sometimes* on *some* platforms, req.Body is set to a non-nil io.Reader that
// would return 0 bytes if read, but net/http/Request.outgoingLength takes the
// presence of a body to indicate that length > 0 and "corrects" it to -1 to
// indicate unknown. If we don't fix it here we get 411 Length Required errors.
req.Body = io.NopCloser(bytes.NewReader([]byte{}))
task.Headers = append(task.Headers, "Content-Length:0")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think you need to do it here, we are uploading empty files regularly when we use wandb.save pretty sure it is something artifact specific

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can repro outside wandb just using the net/http library... How do you do it in wandb.save()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the above fix doesn't even work. It sometimes does which is even weirder, but the net/http library is where the content-length gets rewritten and I haven't figured out how to force it to send a correct content length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants