Skip to content

nil pointer dereference in tls check in v0.4.1 #477

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

Closed
dangogh opened this issue Aug 10, 2020 · 6 comments
Closed

nil pointer dereference in tls check in v0.4.1 #477

dangogh opened this issue Aug 10, 2020 · 6 comments
Assignees
Labels

Comments

@dangogh
Copy link

dangogh commented Aug 10, 2020

Describe the bug
Trying to use a minimal tls.Config, I get this crash:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb74d33]

goroutine 38 [running]:
github.com/segmentio/kafka-go.(*connGroup).connect(0xc0001f3480, 0xed4dc0, 0xc000077620, 0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/segmentio/[email protected]/transport.go:1016 +0xc63
github.com/segmentio/kafka-go.(*connGroup).grabConnOrConnect.func1(0xc0001f3480, 0xed4d40, 0xc0001f3400, 0xc000101e00, 0xc000101da0)
	/go/pkg/mod/github.com/segmentio/[email protected]/transport.go:881 +0x6e
created by github.com/segmentio/kafka-go.(*connGroup).grabConnOrConnect
	/go/pkg/mod/github.com/segmentio/[email protected]/transport.go:880 +0x101

Kafka Version
2.2.1 (MSK on AWS)

To Reproduce
I wrote this test to show the crash:

package kafka

import (
	"context"
	"crypto/tls"
	"testing"
)

func TestMakeItCrash(t *testing.T) {
	cg := connGroup{
		pool: &connPool{
			tls: &tls.Config{},
		},
	}

	cg.connect(context.Background())
}

Expected behavior
Successful connection with kafka when a minimal tls.Config is used.

Additional context
It appears the netAddr variable is never being set in this function. It's declared as net.Addr which is an interface, but never set otherwise, so it would be nil.

@dangogh dangogh added the bug label Aug 10, 2020
@achille-roussel
Copy link
Contributor

Thanks for the bug report! I'm looking into this 👍

@achille-roussel
Copy link
Contributor

Note that v0.4.x is not yet officially stable, we're still ironing out the details. If you need a stable version you can pin your dependency at v0.3.7

@dangogh
Copy link
Author

dangogh commented Aug 11, 2020

thanks! I'll lock on v0.3.7 for a while, then..

@achille-roussel
Copy link
Contributor

Hey @dangogh, I'm going to close this issue because we are tracking the bug in #487 as well, and #504 should be merged soon to address the problem.

Thanks again for reporting!

@dangogh
Copy link
Author

dangogh commented Sep 29, 2020 via email

@dangogh
Copy link
Author

dangogh commented Sep 29, 2020

@achille-roussel -- You mentioned 0.4.x is not yet stable. Is there a rough timetable for official release?

dependabot keeps bugging me to upgrade each time there's a new tag and just want to know when to pull the trigger...

thanks!

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

No branches or pull requests

2 participants