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

PatchDB concurrency startup problem #4825

Closed
baconpaul opened this issue Aug 11, 2021 · 1 comment · Fixed by #5098 or #5427
Closed

PatchDB concurrency startup problem #4825

baconpaul opened this issue Aug 11, 2021 · 1 comment · Fixed by #5098 or #5427
Labels
Before Beta If these are open we can't really call ourselves beta Bug Report Item submitted using the Bug Report template Patch Browser
Milestone

Comments

@baconpaul
Copy link
Collaborator

Basically as mentioned in #4824 we have a nasty startup semi-race.
It used to result in uncaught exceptions which were of course very bad
but now it makes a splattage of surge errors

here's how

remove the patches db
start two instances of the plugin in logic or reaper or whatnot
shift-click patch browser in both

this basically starts both populating the database

BUT one of them will get a locked / sqlite3_busy (5) message

which will explode them

So we could do a lot of things but I think the trick is

  1. BEGIN IMMEDIATE when we start our transaction
  2. If we get a '5' then wait. We can also do this with a https://www.sqlite.org/c3ref/busy_timeout.html
  3. If we still get a '5' then give up for a bit but don't drain the queue

something like that replacing the TxnGuard class we hav wrapped around the 'go'

@baconpaul baconpaul added the Bug Report Item submitted using the Bug Report template label Aug 11, 2021
@baconpaul
Copy link
Collaborator Author

Oh and this ties to #2359 as well of course.

@baconpaul baconpaul added this to the Surge XT 1.0 milestone Aug 11, 2021
@baconpaul baconpaul added the Before Beta If these are open we can't really call ourselves beta label Sep 6, 2021
baconpaul added a commit to baconpaul/surge that referenced this issue Sep 15, 2021
1. Improve concurrency both in and cross process
   a. open one connection per thread
   b. close the readwrite connection when not in use
   c. since (a) we can do nomutex and therefore
   d. since (c) and (b) not lock across processes
2. Add a 'debug junk' table and a 'debug' button to write into it
   to test for now

Addresses byt does not yet fully resolve surge-synthesizer#4825
baconpaul added a commit that referenced this issue Sep 16, 2021
1. Improve concurrency both in and cross process
   a. open one connection per thread
   b. close the readwrite connection when not in use
   c. since (a) we can do nomutex and therefore
   d. since (c) and (b) not lock across processes
2. Add a 'debug junk' table and a 'debug' button to write into it
   to test for now

Addresses byt does not yet fully resolve #4825
@baconpaul baconpaul reopened this Sep 19, 2021
baconpaul added a commit to baconpaul/surge that referenced this issue Sep 19, 2021
1. Don't lock the db so carelessly
2. Deal better with favorites not being there
3. Show some countdown stats (Closes surge-synthesizer#4826 although the UI needs doing)

Addresses surge-synthesizer#4825 also
baconpaul added a commit to baconpaul/surge that referenced this issue Sep 19, 2021
1. Don't lock the db so carelessly
2. Deal better with favorites not being there
3. Show some countdown stats (Closes surge-synthesizer#4826 although the UI needs doing)

Addresses surge-synthesizer#4825 also
baconpaul added a commit that referenced this issue Sep 20, 2021
1. Don't lock the db so carelessly
2. Deal better with favorites not being there
3. Show some countdown stats (Closes #4826 although the UI needs doing)

Addresses #4825 also
baconpaul added a commit to baconpaul/surge that referenced this issue Nov 14, 2021
baconpaul added a commit that referenced this issue Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Before Beta If these are open we can't really call ourselves beta Bug Report Item submitted using the Bug Report template Patch Browser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant