deep-foundation / deeplinks

https://discord.gg/deep-foundation
The Unlicense
14 stars 9 forks source link

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory #326

Open FreePhoenix888 opened 4 months ago

FreePhoenix888 commented 4 months ago

Error

[1] 
[1] <--- Last few GCs --->
[1] 
[1] [9178:0x7394fe0] 18891558 ms: Mark-sweep 3470.1 (4143.7) -> 3461.9 (4133.4) MB, 4143.7 / 0.0 ms  (average mu = 0.143, current mu = 0.026) allocation failure; GC in old space requested
[1] [9178:0x7394fe0] 18895009 ms: Mark-sweep 3461.9 (4133.4) -> 3461.9 (4131.2) MB, 3450.6 / 0.0 ms  (average mu = 0.080, current mu = 0.000) allocation failure; GC in old space requested
[1] 
[1] 
[1] <--- JS stacktrace --->
[1] 
[1] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
[1]  1: 0xb83f50 node::Abort() [node]
[1]  2: 0xa94834  [node]
[1]  3: 0xd647c0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
[1]  4: 0xd64b67 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
[1]  5: 0xf42265  [node]
[1]  6: 0xf43168 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
[1]  7: 0xf53673  [node]
[1]  8: 0xf544e8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
[1]  9: 0xf56ad4 v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [node]
[1] 10: 0xf3026d v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
[1] 11: 0xf10760 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
[1] 12: 0xf07d2c v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
[1] 13: 0xf07ea5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
[1] 14: 0x11afb9d v8::internal::Handle<v8::internal::EphemeronHashTable> v8::internal::HashTable<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::New<v8::internal::Isolate>(v8::internal::Isolate*, int, v8::internal::AllocationType, v8::internal::MinimumCapacity) [node]
[1] 15: 0x11afe43 v8::internal::Handle<v8::internal::EphemeronHashTable> v8::internal::HashTable<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::EnsureCapacity<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::EphemeronHashTable>, int, v8::internal::AllocationType) [node]
[1] 16: 0x11b05f5 v8::internal::ObjectHashTableBase<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::Put(v8::internal::Isolate*, v8::internal::Handle<v8::internal::EphemeronHashTable>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int) [node]
[1] 17: 0x11b07eb v8::internal::JSWeakCollection::Set(v8::internal::Handle<v8::internal::JSWeakCollection>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int) [node]
[1] 18: 0x12cd490 v8::internal::Runtime_WeakCollectionSet(int, unsigned long*, v8::internal::Isolate*) [node]
[1] 19: 0x17035b9  [node]
[1] Aborted
[1] npm run deeplinks exited with code 134

Description

3006 port is down now I have not seen this error before, but see now, when testing russian-laws and therefore creating a lot of links. Maybe gitpod disk is out of memory? If yes it is one more reason to integrate linksplatform with deep as fast as we can because those htmls are not too big (a few megabyes) and I have run test approximately 5-20 times

No, disk memory is not the reason, deep takes 10gb:

gitpod /workspace/dev (main) $ du -sh
9.4G    .

If I restart deep 3006 port will open:

