question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot "docker run" using producer

See original GitHub issue

I use this Dockerfile in order to build my NodeJS microservice :

FROM node:7-alpine

COPY package.json /src/package.json
RUN apk update \
    && apk add cyrus-sasl-dev ca-certificates make gcc g++ python bash \
    && cd /src \
    && npm install
COPY . /src
CMD node /src/index.js

But when I docker run my built image, I got an error in my NodeJS process :

{ Error: Local: Erroneous state
    at Function.createLibrdkafkaError [as create] (/src/node_modules/node-rdkafka/lib/error.js:254:10)
    at fail (/src/node_modules/node-rdkafka/lib/client.js:183:44)
    at /src/node_modules/node-rdkafka/lib/client.js:192:7
  message: 'Local: Erroneous state',
  code: -172,
  errno: -172,
  origin: 'kafka' }

To reproduce this issue, just use the code of the simple producer : https://github.com/Blizzard/node-rdkafka/blob/master/examples/producer.md

Can someone help me on this issue ? Thanks !

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
FuzzOli87commented, Apr 26, 2017

@delmotte I was having similar issues. I got the “erroneous state” error off the bat after adding all libraries that I thought I needed(and it built successfully). When I did get the error, I accessed the service and ran a test file that connected to the same kafka instance which produced this error:

compresserror

This happened when running an app INSIDE the service. Running it on my host machine just showed “erroneous state”.

I somehow ended up with this config:

RUN apk add --upgrade --no-cache \
  yarn --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted \
  libc6-compat \
  bash \
  make \
  gcc \
  g++ \
  python \
  cyrus-sasl-dev \
  lz4-dev \
  libc-dev \
  dumb-init --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted 

And got the same error(LZ4F…) to now show up via docker up logs. I wish I could be of more help, I went through dozens of package combinations etc, and somehow this guy at least output the error.

I then stumbled into an comment that stated I can use the native librdkafka package for my distro and I thought that it might do the trick:

FROM node:6.9.2-alpine

RUN apk add --upgrade --no-cache \
  yarn --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted \
  libc6-compat \
  bash \
  make \
  gcc \
  g++ \
  python \
  cyrus-sasl-dev \
  libressl2.5-libcrypto --repository http://dl-3.alpinelinux.org/alpine/edge/main/ --allow-untrusted \
  libressl2.5-libssl --repository http://dl-3.alpinelinux.org/alpine/edge/main/ --allow-untrusted \
  librdkafka-dev --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted \
  dumb-init --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted 

# ENV PATH /root/.yarn/bin:$PATH

RUN mkdir /home/app

WORKDIR /home/app
ENV BUILD_LIBRDKAFKA=0
# rest of stuff

And this worked! I managed to establish connection to my kafka client. Haven’t tried producing/consuming anything so this might be a small wortheless victory but I hope this helps.

0reactions
IdanAdarcommented, Mar 4, 2018

@FuzzOli87, any idea Why it works, though?

Why do you need these? yarn --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted libc6-compat dumb-init --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted

Why do you reference these in this way? (edge, specific packages from libressl) libressl2.5-libcrypto --repository http://dl-3.alpinelinux.org/alpine/edge/main/ --allow-untrusted libressl2.5-libssl --repository http://dl-3.alpinelinux.org/alpine/edge/main/ --allow-untrusted librdkafka-dev --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my producer in docker container not able to connection ...
I'm trying to run my app in dockerfile along with kafka and zookeeper.While it runs in docker container it is giving an error...
Read more >
Why Can't I Connect to Kafka? | Troubleshoot Connectivity
Scenario 2: Kafka and client running in Docker​​ It has what appears to itself as its own hostname, its own network address, its...
Read more >
Overview | Docker Documentation
This page contains information on: How to diagnose and troubleshoot Docker Desktop issues; Check the logs; Find workarounds for common problems ...
Read more >
Using the C++ Producer SDK as a GStreamer Plugin in a ...
For information about using the C++ Producer SDK as a GStreamer plugin in a Docker container, see Run the GStreamer Element in a...
Read more >
Connect to Apache Kafka running in Docker - Baeldung
Also, we will be using the Kafka console producer utility as a sample client to test the connection to the Kafka broker. To...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found