### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code

    def extract_content_from_temp_file(loader_class, temp_file=None, title=None, splitter_configs=dict(), **params):
        """
        Extracts content from a temporary file using a specified loader class.
        Processes tables in the file if the loader class is BSHTMLLoader.

        :param loader_class: The class to be used for loading content from the file.
        :param temp_file: The temporary file object.
        :param splitter_configs: Configuration for the text splitter.
        :param params: Additional parameters for initializing the loader.
        :return: A list of documents extracted from the file., boolean
        """

        rsplitter = RecursiveCharacterTextSplitter(length_function=len, **splitter_configs)
        logger.info(f"the loader use for the file is {loader_class}")
        if loader_class == BSHTMLLoader:
            title_content = process_html_tables_in_file(temp_file.name, title)
            logger.info(f"{title_content}: extracted from the html file")
        loader = loader_class(temp_file.name, **params)
        if loader_class in [UnstructuredPowerPointLoader, UnstructuredWordDocumentLoader, PDFMinerLoader]:
            documents = loader.load()
            gc.collect()
            return documents, True
        else:
            documents = loader.load_and_split(rsplitter)
            gc.collect()
            if loader_class == BSHTMLLoader:
                for doc in documents:
                    doc.page_content = f"Title:{title_content}\n\n{doc.page_content}"
                logger.info(f"{title_content}: added to all the chunk of Html file")
            return documents, False

### Error Message and Stack Trace (if applicable)

the pipeline doesn't move forward

### Description

whenever i try to upload a large file to my fast API APP which converts all kinds of formats into Langchain.Documents and push that to Elastic search, it never comes out of the parsing phase of document loaders

### System Info

langchain==0.1.20
langchain-community==0.0.38
langsmith==0.1.57
langchain-openai==0.1.6

Linux-Ubuntu

python:3.10
document loader not working with large files
This is a GitHub Issue
repo:langchain
owner:hwchase17
Title : document loader not working with large files
Issue date:

--- start body ---
### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code

    def extract_content_from_temp_file(loader_class, temp_file=None, title=None, splitter_configs=dict(), **params):
        """
        Extracts content from a temporary file using a specified loader class.
        Processes tables in the file if the loader class is BSHTMLLoader.

        :param loader_class: The class to be used for loading content from the file.
        :param temp_file: The temporary file object.
        :param splitter_configs: Configuration for the text splitter.
        :param params: Additional parameters for initializing the loader.
        :return: A list of documents extracted from the file., boolean
        """

        rsplitter = RecursiveCharacterTextSplitter(length_function=len, **splitter_configs)
        logger.info(f"the loader use for the file is {loader_class}")
        if loader_class == BSHTMLLoader:
            title_content = process_html_tables_in_file(temp_file.name, title)
            logger.info(f"{title_content}: extracted from the html file")
        loader = loader_class(temp_file.name, **params)
        if loader_class in [UnstructuredPowerPointLoader, UnstructuredWordDocumentLoader, PDFMinerLoader]:
            documents = loader.load()
            gc.collect()
            return documents, True
        else:
            documents = loader.load_and_split(rsplitter)
            gc.collect()
            if loader_class == BSHTMLLoader:
                for doc in documents:
                    doc.page_content = f"Title:{title_content}\n\n{doc.page_content}"
                logger.info(f"{title_content}: added to all the chunk of Html file")
            return documents, False

### Error Message and Stack Trace (if applicable)

the pipeline doesn't move forward

### Description

whenever i try to upload a large file to my fast API APP which converts all kinds of formats into Langchain.Documents and push that to Elastic search, it never comes out of the parsing phase of document loaders

### System Info

langchain==0.1.20
langchain-community==0.0.38
langsmith==0.1.57
langchain-openai==0.1.6

Linux-Ubuntu

python:3.10
--- end body ---

None