Skip to content

Out of memory when uploading large files exceeding 1GB using --data-binary @ #14521

Description

@timyuer

I did this

When I upload a large file to HDFS, curl reports a memory overflow,This file has a size of 1.1G.
1723519108243

curl -sS -L -w '%{http_code}' -X PUT --data-binary '@/root/hbase.tar.gz' -H 'Content-Type: application/octet-stream' 'http://192.168.8.101:50070/webhdfs/v1/hdp/apps/3.3.2.0-008/hbase/hbase.tar.gz?op=CREATE&user.name=hdfs&overwrite=True&permission=444'

When I modify the following code

#define MAX_FILE2MEMORY (1024*1024*1024) /* big enough ? */

to

#define MAX_FILE2MEMORY (1024*1024*1024*2) /* big enough ? */

Run successfully after recompilation.

I expected the following

I hope to upload files larger than 1GB.

curl/libcurl version

curl-7.79.1,According to my testing, this issue has been present since version 7.73.0

operating system

openEuler-22.03-LTS-SP4

Activity

  1. bagder commented on Aug 13, 2024

    @bagder
    Member

    Or you upload it in a streaming fashion instead of loading the entire thing into memory before sending and then you can upload however large file you want:

    
    curl -sS -L -w '%{http_code}' -T '/root/hbase.tar.gz' -H 'Content-Type: application/octet-stream' 'http://192.168.8.101:50070/webhdfs/v1/hdp/apps/3.3.2.0-008/hbase/hbase.tar.gz?op=CREATE&user.name=hdfs&overwrite=True&permission=444'
    
  2. added a commit that references this issue on Aug 14, 2024
    ad6320b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions