Open samth opened 8 years ago
Out of date zo files can cause arbitrary memory corruption nowadays. Why is this worth investigating?
Wait, really? I didn't know that -- when did it happen?
Also, these errors are from a wrong version, which is detected before reading, so I don't think memory corruption would be possible.
Well, if I have an unexported function and an exported macro in one file and another file requires that one, using the macro. The macro does some syntactic checks and compiles into a call to the function. Say this call is saved in a .zo file. Then, later on, the function and the macro both change in such a way that the generated call from an old use of the macro no longer makes a safe call to the function. If the .zo file is not recompiled then the function will be called in a way that breaks internal invariants of that function. Now arbitrary bad things can go wrong because invariants are broken. (The main interesting example of this phenomenon is TR, of course.)
First, that definitely isn't what's happening here -- Racket is trying to load something and failing, not loading the wrong thing.
Second, it's always been the case that you can call unexported functions by generating the appropriate bytecode (or by using things like require/expose
). But the scenario you describe sounds like it just would see the .zo file as out of date, rather than loading the wrong code, since the file defining the macro had changed without the dependent zo being updated.
First, You said it was using out of date .zo files. How exactly do you know that that error was the only thing that went wrong?
Second, I am not getting what relevance second has to this PR.
My question remains.
I think we should investigate this because I don't think it's caused by memory corruption. I don't, of course, know that the error messages I saw were the only thing that went wrong; something else could always have happened. But it seems like the error messages are the most likely indicator of what the error was.
Okay, but if you stick arbitrary errors into DrRacket in places that would correspond to bugs then I would prefer to fix the bugs rather than reason about DrRacket's implementation behaves when ordinarily okay expressions start randomly erroring.
Unless you are saying that point 2. happend in the interactions window (and the out of date .zo files are not ones that DrRacket itself depends on)?
The error message is pointing to the s3-sync
package, which I don't think DrRacket depends on. More generally, I don't think this is a bug in DrRacket -- the function at issue is is never called in DrRacket source code.
Sorry, I should have said "the gui library" not DrRacket. I agree that that error is effectively blaming racket/gui somewhere.
I suppose it is reasonable that one should be able to survive runtime errors in all dynamic-requires (even those from lazy-require) in more friendly ways, but it seems really hard and it's not clear it is worth it.
I'm not seeing how this is a good use of our time. Just re-compile your .zo files and move on. IMO.
I don't think the actual bug is failing to handle out-of-date .zo files properly, but that clipboard handling sometimes calls things in the wrong eventspace. It just happens that the internal errors you get from DrRacket when you have out-of-date .zos triggers this bug, but I don't think that's the only thing that does. For example, @soegaard's bug report that I linked to doesn't mention zo files, and the bug @mfelleisen reported here has a different error that seems to have triggered it.
Ok, here's a different way to reproduce the error:
drracket/private/syncheck/blueboxes-gui.rkt
(thanks C-S-o)(car)
to the beginning of the fetch
functionThe error is because the eventspace attached to the wx
object in the mouse handling for the mouse-release event is the original eventspace, not the error-display-eventspace. All the other events for that window are in the correct eventspace, so I'm not yet sure what's going on to cause this.
Thanks!
I don't see the bad behavior on my mac, but what happens if you change thread
on line 85 on drracket/private/init to queue-callback
?
That didn't seem to change the behavior.
I provoked this by:
Here's the
racket/gui
error:And here's the previous DrRacket error: