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

Enabling a kafka producer seems to result in invincible processes #19

Open
atamon opened this issue Sep 19, 2018 · 4 comments
Open

Enabling a kafka producer seems to result in invincible processes #19

atamon opened this issue Sep 19, 2018 · 4 comments

Comments

@atamon
Copy link
Contributor

atamon commented Sep 19, 2018

At least they won't shutdown by themselves, so someone has to force them.

Minimal repro:

const KakfaCache = require('kafka-cache');

process.on('unhandledRejection', (err, p) => {
  console.error(err);
  console.error(p);
  if (err.message === 'This should shut shit down!') process.exit(0);
  else process.exit(1);
});

async function run() {

  const cache = KakfaCache.create({
    kafkaHost: 'kafka:9092',
    topic: 'foobar',
    readOnly: false
  });

  await cache.onReady();

  throw new Error('This should shut shit down!');
}

run();
@atamon
Copy link
Contributor Author

atamon commented Sep 19, 2018

In a production-stop triggering this behavior we also saw this error:

# Internal application stack trace ...
at KafkaConsumer.kafka.stream.message (/usr/src/app/src/db.js:74:5)
at KafkaConsumer.emit (events.js:182:13)
at readCallback (/usr/local/lib/node_modules/node-rdkafka/lib/kafka-consumer.js:421:12)
/usr/local/lib/node_modules/node-rdkafka/lib/producer.js:241
throw new Error('Producer not connected');
^

Error: Producer not connected
at Producer.flush (/usr/local/lib/node_modules/node-rdkafka/lib/producer.js:241:11)
at Producer.disconnect (/usr/local/lib/node_modules/node-rdkafka/lib/producer.js:284:8)
at process.on (/usr/src/yolean-kafka-cache/lib/kafka.js:62:39)
at process.emit (events.js:187:15)
at process.exit (internal/process.js:160:15)
at db.stream (/usr/src/app/index.js:183:19)
at KafkaConsumer.kafka.stream.message (/usr/src/app/src/db.js:74:5)
at KafkaConsumer.emit (events.js:182:13)
at readCallback (/usr/local/lib/node_modules/node-rdkafka/lib/kafka-consumer.js:421:12)

@solsson
Copy link
Contributor

solsson commented Sep 19, 2018

Invincible or invisible, or maybe inappropriate or inconvenient or indefinite?

@solsson
Copy link
Contributor

solsson commented Sep 19, 2018

Our line in the stacktrace is

process.on('exit', () => producer.disconnect());
. Did you check for processes after running the repro case? What happens, the node process doesn't exit, or it hangs with a CPU spike?

@solsson
Copy link
Contributor

solsson commented Sep 19, 2018

Is #3 possibly related, or maybe the node-rdkafka issue referenced from #3?

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