Getting CUDA_ERROR_OPERATING_SYSTEM when trying to create a second context on Linux with Titan RTX

My app uses CUDA Driver API. When the app starts, it performs a quick test by calling cuCtxCreate for the GPU it found (Titan RTX in my case) followed by cuMemGetInfo and cuCtxDestroy. After that the application creates another context (again by calling cuCtxCreate) which it uses for submitting kernels and necessary memory operations.

When the application is run as a standalone program, both calls to cuCtxCreate are successful. However, when the same application runs as a plug-in for Flame (as a dynamically loaded library from Flame), the first call to cuCtxCreate succeeds, however, the second calls returns 304 (CUDA_ERROR_OPERATING_SYSTEM).

What can be causing this error in cuCtxCreate on a Linux machine with Titan RTX and what can be done to avoid it?

Any ideas on CUDA_ERROR_OPERATING_SYSTEM on Linux? What may the underlying issue be? Any clues?