mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-19 17:20:42 +01:00
omkafka/imkafka: Fixed a problem when invalid kafka configuration values are used
omkafka ended up in an endless loop and high cpu. imkafka tried to subscribe to a not connected kafka server. This closes https://github.com/rsyslog/rsyslog/issues/1806
This commit is contained in:
parent
f4c9ee9e50
commit
37500c665b
@ -421,6 +421,9 @@ checkInstance(instanceConf_t *inst)
|
||||
inst->bIsConnected = 1;
|
||||
|
||||
finalize_it:
|
||||
errmsg.LogError(0, RS_RET_KAFKA_NO_VALID_BROKERS,
|
||||
"imkafka: no valid brokers specified: %s\n", inst->brokers);
|
||||
|
||||
RETiRet;
|
||||
}
|
||||
|
||||
@ -671,7 +674,8 @@ CODESTARTrunInput
|
||||
if(glbl.GetGlobalInputTermState() == 1)
|
||||
break; /* terminate input! */
|
||||
|
||||
if(inst->bIsSubscribed == 0 ) {
|
||||
// Try to add consumer only if connected! */
|
||||
if(inst->bIsConnected == 1 && inst->bIsSubscribed == 0 ) {
|
||||
addConsumer(runModConf, inst);
|
||||
}
|
||||
if(inst->bIsSubscribed == 1 ) {
|
||||
|
||||
@ -941,6 +941,14 @@ finalize_it:
|
||||
if (pData->rk != NULL) {
|
||||
closeKafka(pData);
|
||||
}
|
||||
|
||||
/* Parameter Error's cannot be resumed, so we need to disable the action */
|
||||
if (iRet == RS_RET_PARAM_ERROR) {
|
||||
iRet = RS_RET_DISABLE_ACTION;
|
||||
errmsg.LogError(0, iRet,
|
||||
"omkafka: action will be disabled due invalid kafka configuration parameters\n");
|
||||
}
|
||||
|
||||
}
|
||||
pthread_rwlock_unlock(&pData->rkLock);
|
||||
RETiRet;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user