sarama icon indicating copy to clipboard operation
sarama copied to clipboard

Producer drop message and sometimes use lots of memory

Open xiaotianlis opened this issue 12 years ago • 7 comments

My program use QueueMessage to send data from logs. When restart then send process, it's always must send the data from last line when process down, so it may has lots of line to send in a monent. Sometimes, the producer process log error like this: [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 278 messages [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 264 messages and can't retry or fix the problem.

Sometimes, there is no ERROR accur, but the producer program use lots of memory, the program use 30MB at the beginning, after some days, Same data and same produce, but only one of five program use 20-50GB memory.

Needs your help, Please.

Thanks.

xiaotianlis avatar May 27 '14 04:05 xiaotianlis

Do you have compression enabled? If so, this is possibly a duplicate of #71

eapache avatar Jun 26 '14 17:06 eapache

Change to the new version and run for a while, then there is some error occur, the message is as follows. Thanks.

2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 98 messages: kafka: Error while decoding packet: CorrelationID didn't match 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 104 messages: kafka: Error while decoding packet: Message too large or too small. Got 1634886504 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 131 messages: kafka: Error while decoding packet: CorrelationID didn't match 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 145 messages: kafka: Error while decoding packet: CorrelationID didn't match 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 109 messages: kafka: Error while decoding packet: CorrelationID didn't match 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 477 messages: kafka: Error while decoding packet: Message too large or too small. Got 1768842591 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 2954 messages: kafka: broker: not connected 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 52 messages: kafka: Error while decoding packet: CorrelationID didn't match 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 153 messages: kafka: Error while decoding packet: Message too large or too small. Got 1768842591 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 3253 messages: kafka: broker: not connected 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 141 messages: kafka: Error while decoding packet: Message too large or too small. Got 1768842591 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 2793 messages: kafka: broker: not connected 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 1964 messages: kafka: Error while decoding packet: Message too large or too small. Got 1768842591 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 1093 messages: kafka: Error while decoding packet: Message too large or too small. Got 1634886504 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 548 messages: kafka: Error while decoding packet: CorrelationID didn't match 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 115 messages: kafka: Error while decoding packet: Message too large or too small. Got 0 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 1269 messages: kafka: broker: not connected 2014/07/11 10:12:58 [ERROR][utils/kafkaUtils] kafkaUtils.go:239: In producer Error() some error comes. kafka: Dropped 137 messages: kafka: Error while decoding packet: Message too large or too small. Got 1634886504

xiaotianlis avatar Jul 11 '14 03:07 xiaotianlis

Which version (which SHA) of sarama are you running precisely? What configuration are you using? What version of kafka is running on your brokers? Are these the very first errors to appear, or are there other ones at the beginning?

The log messages indicate that Sarama is getting out of sync with the broker, but that should only happen in really weird situations. Do you have a proxy in the middle that might be rewriting traffic with bad headers?

Are any of the messages you are producing extremely large (many megabytes)?

Could you use tcpdump or Wireshark to capture the traffic when this occurs and see if there are any errors in the protocol being sent or received? 1.99 pre-release versions of Wireshark (https://www.wireshark.org/download/automated/) can decode Kafka traffic as long as you set the port number of your broker in the preferences.

eapache avatar Jul 11 '14 13:07 eapache

What log messages do you get if you set sarama.Logger to output somewhere?

eapache avatar Jul 11 '14 13:07 eapache

Do you have solved the problem? I find this error too;

ghost avatar Jul 28 '14 14:07 ghost

I do not have enough information to solve this problem: please see my previous two comments and provide some of the requested information.

eapache avatar Jul 28 '14 14:07 eapache

Just merged a new producer design which should fix this issue among many others.

eapache avatar Nov 13 '14 14:11 eapache