### Elasticsearch Version

8.6.0-SNAPSHOT

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

N/A

### Problem Description

We see 8.6.0 master nodes (512MB heap) repeatedly dying with OOME when attempting to do a snapshot with GCS snapshot repository. This is not reproducible with prior versions and we suspect that this is caused by https://github.com/elastic/elasticsearch/pull/90282.

### Steps to Reproduce

1. Start a cluster in a containerized environment; master nodes have 1GB of memory, 512MB of heap
2. Setup a GCS snapshot repository
3. Create a snapshot of the cluster.
4. The master node will OOM with the following message:

```
[5383.050s][warning][gc,alloc] elasticsearch[i6][snapshot][T#26]: Retried waiting for GCLocker too often allocating 256 words
[5383.053s][warning][gc,alloc] elasticsearch[i6][snapshot][T#14]: Retried waiting for GCLocker too often allocating 1029 words
java.lang.OutOfMemoryError: Java heap space
```

### Logs (if relevant)

_No response_
server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
/**
     * Schedules a one-shot command to run after a given delay. The command is run in the context of the calling thread.
     *
     * @param command the command to run
     * @param delay delay before the task executes
     * @param executor the name of the thread pool on which to execute this task. SAME means "execute on the scheduler thread" which changes
     *        the meaning of the ScheduledFuture returned by this method. In that case the ScheduledFuture will complete only when the
     *        command completes.
     * @return a ScheduledFuture who's get will return when the task is has been added to its target thread pool and throw an exception if
     *         the task is canceled before it was added to its target thread pool. Once the task has been added to its target thread pool
     *         the ScheduledFuture will cannot interact with it.
     * @throws org.elasticsearch.common.util.concurrent.EsRejectedExecutionException if the task cannot be scheduled for execution
     */
    @Override
    public ScheduledCancellable schedule(Runnable command, TimeValue delay, String executor) {
        final Runnable contextPreservingRunnable = threadContext.preserveContext(command);
        final Runnable toSchedule;
        if (Names.SAME.equals(executor) == false) {
            toSchedule = new ThreadedRunnable(contextPreservingRunnable, executor(executor));
        } else if (slowSchedulerWarnThresholdNanos > 0) {
            toSchedule = new Runnable() {
                @Override
                public void run() {
                    final long startTime = ThreadPool.this.relativeTimeInNanos();
                    try {
                        contextPreservingRunnable.run();
                    } finally {
                        final long took = ThreadPool.this.relativeTimeInNanos() - startTime;
                        if (took > slowSchedulerWarnThresholdNanos) {
                            logger.warn(