Crashing in nvcuvidapi

I am using Windows 10 and RTX6000.
Driver version 528.89.

RTX6000 should have no limitation on encoder counts. But if I create encoders inside a multithreaded framework, NvEnc’s API may crash or stuck. When it stucks, I find from the call stack that the program was stuck inside nvEncInitializeEncoder API. Seems to be an infinite loop inside.

The probability to reproduce this issue is low. I write a program to perform 1000 tests, where each test starts 20 threads, and each thread creates and releases one encoder. The program may reproduce this issue after a few hundred tests.