ThreadPoolexecutor doesnt release memory · Issue #131448 · python/cpython · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

ThreadPoolexecutor doesnt release memory #131448

Closed as not planned
Closed as not planned
@ansultan1

Description

@ansultan1

Bug report

Bug description:

# Add a code block here, if required
    with ThreadPoolExecutor(max_workers=2) as thread_executor:
        pending_thread_tasks.add(
            thread_executor.submit(
                get_bucket_objects, source_bucket_name, "source", source_api_key,
                source_ibm_service_instance_id, source_location_constraint, source_cos_credentials
            )
        )
        pending_thread_tasks.add(
            thread_executor.submit(
                get_bucket_objects, target_bucket_name, "target", target_api_key,
                target_ibm_service_instance_id, target_location_constraint, target_cos_credentials
            )
        )

        completed_process_tasks, _ = wait(pending_thread_tasks, return_when=ALL_COMPLETED)
        for completed_process_task in completed_process_tasks:
            bucket_type, objects = completed_process_task.result()
            if bucket_type == "source":
                LOGGER.info(f"Successfully fetched objects from source bucket '{source_bucket_name}' having "
                            f"id {source_bucket_id}")
                source_objects = objects
            else:
                LOGGER.info(f"Successfully fetched objects from target bucket '{target_bucket_name}' having "
                            f"id {target_bucket_id}")
                target_objects = objects

when celery task completes the woker should release memory. it dosnt release Full memory and the container contains 1 gb of memory when task completes because of using this threadpoolexecutor. when using processpool executor this issue doesnt come but as objects is a large list so when using multiprocessing the copy and pickling give memory spike thats why used multithreading. how to avoid the memory leak in this multithreading

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.