[Bug] Multiple budgets #183

Closed
opened 2026-02-28 18:51:23 -06:00 by GiteaMirror · 18 comments
Owner

Originally created by @rich-howell on GitHub (Jan 22, 2023).

Discussed in https://github.com/actualbudget/actual/discussions/252

Originally posted by TradedManatee September 23, 2022
I've got two sets of accounts/budgets. One for my personal expenses and one for joint expenses with my partner.

I've tried creating two files on the same instance; however whichever file I open I am presented with all the accounts in both files, which is counter-intuitive to me.

I could spin up a second instance/server on a different port, but this would double the workload on the server.

Would be good to isolate files from each other.

Originally created by @rich-howell on GitHub (Jan 22, 2023). ### Discussed in https://github.com/actualbudget/actual/discussions/252 <div type='discussions-op-text'> <sup>Originally posted by **TradedManatee** September 23, 2022</sup> I've got two sets of accounts/budgets. One for my personal expenses and one for joint expenses with my partner. I've tried creating two files on the same instance; however whichever file I open I am presented with all the accounts in both files, which is counter-intuitive to me. I could spin up a second instance/server on a different port, but this would double the workload on the server. Would be good to isolate files from each other.</div>
GiteaMirror added the bug label 2026-02-28 18:51:23 -06:00
Author
Owner

@rich-howell commented on GitHub (Jan 28, 2023):

Hey @TradedManatee,

I think this was resolved when we switched over to simple sync. Are you able to confirm that it is no longer an issue with the latest release?

Cheers
Rich

@rich-howell commented on GitHub (Jan 28, 2023): Hey @TradedManatee, I think this was resolved when we switched over to simple sync. Are you able to confirm that it is no longer an issue with the latest release? Cheers Rich
Author
Owner

@j-f1 commented on GitHub (Jan 28, 2023):

This issue can still occur if you're not accessing the budget over HTTPS because I believe the SharedArrayBuffer feature requires a secure context (or localhost) plus the other required headers. The client should really be handling this better or provide a clear error message.

@j-f1 commented on GitHub (Jan 28, 2023): This issue can still occur if you're not accessing the budget over HTTPS because I believe the `SharedArrayBuffer` feature requires a secure context (or localhost) plus the other required headers. The client should really be handling this better or provide a clear error message.
Author
Owner

@TechwizEE commented on GitHub (Jan 28, 2023):

I'm able to replicate this issue when HTTPS is not used in 22.12.9. Concur on SharedArrayBuffer not being enabled by the browser (debug console errors state COOP header is being ignored) . Related: #436, https://github.com/jlongster/absurd-sql/issues/14#issuecomment-902116794, https://github.com/actualbudget/actual-server/issues/15

@TechwizEE commented on GitHub (Jan 28, 2023): I'm able to replicate this issue when HTTPS is not used in 22.12.9. Concur on `SharedArrayBuffer` not being enabled by the browser (debug console errors state COOP header is being ignored) . Related: #436, https://github.com/jlongster/absurd-sql/issues/14#issuecomment-902116794, https://github.com/actualbudget/actual-server/issues/15
Author
Owner

@MatissJanis commented on GitHub (Jan 28, 2023):

Would upgrading sqlite solve the problem? If not: any ideas how we could get rid of SharedArrayBuffer and use something else that would be supported in both http & https?

@MatissJanis commented on GitHub (Jan 28, 2023): ~Would upgrading sqlite solve the problem?~ If not: any ideas how we could get rid of `SharedArrayBuffer` and use something else that would be supported in both http & https?
Author
Owner

@TechwizEE commented on GitHub (Jan 28, 2023):

Very good questions. I don't have an immediate answer. My reading so far shows James' absurd-sql is backing sql. absurd-sql has documentation specifically noting SharedArrayBuffer limitations.

Looking through actual/packages/loot-core/package.json I see "@jlongster/sql.js": "^1.6.7" and "absurd-sql": "0.0.53" are dependencies. The blog post above notes a mode called "fallback" that is supposed to enable absurd-sql to still run, with DB writes being "assumed" to be successful.

The top-level readme for absurd-sql also mentions Fallback mode.

