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

Panic when calling UploadStreamToBlockBlob with invalid credentials #257

Closed
guy-har opened this issue Feb 17, 2021 · 1 comment
Closed

Comments

@guy-har
Copy link

guy-har commented Feb 17, 2021

Which version of the SDK was used?

0.13.0

Which platform are you using? (ex: Windows, Linux, Debian)

Mac

What problem was encountered?

Calling UploadStreamToBlockBlob with wrong credentials throws panic
The reason for that is that is that copyFromReader returns without waiting for goroutines to end ( In case of error)

How can we reproduce the problem in the simplest way?

I ran into this bug when I Called UploadStreamToBlockBlob with a ~11MB size file with invalid credentials.
However a simple way would be to run this test

func Test_CopyWithErr(t *testing.T) {
	ctx := context.Background()
	p, err := createSrcFile(_1MiB * 12)
	if err != nil {
		panic(err)
	}
	defer os.Remove(p)

	from, err := os.Open(p)
	if err != nil {
		panic(err)
	}

	br := newFakeBlockWriter()
	defer br.cleanup()

	br.errOnBlock = 1
	transferManager, err := NewStaticBuffer(_1MiB, 1)
	if err != nil {
		t.Fatal(err)
	}
	defer transferManager.Close()
	_, err = copyFromReader(ctx, from, br, UploadStreamToBlockBlobOptions{TransferManager: transferManager})
	
}

Have you found a mitigation/solution?

yes, calling wait() before returning the error

@siminsavani-msft
Copy link
Contributor

@guy-har Hi! This issue should be resolved with the new version!

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

No branches or pull requests

2 participants