Skip to content

very very thank your #868

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
cheapWhite opened this issue Mar 19, 2022 · 2 comments
Closed

very very thank your #868

cheapWhite opened this issue Mar 19, 2022 · 2 comments
Assignees

Comments

@cheapWhite
Copy link

Hi, I have the same err with the version v0.4.28 and 0.10.2 for Kafka server version.
The error comes from readFull also.
If I use the Writer, I have the: error unexpected EOF

w := &kafka.Writer{
	Addr:  kafka.TCP("kafka:9093"),
	Topic: "topic",
	Transport: &kafka.Transport{
		SASL: plain.Mechanism{
			Username: "user",
			Password: "XXXXX",
		},
		TLS: &tls.Config{},
	},
}

err = w.WriteMessages(context.Background(),
	kafka.Message{
		Value: []byte("message"),
	},
)
if err != nil {
	log.Fatal("failed to write messages:", err)
}

But if I use Conn, it's work.

partition := 0
dialer := &kafka.Dialer{
	Timeout:   10 * time.Second,
	DualStack: true,
	TLS: &tls.Config{
		InsecureSkipVerify: true,
	},
	SASLMechanism: plain.Mechanism{
		Username: "user",
		Password: "XXXXX",
	},
}

conn, err := dialer.DialLeader(context.Background(), "tcp", "kafka:9093", "topic", partition)
if err != nil {
	log.Fatal("failed to dial leader:", err)
}

conn.SetWriteDeadline(time.Now().Add(10 * time.Second))
_, err = conn.WriteMessages(
	kafka.Message{
		Value: []byte("message"),
	},
)
if err != nil {
	log.Error("failed to write messages : " + err.Error())
}

With version 0.4.0 and the older versions, it works. The error seems to come with this commit: 81bd03c

Originally posted by @Jrmy2402 in #795 (comment)

@rhansen2
Copy link
Collaborator

Hi @cheapWhite,
Thanks for reporting your issue.

Could you try out https://github.com/rhansen2/kafka-go/tree/transport-saslv0 and let me know if it helps?

Thanks!

@rhansen2
Copy link
Collaborator

rhansen2 commented Apr 1, 2022

Fixed via #869

@rhansen2 rhansen2 closed this as completed Apr 1, 2022
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