5:31:14 PM - Starting compilation in watch mode...
[6] 
[0] 
[0] > @deep-foundation/deepcase-app@0.1.0-beta.14 dev
[0] > next dev "-p" "3007"
[0] 
[1] 
[1] > @deep-foundation/deeplinks@0.0.334 dev
[1] > (cd local && docker-compose down || true) && cross-env PORT=3006 npm run launch
[1] 
[3] 
[3] > @deep-foundation/sdk@0.0.0-dev.1 dev
[3] > next dev
[3] 
[2] 
[2] > @deep-foundation/deeplinks@0.0.334 start-engine-docker
[2] > npm run start-engine-docker-core
[2] 
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"MIGRATIONS_DATE_TYPE_SQL\" variable is not set. Defaulting to a blank string."
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"DEFAULT_RL_CRON_SCHEDULE\" variable is not set. Defaulting to a blank string."
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"MOESIF_TOKEN\" variable is not set. Defaulting to a blank string."
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"RESERVED_LIFETIME_MS\" variable is not set. Defaulting to a blank string."
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"MIGRATIONS_RL_TABLE\" variable is not set. Defaulting to a blank string."
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"DEEPLINKS_HASURA_STORAGE_URL\" variable is not set. Defaulting to a blank string."
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"MIGRATIONS_SCHEMA\" variable is not set. Defaulting to a blank string."
[1] time="2024-03-11T17:31:15Z" level=warning msg="The \"DEEPLINKS_PORT\" variable is not set. Defaulting to a blank string."
[2] 
[2] > @deep-foundation/deeplinks@0.0.334 start-engine-docker-core
[2] > cd ./../../node_modules/@deep-foundation/hasura && npm run docker
[2] 
[3] - ready started server on 0.0.0.0:4000, url: http://localhost:4000
[1] 
[1] > @deep-foundation/deeplinks@0.0.334 launch
[1] > npm run package:build && node ./index.js;
[1] 
[3] - info Loaded env from /workspace/dev/packages/sdk/.env.development
[2] 
[2] > @deep-foundation/hasura@0.0.61 docker
[2] > cross-env JWT_SECRET="{\"type\":\"HS256\",\"key\":\"3EK6FD+o0+c7tzBNVfjpMkNDi2yARAAKzQlk8O2IKoxQu4nF7EdAh8s3TwpHwrdWT6R\"}" HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:postgrespassword@postgres:5432/postgres HASURA_GRAPHQL_ENABLE_CONSOLE=true HASURA_GRAPHQL_DEV_MODE=true HASURA_GRAPHQL_LOG_LEVEL=debug HASURA_GRAPHQL_ENABLED_LOG_TYPES="startup, http-log, webhook-log, websocket-log, query-log" HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey HASURA_GRAPHQL_ENABLE_REMOTE_SCHEMA_PERMISSIONS=true HASURA_GRAPHQL_UNAUTHORIZED_ROLE=undefined POSTGRES_USER=postgres POSTGRES_PASSWORD=postgrespassword PGGSSENCMODE=disable PGSSLMODE=disable PGREQUIRESSL=0 MINIO_ROOT_USER=minioaccesskey MINIO_ROOT_PASSWORD=miniosecretkey HASURA_STORAGE_DEBUG=true HASURA_METADATA=1 HASURA_ENDPOINT=http://host.docker.internal:8080/v1 S3_ENDPOINT=http://host.docker.internal:9000 S3_ACCESS_KEY=minioaccesskey S3_SECRET_KEY=miniosecretkey S3_BUCKET=default S3_ROOT_FOLDER=default POSTGRES_MIGRATIONS=0 POSTGRES_MIGRATIONS_SOURCE=postgres://postgres:postgrespassword@host.docker.internal:5432/postgres?sslmode=disable npm run docker-local
[2] 
[1] 
[1] > @deep-foundation/deeplinks@0.0.334 package:build
[1] > tsc --project tsconfig.json
[1] 
[3] - warn Invalid next.config.js options detected: 
[3] - warn     The root value has an unexpected property, strictMode, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, configOrigin, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, target, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
[3] - warn See more info here: https://nextjs.org/docs/messages/invalid-next-config
[0]    ▲ Next.js 14.1.0
[0]    - Local:        http://localhost:3007
[0] 
[0]  ⚠ Invalid next.config.js options detected: 
[0]  ⚠     Unrecognized key(s) in object: 'webpack5', 'future', 'strictMode'
[0]  ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
[2] 
[2] > @deep-foundation/hasura@0.0.61 docker-local
[2] > cd ./local && docker-compose -p deep up -d && cd ../
[2] 
[2] time="2024-03-11T17:31:18Z" level=warning msg="volume \"deep-db-data\" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume"
[2]  Container deep-minio  Running
[2]  Container deep-postgres  Running
[2]  Container deep-hasura  Running
[2]  Container deep-hasura-storage  Running
[2] npm run gitpod-engine exited with code 0
[0] 
[0]    We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false by default.
[0]    The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:
[0] 
[0]     - strictNullChecks was set to true
[0] 
[3] - event compiled client and server successfully in 2.2s (20 modules)
[3] - wait compiling...
[3] - event compiled client and server successfully in 817 ms (20 modules)
[0]  ✓ Ready in 12.2s
[6] 
[6] 5:31:39 PM - Found 0 errors. Watching for file changes.
[1] [HPM] Proxy created: /  -> http://localhost:8080
[1] [HPM] Proxy rewrite rule created: "/gql" ~> "/v1/graphql"
[1] [HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
[1] [HPM] Proxy created: /  -> http://localhost:8000
[1] [HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
[1] [HPM] Proxy created: /  -> http://localhost:8080
[1] [HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
[1] [HPM] Rewriting path from "/gql" to "/v1/graphql"
[1] [HPM] POST /gql ~> http://localhost:8080
[5] JavaScript Docker Isolation Provider startup triggered.
[5] (cd packages/deeplinks && until [ -f ./warmup.js ]; do sleep 1; done && npm run warmup) exited with code 0
[7] 
[7] 5:31:48 PM - Found 0 errors. Watching for file changes.
[1] [HPM] Rewriting path from "/gql" to "/v1/graphql"
[1] [HPM] POST /gql ~> http://localhost:8080
[1] [HPM] Rewriting path from "/gql" to "/v1/graphql"
[1] [HPM] POST /gql ~> http://localhost:8080
Konard commented 4 months ago

This is related to RAM, not disk.

FreePhoenix888 commented 4 months ago

I met this again when testing russian-laws

[1] <--- Last few GCs --->
[1] 
[1] [4350:0x6ba5fe0] 15777233 ms: Mark-sweep 3481.2 (4143.9) -> 3473.0 (4133.4) MB, 3738.1 / 0.0 ms  (average mu = 0.150, current mu = 0.040) allocation failure; GC in old space requested
[1] [4350:0x6ba5fe0] 15779337 ms: Mark-sweep 3473.0 (4133.4) -> 3473.0 (4131.4) MB, 2103.6 / 0.0 ms  (average mu = 0.103, current mu = 0.000) allocation failure; GC in old space requested
[1] 
[1] 
[1] <--- JS stacktrace --->
[1] 
[1] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
[1]  1: 0xb83f50 node::Abort() [node]
[1]  2: 0xa94834  [node]
[1]  3: 0xd647c0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
[1]  4: 0xd64b67 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
[1]  5: 0xf42265  [node]
[1]  6: 0xf43168 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
[1]  7: 0xf53673  [node]
[1]  8: 0xf544e8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
[1]  9: 0xf56ad4 v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [node]
[1] 10: 0xf3026d v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
[1] 11: 0xf10760 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
[1] 12: 0xf07d2c v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
[1] 13: 0xf07ea5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
[1] 14: 0x11afb9d v8::internal::Handle<v8::internal::EphemeronHashTable> v8::internal::HashTable<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::New<v8::internal::Isolate>(v8::internal::Isolate*, int, v8::internal::AllocationType, v8::internal::MinimumCapacity) [node]
[1] 15: 0x11afe43 v8::internal::Handle<v8::internal::EphemeronHashTable> v8::internal::HashTable<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::EnsureCapacity<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::EphemeronHashTable>, int, v8::internal::AllocationType) [node]
[1] 16: 0x11b05f5 v8::internal::ObjectHashTableBase<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::Put(v8::internal::Isolate*, v8::internal::Handle<v8::internal::EphemeronHashTable>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int) [node]
[1] 17: 0x11b07eb v8::internal::JSWeakCollection::Set(v8::internal::Handle<v8::internal::JSWeakCollection>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int) [node]
[1] 18: 0x12cd490 v8::internal::Runtime_WeakCollectionSet(int, unsigned long*, v8::internal::Isolate*) [node]
[1] 19: 0x17035b9  [node]
[1] Aborted
[1] npm run deeplinks exited with code 134