Skip to content

std::bad_alloc - rework file storage from internal buffer to stream #357

@ilg-ul

Description

@ilg-ul

Describe the bug

The GitHub Actions runner failed with std::bad_alloc when trying to publish a large archive file.

To Reproduce

Steps to reproduce the behavior:

  • I don't know if this is useful, but try to publish a large (506MB) archive from a machine with 4 GB of RAM

Expected behavior

I successfully used the ncipollo/release-action@v1 action to publish many releases, without any problems, and I expected to run properly for large archives too.

Desktop (please complete the following information):

  • OS: Ubuntu 18 under Docker, on a Raspberry Pi OS 32-bit

Additional context

From the downloaded log:

2023-08-24T07:21:21.6209697Z ##[group]Run ncipollo/release-action@v1
2023-08-24T07:21:21.6212311Z with:
2023-08-24T07:21:21.6214242Z   allowUpdates: true
2023-08-24T07:21:21.6216227Z   artifacts: build/linux-arm/deploy/*
2023-08-24T07:21:21.6219179Z   bodyFile: .github/workflows/body-github-pre-releases-test.md
2023-08-24T07:21:21.6221631Z   commit: master
2023-08-24T07:21:21.6223424Z   draft: false
2023-08-24T07:21:21.6225352Z   name: Test binaries
2023-08-24T07:21:21.6227421Z   omitBodyDuringUpdate: true
2023-08-24T07:21:21.6229772Z   omitDraftDuringUpdate: true
2023-08-24T07:21:21.6231950Z   omitNameDuringUpdate: true
2023-08-24T07:21:21.6234193Z   owner: xpack-dev-tools
2023-08-24T07:21:21.6236072Z   prerelease: true
2023-08-24T07:21:21.6237887Z   replacesArtifacts: true
2023-08-24T07:21:21.6239596Z   repo: pre-releases
2023-08-24T07:21:21.6241267Z   tag: test
2023-08-24T07:21:21.6243990Z   token: ***
2023-08-24T07:21:21.6279488Z   generateReleaseNotes: false
2023-08-24T07:21:21.6281594Z   makeLatest: legacy
2023-08-24T07:21:21.6283495Z   omitBody: false
2023-08-24T07:21:21.6285071Z   omitName: false
2023-08-24T07:21:21.6286917Z   omitPrereleaseDuringUpdate: false
2023-08-24T07:21:21.6288837Z   removeArtifacts: false
2023-08-24T07:21:21.6290625Z   skipIfReleaseExists: false
2023-08-24T07:21:21.6292522Z   updateOnlyUnreleased: false
2023-08-24T07:21:21.6294163Z ##[endgroup]
2023-08-24T07:21:21.7169857Z ##[command]/usr/bin/docker exec  05bf2dba69b738d2cc16bd0b648643d0552e695ec56bf215e681aea05f4b1fde sh -c "cat /etc/*release | grep ^ID"
2023-08-24T07:21:29.2705233Z terminate called after throwing an instance of 'std::bad_alloc'
2023-08-24T07:21:29.2706614Z   what():  std::bad_alloc

The workflow file is:

The run is:

I don't know which process threw this exception, if it is related to this GitHub Action or not, but it looks like a C++ out of memory condition.

Does this Action try to move the file by copying it into memory? Since the machine I'm running this is a small Raspberry Pi, with only 4 GB of memory.

If this is true, probably the code should be reworked to use a stream, which uses less memory.

To be noted that I successfully published even larger files (549 MB), but on machines with more memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions