#30001
https://clickhouse-test-reports.s3.yandex.net/30001/b24b458df7a773925324df83bc646ba83d07be8d/stress_test_(undefined).html#fail1
```
../src/Interpreters/SessionLog.cpp:216:32: runtime error: member call on null pointer of type 'DB::IAccessEntity'
    #0 0x1cdfd359 in DB::SessionLog::addLoginSuccess(StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag> const&, std::__1::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, DB::Context const&) obj-x86_64-linux-gnu/../src/Interpreters/SessionLog.cpp:216:32
    #1 0x1cdf2283 in DB::Session::makeQueryContextImpl(DB::ClientInfo const*, DB::ClientInfo*) const obj-x86_64-linux-gnu/../src/Interpreters/Session.cpp:465:26
    #2 0x1db2245f in DB::HTTPHandler::processQuery(DB::HTTPServerRequest&, DB::HTMLForm&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&, std::__1::optional<DB::CurrentThread::QueryScope>&) obj-x86_64-linux-gnu/../src/Server/HTTPHandler.cpp:517:29
    #3 0x1db29152 in DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&) obj-x86_64-linux-gnu/../src/Server/HTTPHandler.cpp:929:9
    #4 0x1dbb9bf8 in DB::HTTPServerConnection::run() obj-x86_64-linux-gnu/../src/Server/HTTP/HTTPServerConnection.cpp:58:34
    #5 0x1e97f72b in Poco::Net::TCPServerConnection::start() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerConnection.cpp:43:3
    #6 0x1e97fbc4 in Poco::Net::TCPServerDispatcher::run() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20
    #7 0x1ea70146 in Poco::PooledThread::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:199:14
    #8 0x1ea6da0b in Poco::ThreadImpl::runnableEntry(void*) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27
    #9 0x7f67edd2e608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)
    #10 0x7f67edc55292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
```


const ContextPtr & global_context,
        const UUID & user_id,
        const String & session_id,
        std::chrono::steady_clock::duration timeout,
        bool throw_if_not_found)
    {
        std::unique_lock lock(mutex);
        Key key{user_id, session_id};
        auto it = sessions.find(key);
        if (it == sessions.end())
        {
            if (throw_if_not_found)
                throw Exception("Session not found.", ErrorCodes::SESSION_NOT_FOUND);
            
            auto context = Context::createCopy(global_context);
            it = sessions.insert(std::make_pair(key, std::make_shared<NamedSessionData>(key, context, timeout, *this))).first;
            const auto & session = it->second;
            if (!thread.joinable())
                thread = ThreadFromGlobalPool{&NamedSessionsStorage::cleanThread, this};
            return {session, true};
        }
        else
        {
            
            const auto & session = it->second;
            if (!session.unique())