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

Error when selecting all tracks #594

Closed
Arthur-McArthur opened this issue Jun 9, 2022 · 3 comments
Closed

Error when selecting all tracks #594

Arthur-McArthur opened this issue Jun 9, 2022 · 3 comments
Labels
bug Something isn't working high priority realearn Related to ReaLearn

Comments

@Arthur-McArthur
Copy link

I've been getting errors when selecting all tracks in my main project which has around 250 tracks in it. I've reproduced the error by making a project, adding tracks rapidly and selecting them all:

https://imgur.com/a/mTvplyX

--- cut ---
REAPER version: 6.59+dev0603/x64
Module name: ReaLearn
Module version: v2.13.0-pre.4/x86_64 rev c31d4f (2022-05-12 14:41:00 UTC)
Module base address: 0x7fffc3430000
Module size: 0x1430000

Message: called Result::unwrap() on an Err value: Channel [normal main tasks]: "Full(..)"

0: 0x7fffc41f3735 - cpp_to_rust_ProjectStateContext_SetTempFlag
1: 0x7fffc41f152c - cpp_to_rust_ProjectStateContext_SetTempFlag
2: 0x7fffc40b0b48 - MAIN
3: 0x7fffc4215616 - cpp_to_rust_ProjectStateContext_SetTempFlag
4: 0x7fffc421541b - cpp_to_rust_ProjectStateContext_SetTempFlag
5: 0x7fffc4212c37 - cpp_to_rust_ProjectStateContext_SetTempFlag
6: 0x7fffc4215119 - cpp_to_rust_ProjectStateContext_SetTempFlag
7: 0x7fffc42eed60 - rust_eh_personality
8: 0x7fffc42eee73 - rust_eh_personality
9: 0x7fffc3b97bb5 - MAIN
10: 0x7fffc3b0cd3f - DllMain
11: 0x7fffc3afaba5 - DllMain
12: 0x7fffc3cf8ea3 - MAIN
13: 0x7fffc3cf9295 - MAIN
14: 0x7fffc3b739cd - MAIN
15: 0x7fffc41578f8 - MAIN
16: 0x7fffc41585ab - cpp_to_rust_IReaperControlSurface_SetSurfaceSelected
17: 0x1402f1233 -
18: 0x14080ec85 -
19: 0x14080ebf9 -
20: 0x14087c0cb -
21: 0x14022c0d8 -
22: 0x140210438 -
23: 0x14027bbcf -
24: 0x14041a94f -
25: 0x14041a854 -
26: 0x14041fcf4 -
27: 0x140421a1d -
28: 0x140443e60 -
29: 0x140986c81 -
30: 0x7ff845b454e0 - BaseThreadInitThunk
31: 0x7ff84734485b - RtlUserThreadStart
--- cut ---

@helgoboss
Copy link
Owner

Thanks. Good that this error reappears. I've recently improved the error messages and now they show in more detail the issue. I think I know how to fix it.

@helgoboss
Copy link
Owner

I think we will see this kind of error a lot less from now on. ReaLearn operates with message channels to communicate between threads. So far it almost exclusively used bounded channels, which means they allocate channel space in advance and complain with "channel full" errors when the channel is full. This can happen on load spikes such as yours (selecting many tracks etc.).

I converted all channels which are never used in real-time contexts to unbounded channels. This has multiple benefits:

  • This makes "channel full" errors impossible. The channel simply grows bigger if there's a load spike.
  • It also decreases initial memory consumption, so you just pay for what you use.

The disadvantage is that unbounded channels can lead to memory exhaustion because there's no limit. In practice, a memory exhaustion can only occur if there's a message producer which keeps sending messages which don't get consumed. This can only happen if we have a logic error in the application. A memory exhaustion (resulting in an out-of-memory error) would hide the original logic error, which is bad because it makes it very hard to find the original error. Therefore I still added an artificial limit of currently 1,000,000 messages. When this limit is hit, users will see an error message which channel hit this limit and how many messages it contains. This provides at least some info for finding the error cause and should prevent memory exhaustion.

@Arthur-McArthur
Copy link
Author

Excellent, thanks for the quick fix and detail!!

@helgoboss helgoboss added the realearn Related to ReaLearn label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority realearn Related to ReaLearn
Projects
None yet
Development

No branches or pull requests

2 participants