**How to reproduce**
```
for i in {1..1000}; do echo 'Hello, world!' | clickhouse-local --query "SELECT * FROM table" --structure 's String' | wc -c; done
```

This script hangs.
loadMetadata(*global_context);
        DatabaseCatalog::instance().loadDatabases();
        LOG_DEBUG(log, "Loaded metadata.");
    }
    else if (!config().has("no-system-tables"))
    {
        attachSystemTables(*global_context);
    }
    processQueries();
    global_context->shutdown();
    global_context.reset();
    status.reset();
    cleanup();
    return Application::EXIT_OK;
}
catch (const Exception & e)
{
    try
    {
        cleanup();
    }
    catch (...)
    {
        tryLogCurrentException(__PRETTY_FUNCTION__);
    }
    std::cerr << getCurrentExceptionMessage(config().hasOption("stacktrace")) << '\n';
    
    return e.code() ? e.code() : -1;
}
std::string LocalServer::getInitialCreateTableQuery()