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
Current live Recording block lost on writing Label #2590
Comments
|
Pavel, how often could you reproduce the bug? I could trigger it only like in 5% of my tries. |
|
I could reproduce the bug, but... like one time in 20 tries. When it happened, I was using accented letters, but this does not automatically mean that it can happen only when using them - it might have been a coincidence. The error in json format (which I get by clicking "problem details") tells more useful information: log.txt |
|
I could get another occurrence, this time the "json-format" error is slightly different in its "data" section: |
|
Wait. Actually there was some problem before, which I don't have after update. It was very very tiny error which wasn't affecting almost at all. |
|
I was lucky enough to get another occurrence:
So it looks as if the problem can happen with plain characters too. |
|
5th second, 3rd label. Quick, random writing, plain characters only Log: Details: |
|
And after several more attempts another type of error. Now audacity completely crashed. Some window error poped out but I was writing so fast that it dissapeared (even that I haven't pressed enter or space), Audacity hang out and after few seconds it crashed totally showing the Error raport for Exception error 0xc0000005 (pressed "send" too): Edit. It is long, I will put it into file: |
|
another occurrence. Pasting the log as there is some other problem described at 2 minutes before the record loss. (loss happened after 1m of new recording block started) Also the main error happened this time not at writing characters but when pressed enter to finish entering characters into label. |
|
In an attempt to increase the rate of the bug happening, I tried these things:
With both of the above set on, I tried both with the official release (3.1.3) and with a debug build, run in debug mode. The rate of the bug did not change - I got only one occurrence in about 20 tries. |
|
I was unlucky enough today to get error on the first label input, and another one right after, within seconds. There was several other errors but not for all I did copy the details, and I forgot to copy the whole log too. As I understand right since the error codes are different and sharing them all might help to debug, therefore I paste details which was the same for both errors I have copied details of: |
|
The error messages tell me that the constructor of TransactionScope fails and throws. The message from sqlite, "cannot open savepoint - SQL statements in progress" suggests that there is a concurrently running statement on another thread. The crash Pavel mentioned might be a result becuase the TransactionScope is sometimes not in the main thread, and there is no catch block for the exception. @crsib does this suggest any changes in arguments to sqlite3 calls to fix concurrent accesses? But an alternative is to avoid concurrent accesses, trying to serialize all work on the database in the main thread. So my speculation about how to write a fix: Find all of Audacity's uses of sqlite3_prepare_v3 and sqlite3_prepare_v2. Trace the call graph upward, and identify call paths that may happen outside of the main thread. Change those to delay what they do, using Here is one such path, which I think is also the likely one at fault, but the call graph should be explored more to decide whether this is complete. I would use CallAfter in DrainRecordBuffers. So that means this line, at 2067 in AudioIO.cpp:
We should also explore the calls to the constructor of TransactionScope. And here is another path up to the same function: |
|
Thanks Paul for the pointer, that helped. |
|
Was my guess about the cause confirmed? |
|
Yes, it happens because the same DB access is used concurrently and without fences.
So it looks like the two threads use the DB access concurrently, and that wreaks all different sorts of havoc (as you can see in the different error messages - if you look at the "json" ones). Also, it was hard to reproduce because the keypress had to come exactly at every multiple of that 5.9 seconds. I changed things so that the auto-save of the recording happens 64 times more often, and then if I keep a key pressed, the bug is much more likely to happen - usually in the first 4 seconds. Besides this, it seems to me a bit overkill that at every key press while writing a label, a full autosave of the project is done. But I might be wrong, maybe what is done is an incremental save - I did not dig into that level of detail yet. |
|
Thank you all very much for the bug reported here, the analysis and and for this fix ! |







RadioDM commentedFeb 24, 2022
Describe the bug
I record a sound from Speakers output device. While recording is going I put some labels into Label track (option Type to Create a Label enabled). Sometimes writing the label text cause stopping the recording and loose the block of recording back to when the record block has started. For this logged session (added at bottom) I have lost the recording about 3 times. First was after click CTRL+B, another time when I was writing quick a note into another label, it also often happen when input Polish regional characters: śćźżńąęół etc. The recording playback is still running after a bug, but no sound is recorded nor a silence. The previous blocks of sound within the same track are kept, lost is only currently recorded sequence. It can be hours of non-stopped record, or just a minute. Always when writing into labels.
The bug started to happen since update to Audacity 3.1.3. It happen very often. Previous version was more than year old, and bug like this never happened.
To Reproduce
It is not easy to reproduce. It doesn't happen always. But when it happened the steps I had done was:
Expected behaviour
Used to make a notes into label track while recording with no problems before updating Auda. Some Polish letters are not working at all, some working, other run commands for example AlrGr+x would make ź letter but it run command "Split Cut". There should be no commands working when inserting label text.
Additional information (please complete the following information):
Additional context
In this session bug happened 16:51, and about 17:40 two or three times
LOG
The text was updated successfully, but these errors were encountered: