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

Docker - Producer Messages Never Reach Topic #1007

Closed
CoinCoderBuffalo opened this issue Mar 22, 2023 · 1 comment
Closed

Docker - Producer Messages Never Reach Topic #1007

CoinCoderBuffalo opened this issue Mar 22, 2023 · 1 comment

Comments

@CoinCoderBuffalo
Copy link

CoinCoderBuffalo commented Mar 22, 2023

Error
Works fine locally, but when I run it from Docker I get this error for every message sent to topic

kafka1  | [2023-03-23 03:19:20,470] WARN [SocketServer listenerType=ZK_BROKER, nodeId=1] Unexpected error from /172.18.0.1 (channelId=172.18.0.3:9092-172.18.0.1:48226-100); closing connection (org.apache.kafka.common.network.Selector)
kafka1  | org.apache.kafka.common.network.InvalidReceiveException: Invalid receive (size = 1195725856 larger than 104857600)
kafka1  | 	at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:105)
kafka1  | 	at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:452)
kafka1  | 	at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:402)
kafka1  | 	at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:674)
kafka1  | 	at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:576)
kafka1  | 	at org.apache.kafka.common.network.Selector.poll(Selector.java:481)
kafka1  | 	at kafka.network.Processor.poll(SocketServer.scala:1144)
kafka1  | 	at kafka.network.Processor.run(SocketServer.scala:1047)
kafka1  | 	at java.base/java.lang.Thread.run(Thread.java:829)

Environment Information

  • OS [e.g. Mac, Arch, Windows 10]: MAC
  • Node Version [e.g. 8.2.1]: v19.8.1
  • NPM Version [e.g. 5.4.2]: 9.5.1
  • C++ Toolchain [e.g. Visual Studio, llvm, g++]:
  • node-rdkafka version [e.g. 2.3.3]: 2.15
  • Docker version: 4.17.0 (99724)

Steps to Reproduce

Docker file

FROM node:alpine

RUN apk update
RUN apk --no-cache add \
      bash \
      g++ \
      ca-certificates \
      lz4-dev \
      musl-dev \
      cyrus-sasl-dev \
      openssl-dev \
      make \
      python3

RUN apk add --no-cache --virtual .build-deps gcc zlib-dev libc-dev bsd-compat-headers py-setuptools bash

ENV NODE_ENV development

RUN mkdir -p /usr/local/app

WORKDIR /usr/local/app

COPY package.json .

COPY .yalc/ ./.yalc/
COPY src/ ./src/
COPY test/ ./test/

RUN yarn

CMD ["yarn", "start"]

node-rdkafka Configuration Settings

const producerConfig = {
  debug: 'broker,topic,msg',
  'client.id': CLIENT_ID,
  'metadata.broker.list': config.kafkaBrokers,
  'message.max.bytes': 10000000,
  'compression.codec': 'gzip',
  'retry.backoff.ms': 200,
  'message.send.max.retries': 5,
  'socket.keepalive.enable': true,
  'queue.buffering.max.messages': 100000,
  'queue.buffering.max.ms': 1000,
  'batch.num.messages': 1000000,
  dr_cb: false,
}
const producer = new Kafka.Producer(producerConfig)
producer.setPollInterval(50)

Additional context
I am not using SSL. The messages I'm sending are about 2MB in size, which shouldn't be an issue.

@CoinCoderBuffalo CoinCoderBuffalo changed the title Docker - Producer Messages Never Reach Queue Docker - Producer Messages Never Reach Topic Mar 22, 2023
@CoinCoderBuffalo
Copy link
Author

CoinCoderBuffalo commented Mar 23, 2023

Found the issue. My docker app was pointing to the broker on port 9092 when it should have been pointing to port 29092.

So there was never an issue with this library, it was just an issue with the way I had configured the docker app.

KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://kafka1:9092,DOCKER://host.docker.internal:29092

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

1 participant