Skip to content

panics in case of issues during vmdk upload #3831

@vdaskalov

Description

@vdaskalov

Describe the bug
This is seen in vlcm service in vCenter during upload of target OVA. While uploading one of the vmdk files in particular.

In govmomi's nfc package we use lease Upload method. However due to slow network or similar issue vCenter (vpxd) starts to return 503. At this point govmomi panics which causes the vlcm service to panic as well.

Here's the exact log from the panic:

panic: send on closed channel

goroutine 859 [running]:
github.com/vmware/govmomi/vim25/progress.(*reader).Read(0xc000436100, {0xc000026000?, 0x55f9e9e9c380?, 0xc0009245a0?})
        external/com_github_vmware_govmomi/vim25/progress/reader.go:119 +0x1a7
io.(*LimitedReader).Read(0xc001096318, {0xc000026000?, 0x8000?, 0x8000?})
        GOROOT/src/io/io.go:479 +0x43
io.copyBuffer({0x7f80901a5ad8, 0xc000924388}, {0x55f9eae8efa0, 0xc001096318}, {0x0, 0x0, 0x0})
        GOROOT/src/io/io.go:429 +0x191
io.Copy(...)
        GOROOT/src/io/io.go:388
net/http.persistConnWriter.ReadFrom({0x55f9eb5e3470?}, {0x55f9eae8efa0?, 0xc001096318?})
        GOROOT/src/net/http/transport.go:1899 +0x5b
bufio.(*Writer).ReadFrom(0xc000b7ac40, {0x55f9eae8efa0, 0xc001096318})
        GOROOT/src/bufio/bufio.go:794 +0x17c
io.copyBuffer({0x55f9eae8f2c0, 0xc000b7ac40}, {0x55f9eae8efa0, 0xc001096318}, {0xc000fd0000, 0x8000, 0x8000})
        GOROOT/src/io/io.go:415 +0x151
io.CopyBuffer({0x55f9eae8f2c0?, 0xc000b7ac40?}, {0x55f9eae8efa0?, 0xc001096318?}, {0xc000fd0000?, 0x55f9ead13ec0?, 0xc000074a08?})
        GOROOT/src/io/io.go:402 +0x36
net/http.(*transferWriter).doBodyCopy(0xc0009da000, {0x55f9eae8f2c0, 0xc000b7ac40}, {0x55f9eae8efa0, 0xc001096318})
        GOROOT/src/net/http/transfer.go:416 +0xe5
net/http.(*transferWriter).writeBody(0xc0009da000, {0x55f9eae8f2c0, 0xc000b7ac40})
        GOROOT/src/net/http/transfer.go:371 +0x366
net/http.(*Request).write(0xc000222280, {0x55f9eae8f2c0, 0xc000b7ac40}, 0x0, 0xc0006cc810, 0x0)
        GOROOT/src/net/http/request.go:771 +0xaed
net/http.(*persistConn).writeLoop(0xc0008eac60)
        GOROOT/src/net/http/transport.go:2522 +0x174
created by net/http.(*Transport).dialConn in goroutine 877
        GOROOT/src/net/http/transport.go:1875 +0x15a5

snippet from vpxd logs:

2025-08-05T16:21:08.037Z info vpxd[20197] [Originator@6876 sub=VAppImport opID=47b3db14-01] Import task progress: 71
...
2025-08-05T16:21:08.233Z error vpxd[20197] [Originator@6876 sub=VAppImport opID=47b3db14-01] Caught exception while importing VM: N5Vmomi5Fault15RequestCanceled9ExceptionE(Fault cause: vmodl.fault.RequestCanceled

To Reproduce
To reproduce this you'd need to somehow mimic 503 behavior during upload.

Expected behavior
Expected error to be returned in this case, not a panic.

Affected version
0.48.1

Screenshots/Debug Output
already added logs snippets

Additional context

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions