Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error when exporting data on Electron #1238

Closed
1 task done
Shazib opened this issue Jun 30, 2023 · 1 comment
Closed
1 task done

[Bug]: Error when exporting data on Electron #1238

Shazib opened this issue Jun 30, 2023 · 1 comment
Labels
bug Something isn't working electron Issues related to the desktop app (electron)

Comments

@Shazib
Copy link
Contributor

Shazib commented Jun 30, 2023

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

No files are saved, app becomes erratic and un-usable afterwards (can't close/open budget).

I think this is due to a new security model starting in electron v21 that disallows the use of new/malloc:

https://www.electronjs.org/blog/v8-memory-cage

I will investigate this when i get time over the next couple days.

What error did you receive?

Loaded spreadsheet from cache (1000 items)
FATAL ERROR: v8_ArrayBuffer_NewBackingStore When the V8 Sandbox is enabled, ArrayBuffer backing stores must be allocated inside the sandbox address space. Please use an appropriate ArrayBuffer::Allocator to allocate these buffers, or disable the sandbox.
 1: 00007FF6331076E6 node::SetTracingController+80006
 2: 00007FF633107850 node::OnFatalError+304
 3: 00007FF635D69A12 v8::Function::NewInstance+1074
 4: 00007FF631DBD93B v8::ArrayBuffer::NewBackingStore+171
 5: 00007FF63311579D node::Buffer::New+717
 6: 00007FF63311554D node::Buffer::New+125
 7: 00007FFD7EC94810 node_register_module_v114+12384
 8: 00007FF63499FE68 v8::MicrotasksScope::PerformCheckpoint+88456
 9: 00000AFA5FE9C2F9

Where are you hosting Actual?

Other

What browsers are you seeing the problem on?

Other

Operating System

Windows 11

@Shazib Shazib added the bug Something isn't working label Jun 30, 2023
@j-f1 j-f1 added the electron Issues related to the desktop app (electron) label Jun 30, 2023
@Shazib
Copy link
Contributor Author

Shazib commented Jul 1, 2023

So this issue is caused by calling export on a better-sqlite db object. Specifically line ~151 in cloud-storage.js.

I'm not 100% sure yet how to solve this. calling Buffer.alloc in that method is totally ok, but whatever export does under the surface is not allowed.

I'm considering writing the db a temp file and reading it in again as a properly allocated buffer.

At least I think its a better-sqlite object, we also use sqljs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working electron Issues related to the desktop app (electron)
Projects
None yet
Development

No branches or pull requests

2 participants