Issue with repeated instance creation in one process

Hi forum,

after upgrading to the 465 series of drivers, we have seen a strange issue on our CI system: After 30 (or 35) renderer tests in the same process, the creation of a new Vulkan instance via vkCreateInstance would fail. I’ve tracked this down to the following minimal example:

#include <vulkan.h>
#include <iostream>

using namespace std;

int main(int argc, char **argv) {

    for(unsigned int i = 0; i <= 100; i++) {
        VkApplicationInfo appInfo{};
        appInfo.pApplicationName = "instanc0r";
        appInfo.applicationVersion = VK_MAKE_VERSION(1, 1, 0);
        appInfo.pEngineName = "NoEngine";
        appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
        appInfo.apiVersion = VK_API_VERSION_1_1;

        VkInstanceCreateInfo createInfo{};
        createInfo.pApplicationInfo = &appInfo;

        VkInstance instance;
        VkResult result = vkCreateInstance(&createInfo, nullptr, &instance);
        cout << i << ": Created instance " << instance << " with return code " << result << endl;

        vkDestroyInstance(instance, nullptr);
        cout << i << ": Created instance " << instance << " with return code " << result << endl;
    return 0;

Which can be compiled via g++ -o vis vis.cxx -lvulkan -I/usr/include/vulkan After around 30 successful instance creations and destructions, vkCreateInstance then starts to return VK_ERROR_INCOMPATIBLE_DRIVER, which seems very fishy.

The same code seems to still work on the 460 and 450 series drivers, and our CI pipeline was also working before for more than a year without issue. I was able to reproduce this on multiple machines running an up-to-date ArchLinux or Ubuntu 18.04. The same code works on Windows on the same machines with no trouble, using driver version 466.11.

Any hints or ideas?