apache/pulsar · error · RuntimeException
Error starting LogTopic Producer for function %s
Error message
Error starting LogTopic Producer for function %s
What it means
LogAppender.start() creates a Pulsar Producer bound to the function's log topic (batched, LZ4-compressed). If producer creation throws for any reason (broker unreachable, authorization, topic issues, client config), the appender wraps it in a RuntimeException naming the function FQN, preserving the cause.
Source
Thrown at pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/LogAppender.java:123
@Override
public void initialize() {
this.state = State.INITIALIZED;
}
@Override
public void start() {
this.state = State.STARTING;
try {
producer = pulsarClient.newProducer()
.topic(logTopic)
.blockIfQueueFull(false)
.enableBatching(true)
.compressionType(CompressionType.LZ4)
.batchingMaxPublishDelay(100, TimeUnit.MILLISECONDS)
.property("function", fqn)
.create();
} catch (Exception e) {
throw new RuntimeException("Error starting LogTopic Producer for function " + fqn, e);
}
this.state = State.STARTED;
}
@Override
public void stop() {
this.state = State.STOPPING;
if (producer != null) {
producer.closeAsync();
producer = null;
}
this.state = State.STOPPED;
}
@Override
public boolean isStarted() {
return state == State.STARTED;
}View on GitHub (pinned to 820761864e)
Solutions
- Read the wrapped cause (e) in the stack trace — fix the underlying producer error (connectivity, auth, topic)
- Verify the function's logTopic configuration points to a valid topic on the correct cluster/serviceUrl
- Grant the function's role produce permissions on the log topic namespace (grant permissions on the namespace/topic)
- Enable topic auto-creation or create the log topic manually; check broker reachability and TLS/auth settings from the function instance
Example fix
// before (conf/worker or function config) logTopic: persistent://public/default/does-not-exist // after logTopic: persistent://public/default/functions-logs # and grant produce rights: # pulsar-admin namespaces grant-permissions public/default --role functions-role --actions produce
Defensive patterns
Strategy: try-catch
Try / catch
try { logAppender.start(); }
catch (RuntimeException e) {
Throwable cause = e.getCause();
log.error("Log topic producer failed for function: " + e.getMessage(), cause);
// inspect cause: connectivity, authorization, or topic issues
} Prevention
- Pre-create the log topic or enable auto-creation on the namespace
- Grant the function role produce permission on the log topic
- Verify serviceUrl/TLS/auth config from the function instance environment
- Include the cause chain when debugging; it names the real producer failure
- Test log-topic connectivity from a pod/instance before deploying
When it happens
Trigger: Broker unavailable or TLS/auth misconfigured when the function instance starts; the function service account lacks produce permission on the log topic; log topic namespace doesn't exist and auto-creation is disabled; invalid producer config (e.g. bad serviceUrl).
Common situations: Function workers pointed at the wrong cluster; logTopic set to an illegal topic name; token/cert expiry at instance startup; network policy blocking broker port from function pods; Pulsar topic auto-creation disabled.
Related errors
- Unable to initialize crypto config %s
- Error creating client for HealthChecker
- maxMessages must be >= 0
- chunkSize must be > 0 when chunking is enabled
- Component cannot get state store
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/b39165a4f8702a60.
Report an issue: GitHub.