Skip to content
This repository has been archived by the owner on Sep 17, 2022. It is now read-only.

V8 Memory crash #69

Open
possan opened this issue Apr 6, 2022 · 3 comments
Open

V8 Memory crash #69

possan opened this issue Apr 6, 2022 · 3 comments

Comments

@possan
Copy link
Contributor

possan commented Apr 6, 2022

So, i'm trying to build and deploy vitebook to a subfolder on a cdn at every build of a project, but i keep hitting this issue.

I suspect it's a svelte ssr or maybe vite issue that but it's triggered by setting a baseUrl that is a few subdirectories down, but it also seems to be triggered by the filename length or depth of the path, maybe it's caused by the ssr prefetch step ending up in a endless loop recursing through the directories

Config from the svelte sample project with a baseUrl and vite base path added:

import { clientPlugin, defineConfig } from '@vitebook/client/node';
import { defaultThemePlugin } from '@vitebook/theme-default/node';

const BASEURL = '/xxxx/yyyy/zzzz/'

export default defineConfig({
  include: ['src/**/*.story.svelte'],
  plugins: [
    clientPlugin({ appFile: 'App.svelte' }),
    defaultThemePlugin(),
  ],
  vite: {
    base: BASEURL
  },
  site: {
    title: 'Sandbox Svelte4',
    description: '',
    /** @type {(import('@vitebook/theme-default/node').DefaultThemeConfig} */
    theme: {},
    baseUrl: BASEURL,
  },
});

Will crash with a OOM similar to this when i run a npm run vitebook:build:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb09980 node::Abort() [node]
 2: 0xa1c2[35](zzz:9:35) node::FatalError(char const*, char const*) [node]
 3: 0xcf784e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xcf7bc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xeaf465  [node]
 6: 0xeaff46  [node]
 7: 0xebe46e  [node]
 8: 0xebeeb0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
...

But setting a shorter path seems to work fine

const BASEURL = '/x/y/z/'

It also seems to work ok when running npm run vitebook:dev except from a few small ui issues (menu seems to be missing).

@possan
Copy link
Contributor Author

possan commented Apr 6, 2022

This little patch seems to fix the build problems, but it still has some errors like that the index.html file redirecting to / instead of the specified baseUrl

https://github.com/vitebook/vitebook/compare/main...possan:removessrredirect?expand=1

@bztes
Copy link

bztes commented Jul 28, 2022

@possan
Your fix seems to work perfectly. Could you create a PR? Would be amazing to have this issue solved.

@bztes
Copy link

bztes commented Jul 29, 2022

I have created a patch for patch-package. Maybe this is useful for someone.
@vitebook+client+0.100.5.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants