Thanks for updating the thread with the resolution. It is appreciated.
It's great you fixed the broken code . I don't think we could know specifically what you were using - "it's our tool which takes records from Kafka and fills bulks, of course, it's multithreaded" was the only clue. If the moral of the story is
then we all learned something which can help someone else in the future.
well, not sure who else you expected to write it
You can close this thread by accepting one of the answers, in this case your own is probably most appropriate, and I wish you success with your project.