w9jds / firebase-action

GitHub Action for interacting with Firebase
MIT License
927 stars 200 forks source link

FATAL ERROR: Allocation failed #122

Open aduyng opened 2 years ago

aduyng commented 2 years ago

I used this action to copy the realtime database from production to my automation environment. The size of the database is around 40MB.

I encountered FATAL_ERROR: Allocation failed while executing with the following yaml:

Run w9jds/firebase-action@master
/usr/bin/docker run --name w9jdsfirebaseactionlatest_fbd363 --label 6a6825 --workdir /github/workspace --rm -e FIREBASE_TOKEN -e NODE_OPTIONS -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/my-project/my-project":"/github/workspace" w9jds/firebase-action:latest database:set --confirm --project my-project / source.json

<--- Last few GCs --->

[9:0x5415880]    49500 ms: Scavenge 1033.8 (1076.9) -> 1033.6 (1080.6) MB, 21.4 / 0.0 ms  (average mu = 0.906, current mu = 0.908) allocation failure 
[9:0x5415880]    49713 ms: Scavenge 1161.6 (1208.6) -> 1161.6 (1208.6) MB, 23.5 / 0.0 ms  (average mu = 0.906, current mu = 0.908) allocation failure 
[9:0x5415880]    50157 ms: Scavenge 1417.6 (1464.6) -> 1417.6 (1464.6) MB, 46.1 / 0.0 ms  (average mu = 0.906, current mu = 0.908) allocation failure 

<--- JS stacktrace --->

FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
 1: 0xa389b0 node::Abort() [node]
 2: 0x96e0af node::FatalError(char const*, char const*) [node]
 3: 0xbb7a4e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xbb7dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xd73fd5  [node]
 6: 0xd48019  [node]
 7: 0xd48044 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
 8: 0x1133bc8 v8::internal::FixedArrayBuilder::EnsureCapacity(v8::internal::Isolate*, int) [node]
 9: 0x10c0bed  [node]
10: 0x10c3866 v8::internal::Runtime_RegExpExecMultiple(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x1446379  [node]
Aborted (core dumped)

Following is the YAML (with NODE_OPTIONS to set the node environment variables):

      - name: Upload JSON to DB
        uses: w9jds/firebase-action@master
        with:
          args: database:set --confirm --project my-project / source.json
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          NODE_OPTIONS: --max-old-space-size=32768

Any idea how I can fix this issue?