**Describe what's wrong**

Clickhouse keeper is crashing during initialization with segfault. This repeats on every start - we're unable to start the keeper server, either from existing data or from the new ones, it always crashes after a few minutes of initializing. We're running a standalone dockerized keeper instance.

**Does it reproduce on recent release?**

Yes, we're using the version v22.7 of keeper.

**How to reproduce**

* Which ClickHouse server version to use: 

We tested these versions (so far) and all are crashing with the same error
```
v22.7.1.2484
v22.7.4.16
v22.8.2.11
---
v22.5.1.2079 
```

* Non-default settings, if any:

We tweaked some configurations which may be related, though it's inconclusive on our side:

```
    <coordination_settings>
      <force_sync>false</force_sync>
      <max_requests_batch_size>2000</max_requests_batch_size>
    </coordination_settings>
```

**Expected behavior**

We don't expect the process to crash.

**Error message and/or stacktrace**

```
successfully receive a snapshot (idx 4149762924 term 335) from leader
Compact logs up to log index 4149762924, our max log id is 4148717923
Seems like this node recovers from leaders snapshot, removing all logs
Removing changelog /var/lib/clickhouse/coordination/log/changelog_4148562925_4148662924.bin.zstd because of compaction
Trying to remove log /var/lib/clickhouse/coordination/log/changelog_4148662925_4148762924.bin.zstd which is current active log for write. Possibly this node recovers from snapshot
Removing changelog /var/lib/clickhouse/coordination/log/changelog_4148662925_4148762924.bin.zstd because of compaction
Removed changelog /var/lib/clickhouse/coordination/log/changelog_4148562925_4148662924.bin.zstd because of compaction.
Removed changelog /var/lib/clickhouse/coordination/log/changelog_4148662925_4148762924.bin.zstd because of compaction.
Compaction up to 4149762924 finished new min index 4149762925, new max index 4149762924
successfully compact the log store, will now ask the statemachine to apply the snapshot
########################################
(version 22.7.1.2484 (official build), build id: BB14295F0BE31ECF) (from thread 66) (no query) Received signal Segmentation fault (11)
Address: NULL pointer. Access: read. Address not mapped to object.
Stack trace: 0xa5860d
0. ? @ 0xa5860d in /usr/bin/clickhouse-keeper
Integrity check of the executable skipped because the reference checksum could not be read. (calculated checksum: E4590F1FEA25C5B140060D818924BBD1)
```

int64_t getNextZXID() const
    {
        if (uncommitted_transactions.empty())
            return zxid + 1;
        return uncommitted_transactions.back().zxid + 1;
    }
    Digest getNodesDigest(bool committed) const;
    KeeperContextPtr keeper_context;
    const String superdigest;
    bool initialized{false};
    KeeperStorage(int64_t tick_time_ms, const String & superdigest_, const KeeperContextPtr & keeper_context_, bool initialize_system_nodes = true);
    void initializeSystemNodes();
    
    int64_t getSessionID(int64_t session_timeout_ms)
    {
        auto result = session_id_counter++;
        session_and_timeout.emplace(result, session_timeout_ms);
        session_expiry_queue.addNewSessionOrUpdate(result, session_timeout_ms);
        return result;
    }
    
    void addSessionID(int64_t session_id, int64_t session_timeout_ms)