@TechwizEE commented on GitHub (Jan 28, 2023): Very good questions. I don't have an immediate answer. My reading so far shows James' `absurd-sql` is backing sql. `absurd-sql` has [documentation](https://jlongster.com/future-sql-web#fallback-mode-without-sharedarraybuffer) specifically noting `SharedArrayBuffer` limitations. Looking through `actual/packages/loot-core/package.json` I see `"@jlongster/sql.js": "^1.6.7"` and `"absurd-sql": "0.0.53"` are dependencies. The blog post above notes a mode called "fallback" that is supposed to enable absurd-sql to still run, with DB writes being "assumed" to be successful. The top-level readme for [`absurd-sql`](https://github.com/jlongster/absurd-sql/blob/master/README.md) also mentions **Fallback mode**.
Author
Owner

@TechwizEE commented on GitHub (Jan 28, 2023):

Thoughts:

  • See if there's a fork of absurd-sql that addresses this functionality (http vs https)
  • Dig into the code and to see how SharedArrayBuffer is being used, see if it can be swapped out

I may see about looking into this. Welcome any thoughts, ideas, contributions, code, expertise.

It is impressive reading through what James did with absurd-sql. Performance is amazing.

@TechwizEE commented on GitHub (Jan 28, 2023): Thoughts: - See if there's a fork of `absurd-sql` that addresses this functionality (http vs https) - Dig into the code and to see how `SharedArrayBuffer` is being used, see if it can be swapped out I may see about looking into this. Welcome any thoughts, ideas, contributions, code, expertise. It is impressive reading through what James did with `absurd-sql`. Performance is amazing.
Author
Owner

@TechwizEE commented on GitHub (Jan 28, 2023):

Just ran 22.12.9 again (git checkout v22.12.9, yarn start on Ubuntu Server 22.04.1) tested the following in Firefox (v109.0) on Windows 10:

  • http://localhost:5006 - No issues, multiple budgets work and sync just fine, No errors on debug console.
  • http://<server's IP>:5006 - Merged budget issue appears. Inspected the debug console and saw Fallback mode unable to write file changes
@TechwizEE commented on GitHub (Jan 28, 2023): Just ran 22.12.9 again (`git checkout v22.12.9`, `yarn start` on Ubuntu Server 22.04.1) tested the following in Firefox (v109.0) on Windows 10: - http://localhost:5006 - No issues, multiple budgets work and sync just fine, No errors on debug console. - http://<server's IP>:5006 - Merged budget issue appears. Inspected the debug console and saw `Fallback mode unable to write file changes`
Author
Owner

@TechwizEE commented on GitHub (Jan 29, 2023):

Would be curious to get @jlongster input:

  • Best solution to support multiple budgets over HTTP and HTTPS without the need to only use localhost with HTTP?
  • Tradeoffs between straight SqlLite vs absurd-sql backing SqlLite (am I understanding absurd-sql correctly?)?
@TechwizEE commented on GitHub (Jan 29, 2023): Would be curious to get @jlongster input: - Best solution to support multiple budgets over HTTP and HTTPS without the need to only use `localhost` with HTTP? - Tradeoffs between straight SqlLite vs absurd-sql backing SqlLite (am I understanding absurd-sql correctly?)?
Author
Owner

@TechwizEE commented on GitHub (Jan 31, 2023):

One idea is to try removing absurd-sql and run plain SqlLite and see if this resolves the HTTP vs HTTPS issue.

Why try removing absurd-sql? Because the debug console message Fallback mode unable to write file changes is located in absurd-sql.

Thoughts? Other ideas?

@TechwizEE commented on GitHub (Jan 31, 2023): ~~One idea is to try removing `absurd-sql` and run plain SqlLite and see if this resolves the HTTP vs HTTPS issue.~~ ~~Why try removing `absurd-sql`? Because the debug console message `Fallback mode unable to write file changes` is located in `absurd-sql`.~~ Thoughts? Other ideas?
Author
Owner

@shall0pass commented on GitHub (Jan 31, 2023):

One idea is to try removing absurd-sql and run plain SqlLite and see if this resolves the HTTP vs HTTPS issue.

Why try removing absurd-sql? Because the debug console message Fallback mode unable to write file changes is located in absurd-sql.

Thoughts? Other ideas?

You might find this interesting at 1:10:00. It provides some history of why things were done the way they were.
https://changelog.com/podcast/495

@shall0pass commented on GitHub (Jan 31, 2023): > One idea is to try removing `absurd-sql` and run plain SqlLite and see if this resolves the HTTP vs HTTPS issue. > > Why try removing `absurd-sql`? Because the debug console message `Fallback mode unable to write file changes` is located in `absurd-sql`. > > Thoughts? Other ideas? You might find this interesting at 1:10:00. It provides some history of why things were done the way they were. https://changelog.com/podcast/495
Author
Owner

@TechwizEE commented on GitHub (Jan 31, 2023):

Awesome, will check out the podcast

@TechwizEE commented on GitHub (Jan 31, 2023): Awesome, will check out the podcast
Author
Owner

@TechwizEE commented on GitHub (Feb 1, 2023):

You might find this interesting at 1:10:00. It provides some history of why things were done the way they were. https://changelog.com/podcast/495

Thank you for the link and time reference. Enjoyed listening. I was not aware of how core absurd-sql is to Actual.

@TechwizEE commented on GitHub (Feb 1, 2023): > You might find this interesting at 1:10:00. It provides some history of why things were done the way they were. https://changelog.com/podcast/495 Thank you for the link and time reference. Enjoyed listening. I was not aware of how core `absurd-sql` is to Actual.
Author
Owner

@shall0pass commented on GitHub (Feb 1, 2023):

👍 I was impressed with the solution, given the technical challenges.

@shall0pass commented on GitHub (Feb 1, 2023): 👍 I was impressed with the solution, given the technical challenges.
Author
Owner

@j-f1 commented on GitHub (Feb 1, 2023):

Something I don’t understand about this is why absurd-sql falls over so badly in a single-tab environment. It seems like SharedArrayBuffer would be about syncing between multiple open tabs, but the issues encountered here are easy to reproduce with only a single tab open.

@j-f1 commented on GitHub (Feb 1, 2023): Something I don’t understand about this is why absurd-sql falls over so badly in a single-tab environment. It seems like `SharedArrayBuffer` would be about syncing between multiple open tabs, but the issues encountered here are easy to reproduce with only a single tab open.
Author
Owner

@shall0pass commented on GitHub (Feb 1, 2023):

Is it possible to have Actual serve https instead of http? I found this package on npmjs that sounds like it might do that? If Actual served https by default, the fallback option would never be used, right?

@shall0pass commented on GitHub (Feb 1, 2023): Is it possible to have Actual serve https instead of http? I found this [package](https://www.npmjs.com/package/https-localhost?activeTab=readme) on npmjs that sounds like it might do that? If Actual served https by default, the fallback option would never be used, right?
Author
Owner

@j-f1 commented on GitHub (Feb 1, 2023):

Working on that! It isn’t an issue for local servers since localhost is treated as a secure context (even if HTTPS is not used), so tools like mkcert would work less well. I think I’m going to implement it by making people provide their own HTTPS certificates, but I’m open to other ideas!

@j-f1 commented on GitHub (Feb 1, 2023): Working on that! It isn’t an issue for local servers since `localhost` is treated as a secure context (even if HTTPS is not used), so tools like `mkcert` would work less well. I think I’m going to implement it by making people provide their own HTTPS certificates, but I’m open to other ideas!
Author
Owner

@shall0pass commented on GitHub (Feb 1, 2023):

I guess I was thinking more from the perspective of a docker container serving the https, where you wouldn't automatically need nginx.

@shall0pass commented on GitHub (Feb 1, 2023): I guess I was thinking more from the perspective of a docker container serving the https, where you wouldn't automatically need nginx.
Author
Owner

@j-f1 commented on GitHub (Feb 3, 2023):

Closing this out since #600 adds a warning when this happens. If you’ve followed the steps it suggests and are still seeing this issue, please open a new bug report!

@j-f1 commented on GitHub (Feb 3, 2023): Closing this out since #600 adds a warning when this happens. If you’ve followed the steps it suggests and are still seeing this issue, please open a new bug report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#183