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
scide: Document.current nulled on Class Library Recompile #4413
Comments
I've also seen errors with There are several bugs with document-status sync between the editor and the language. (The document text mirror gets broken, and I know for sure that recompile isn't involved in that bug.) Somehow the communication gets dropped in Windows, but not in other platforms. |
Thanks @jamshark70
I've now checked this on my Linux machine (Ubuntu 18.04, SC 3.10.2, source build), and can confirm it doesn't reproduce. Seems like a Windows-specific issue. I wasn't able to reproduce on my Windows laptop, until I updated the OS to 1809 (from 1806), now it's 100% reproducible, so it looks like something in a recent update is related? For now, I've discovered that running: ScIDE.handshake; Manages to resync everything and temporarily stop the errors. On further tests, this is the specific line from the handshake method:
|
As an update: On more experiments, this appears to be related to the Server shutdown during the recompile.
A lot changes when the Server gets involved..trying to narrow it down |
Can reproduce it too on my Windows 10 machine with SC 3.11-beta |
Happens to me too with 3.10.4. Yes it does seem happen only after recompling the class library, it seems. It's especially annoying when using the test suite with scripts as in
since those I run after recompile... getting hit with
is a bit of a "huh, what?" every time it happens. Sure enough every time
even though it's from a saved document. Also, after it happens, for me the bug is permanent-until-SCide-restart (similar to the "DDE" #4845 bug in this respect), meaning that closing and reopening that unittest3.scd file (from within SC, as to avoid any DDE failures) still results in
right after re-opening the file. Furthermore, after the bug hits, switching to another buffer/file also results in that Basically, I need to restart SCide to make that nuisance go away. Simply recompiling the class library again doesn't seem to help with getting out of the Also this bug seems unrelated to the DDE bug (beside/despite the fact that they both need SCide restart to clear.) I could get SCide in a state where |
I also get this all the time (on Windows 10), especially now with 3.11.0 it seems even more frequent, but I also had it often with 3.10.3 and 3.10.4 for sure. It happens, e.g. if I have a class file (.sc) open, save it, then press Ctrl-Shift-L to recompile the class library, and then make an edit of the open (saved) file (e.g. press 'space' or hit enter) somewhere in the document. It is really annoying (seems more likely to happen than before, I think). I also get this other message sometimes, which I think is related to the above problem...(?) ERROR: Message 'didBecomeKey' not understood.
RECEIVER:
nil
ARGS:
CALL STACK:
DoesNotUnderstandError:reportError
arg this = <instance of DoesNotUnderstandError>
Nil:handleError
arg this = nil
arg error = <instance of DoesNotUnderstandError>
Thread:handleError
arg this = <instance of Thread>
arg error = <instance of DoesNotUnderstandError>
Object:throw
arg this = <instance of DoesNotUnderstandError>
Object:doesNotUnderstand
arg this = nil
arg selector = 'didBecomeKey'
arg args = [*0]
Meta_Document:prCurrent_
arg this = <instance of Meta_Document>
arg newCurrent = nil
Meta_Document:setActiveDocByQUuid
arg this = <instance of Meta_Document>
arg quuid = '{ce76b6c0-4c11-4791-b459-4b92a99c8045}'
var newCurrent = nil
< closed FunctionDef > (no arguments or variables)
Process:interpretCmdLine
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Message 'didBecomeKey' not understood.
RECEIVER: nil |
I get those errors all the time on Windows (SC 3.11.1) |
FWIW: Still an issue in 3.11.2. Here is a screenshot showing three open document panels, but I think I had done: 1/ open a document; 2/ recompile the class library; 3/ open the other doc from disk and create a new (untitled) doc. The doc from step 1 is the missing reference. |
It think it might be related to some quarks or extensions. Doesn't happed to me at all if I disable all extensions that seem to run extensive code in their I had to recompile like 3 times though to make it happen just with AudacityLabels activated, so there is probably some race condition with classlib compilation. It seems the bigger quarks are more likely to make it happen. But once it happened, meaning I got a
So in my case it was even worse than what @jamshark70 reports above. After trying to switch tabs again
If I then force:
it fixes itself:
But here is the strange part: then I disable the only quark I had (AudacityLabels), recompile class lib and
But, I don't get any errors thrown anymore in the post window! And the more interesting part is that this time, while showing no obvious error, tab switching no longer causes Document.allDocuments to be populated on tab switching, meaning after switching between 10 tabs or so,
All this is pretty confusing since I don't know what the intended behavior is supposed to be. Probably it should be re-populated because if I do another classlib recompile, washout changing quarks at all this time, now right after it's compiled
So it seems that the bug that causes @Spacechild1 What quarks do you have installed and activated? |
@avdrd I think you're on the right track... I have lots of quarks in use (similar ones to you, though not AudacityLabels). Several use classInit stuff and I have sometimes seen ordering issues between them. Also, I normally have many document tabs open at once. (And am using a workspace to remember my layout on restart.) I did notice that on another machine I didn't seem to get this error on recompilation (very often, or at all). |
I tried to fix it like this, but it didn't' really work because the update happens on a deferred thread. I'll have to add a polling loop...
Doesn't fix it::
The interesting bit is that ScIDE itself does this in its initClass:
I do wonder if that fails at the |
So it seems that it doesn't fail at
Posts:
|
This finally fixes it for me.
Posts
In hindsight, waiting for Those timeouts can be pretty short. Well, if you comment out some of the
|
Should we perhaps have these various stages emit signals, rather than loop-polling? We've got CondVar to help with thread blocking/unblocking; seems to me this is a case where we might use it. |
Alas it's not a 100% fix. I went out for a few hours, during which my computer was asleep, with SC running as it was, but when I came back and resumed it, no class recompiles or anything...
And sure enough
instead of the 20 or so that I actually have opened. So the problem seems more complicated that somehow ScIDE periodically seems to push bad And I actually had to However, after a few more days and perhaps 100 classlib recompiles, I've had zero failures right after recompiling with
So while it's not a 100% solution, it is like 99% for me. |
Deleted my previous comment because some of it wasn't correct. @avdrd 's DocFix workaround does get around the didResignKey / didBecomeKey errors in my case... cheers for that, thanks! The (probably related) other thing is that my modular style coding interface based on ProxySpace tries to push a patch's ProxySpace as the currentEnvironment when switching to the document tab. In Linux, |
I've closed a couple of duplicate issues, often this issue arises in conjunction with #4812 |
Environment
Steps to reproduce
Expected vs. actual behavior
Expected: Document to close.
Actual: Document closes and error thrown.
Document.current not successfully reinitialised, so on closing the document, or anything else that relies on it, errors are triggered:
A vast array of errors get thrown over the course of using SC, some of which are huge. The only way to stop them is to reboot the interpreter.
As far as I can tell, it doesn't render the IDE unusable, but it's not ideal - and particularly troublesome when developing classes and having to recompile the class library often.
A very quick look at the code shows a signal being emitted (line 379):
supercollider/editors/sc-ide/core/sc_process.cpp
Lines 353 to 384 in f65a1ef
But I can't find it being listened to anywhere, apart from the HelpBrowser.
If someone can point me in the right direction, I'm happy to look into making a PR.
The text was updated successfully, but these errors were encountered: