Closed n0samu closed 2 months ago
This error occurs every time I click the "Like Us on Facebook" button on the game's main menu.
Here is the relevant code on frame 3 of the SWF:
stop();
facebook_btn.onPress = function()
{
Playtomic.Log.CustomMetric("Main Menu - Like Button");
Playtomic.Log.ForceSend();
getUrl("http://www.facebook.com/gideovames", "_blank");
};
I found several ways to stop this error from occurring:
_loc2_.sendAndLoad("http://g" + Playtomic.Log.GUID + ".api.playtomic.com/Tracker/q.aspx?swfid=" + Playtomic.Log.SWFID + "&q=" + this.Data + "&url=" + Playtomic.Log.SourceUrl + "&" + Math.random() + "z",_loc3_,"POST");
Playtomic.Log.ForceSend();
.Browser devtools (Network tab) show that the Playtomic request is never actually sent, even if the getUrl call is before the ForceSend call. If the getUrl call is removed, then the Playtomic network request is sent as normal.
On the other hand, no error happens in the Ruffle desktop app. The desktop app only logs the following warning:
WARN isahc::handler] request completed with error: failed to resolve host name
My conclusion is that Ruffle's web Navigator backend must try to acquire an exclusive lock when opening webpages via getUrl. And it seems like the Playtomic network request already acquired a lock on the same object, so the getUrl call crashes Ruffle. If we reverse the order, the network request fails to acquire the lock instead, but that just fails silently instead of crashing Ruffle.
The "recursive lock" type errors tend to happen after the player has already panicked, so I tend to be suspicious that the true cause was buried under other log lines. However, I do have an idea of how this can happen: namely, in web/src/navigator.rs:191
we grab the current window, and then construct a request, and then we await
the request.
If web_sys
has internal locks on window
, then that's a potential explanation for the bug. We didn't extinguish the window
reference before await
ing.
I'm not currently at my normal dev box so I can't play around with this right now, though.
FWIW it seems possible to reproduce this issue with just two lines of code:
loadMovieNum("fake.swf",0,"GET"); // no need for fake.swf to exist
getURL("https://ruffle.rs","_blank","GET");
P-code:
Push "fake.swf" "_level0"
GetURL2 false false 1
Push "https://ruffle.rs" "_blank"
GetURL2 false false 1
https://ruffle.rs
from opening (which should be the case by default), no crash occurs.Tested on Firefox.
Found another game with this issue: https://www.kongregate.com/games/Scarybug/chronotron If you click "Bonus Levels" on the main menu, then "Click here to play these levels on Kongregate", the game will crash. For some reason the panic screen doesn't show, but the console has the same error.
Found yet another one: https://archive.org/details/warlords-calltoarms Click "Play More Games" on the main menu and the error will occur.
I just tested all of these games in Edge (Chromium) and the errors did not occur at all. I think this is some strange Firefox bug.
Also, for each of the games I activated "Pause on exceptions" in Firefox's Developer Tools. Here's what I found:
With #8846, the panic screen now shows for all 3 games. Nothing else has changed.
Clicking the Ludobox.com splash screen logo in Track the Ball also causes the same error.
Starting file downloads on a tab with a Ruffle player seems to sometimes trigger a similar bug in Firefox. For example, going to https://n0samu.github.io/ruffle-testing/?swf=homesheephome.swf , then removing ?swf=
from the URL and pressing Enter (to trigger a file download for the SWF) often makes the Ruffle player either panic or freeze.
Error Info
Error name: Error Error message: panicked at 'assertion failed:
(left == right)
left:true
, right:false
: cannot recursively acquire mutex', /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys/wasm/../unsupported/locks/mutex.rs:24:9 Error stack:Player Info
Allows script access: false Renderer: WebGL
Page Info
Page URL: https://archive.org/details/flash_clickmaze2
Browser Info
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0 Platform: Win32 Has touch support: true
Ruffle Info
Version: 0.1.0 Name: nightly 2022-09-19 Channel: nightly Built: 2022-09-19T00:15:10.357Z Commit: 9b9c95bfe28cb862d44e9517e94e9de73acd9de3 Is extension: false
Metadata
width: 500 height: 435 frameRate: 60 numFrames: 1802 swfVersion: 10 backgroundColor: #003CC6 isActionScript3: false uncompressedLength: 714268