brave-intl / challenge-bypass-server

https://privacypass.github.io
BSD 3-Clause "New" or "Revised" License
5 stars 6 forks source link

asynchronous close(batchPipeline) in kafka/main.go can lead to panic #706

Open ibukanov opened 1 month ago

ibukanov commented 1 month ago

StartConsumers() from kafka/main.go calls panic(batchPipeline) when readAndCommitBatchPipelineResults() returns an error. But this will trigger panic and terminate the process if processMessagesIntoBatchPipeline() posts a new message to batchPipeline channel.

In general the logic of handling transient errors is broken. processMessagesIntoBatchPipeline() can only terminate by panic and that kills the process. If this is intended bbehavior, then the code to call StartConsumers() as a recovery should be removed.