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

[WASM] Transform.c:2856, condition `<disabled>' not met #12981

Closed
jeromelaban opened this issue Feb 13, 2019 · 13 comments · Fixed by #14098
Assignees

Comments

@jeromelaban
Copy link
Contributor

@jeromelaban jeromelaban commented Feb 13, 2019

When running a wasm binary under the interpreter with debugging enabled, the following error can occur:

* Assertion at /mnt/jenkins/workspace/test-mono-mainline-wasm/label/ubuntu-1804-amd64/mono/mini/interp/transform.c:2856, condition `<disabled>' not met

Steps to Reproduce

  1. In Visual Studio 2017/2019, open this solution at commit nventive/Uno.Xaml-Controls-Gallery@f1be090.
  2. Select the XamlControlsGallery.Wasm project
  3. Ensure that the active configuration is Debug
  4. Run the project with Ctrl+F5
  5. Once the app has started click on any item in the left list

Current Behavior

There's an assertion in the runtime's interpreter.

Expected Behavior

A managed exception is raised. There's really an issue in this commit of the repo, where an NRE is raised.

On which platforms did you notice this

[ ] macOS
[ ] Linux
[ ] Windows
[X] WebAssembly

Version Used: 5f65ce9

@jeromelaban jeromelaban changed the title Transform.c:2856, condition `<disabled>' not met [WASM] Transform.c:2856, condition `<disabled>' not met Feb 13, 2019
@marek-safar

This comment has been minimized.

Copy link
Member

@marek-safar marek-safar commented Feb 13, 2019

@jeromelaban

This comment has been minimized.

Copy link
Contributor Author

@jeromelaban jeromelaban commented Mar 15, 2019

Here's a repro:

static void Main(string[] args) => MethodA(null);

internal static bool MethodA(object sender)
{
    if (sender == null) { return true; }
    return MethodA(sender);
}

the issue happens only in release configutation.

See here for the full repro: https://github.com/jeromelaban/Wasm.Samples/tree/master/Bug12981-InterpRecursion/BugInterpRecursion

jeromelaban added a commit to unoplatform/uno that referenced this issue Mar 15, 2019
jeromelaban added a commit to unoplatform/uno that referenced this issue Mar 15, 2019
Fixes #614
@jeromelaban jeromelaban referenced this issue Mar 15, 2019
3 of 6 tasks complete
@lewurm lewurm self-assigned this Mar 15, 2019
@kjpou1

This comment has been minimized.

Copy link
Member

@kjpou1 kjpou1 commented Apr 10, 2019

@jeromelaban Is this still an issue?

I have taken your sample above and created both a Debug version and a Release version here using full linkage and can not reproduce this.

Sample code from: https://github.com/jeromelaban/Wasm.Samples/tree/master/Bug12981-InterpRecursion/BugInterpRecursion

Release mode:

Loaded: System.Drawing.Common.dll
Loaded: WebAssembly.Net.WebSockets.dll
Loaded: System.Web.Services.dll
Loaded: WasmCoreObjects.dll
Loaded: WebAssembly.Bindings.dll
Loaded: WebAssembly.Net.Http.dll
Loaded: System.dll
Loaded: System.Net.Http.dll
Loaded: mscorlib.dll
initializing mono runtime
>>mono_wasm_runtime_ready
Called internal static bool MethodA(object sender) from static void MainA(string[] args) => MethodA(null);
Total Memory Exit WASM: 33554432

Loaded: System.Drawing.Common.dll
Loaded: System.Web.Services.dll
Loaded: WasmCoreObjects.dll
Loaded: WebAssembly.Bindings.dll
Loaded: WebAssembly.Net.Http.dll
Loaded: WebAssembly.Net.WebSockets.dll
Loaded: System.Drawing.Common.pdb
Loaded: System.Net.Http.pdb
Loaded: System.Web.Services.pdb
Loaded: System.pdb
Loaded: System.dll
Loaded: WasmCoreObjects.pdb
Loaded: WebAssembly.Bindings.pdb
Loaded: WebAssembly.Net.Http.pdb
Loaded: WebAssembly.Net.WebSockets.pdb
Loaded: System.Net.Http.dll
Loaded: mscorlib.pdb
Loaded: mscorlib.dll
initializing mono runtime
DEBUGGING ENABLED
>>mono_wasm_runtime_ready
Called internal static bool MethodA(object sender) from static void MainA(string[] args) => MethodA(null);
Total Memory Exit WASM: 33554432

@kjpou1

This comment has been minimized.

Copy link
Member

@kjpou1 kjpou1 commented Apr 10, 2019

@kjpou1

This comment has been minimized.

Copy link
Member

@kjpou1 kjpou1 commented Apr 12, 2019

@lewurm do you think we can close this? Have run the tests above as well as included it in the wasm tests. Maybe I am missing something with the repro of the issue.

@jeromelaban

This comment has been minimized.

Copy link
Contributor Author

@jeromelaban jeromelaban commented Apr 12, 2019

I will check this again today and will let you know, thanks!

@jeromelaban

This comment has been minimized.

Copy link
Contributor Author

@jeromelaban jeromelaban commented Apr 12, 2019

@kjpou1 it still fails with 22bbf44, with this repro: https://github.com/jeromelaban/Wasm.Samples/tree/master/Bug12981-InterpRecursion/BugInterpRecursion.

Note that the build has to be made in release configuration (most probably if the /optimize switch is added to csc).

Stacktrace: 

mono.js:1 Error
    at Array.ASM_CONSTS (mono.js:1)
    at _emscripten_asm_const_i (mono.js:1)
    at :64317/wasm-function[6072]:18
    at :64317/wasm-function[3863]:38
    at :64317/wasm-function[3730]:41
    at :64317/wasm-function[2135]:44
    at :64317/wasm-function[143]:33
    at :64317/wasm-function[5649]:175
    at :64317/wasm-function[5733]:93
    at :64317/wasm-function[5750]:441
mono.js:1 * Assertion at /mnt/jenkins/workspace/test-mono-mainline-wasm/label/ubuntu-1804-amd64/mono/mini/interp/transform.c:5440, condition `<disabled>' not met
put_char @ mono.js:1
uno-bootstrap.js:147 abort(). Build with -s ASSERTIONS=1 for more info.
@vargaz

This comment has been minimized.

Copy link
Member

@vargaz vargaz commented Apr 12, 2019

I can't reproduce it either. Could you attach the .exe file ?

@jeromelaban

This comment has been minimized.

Copy link
Contributor Author

@jeromelaban jeromelaban commented Apr 12, 2019

Sure: dist.zip

@vargaz

This comment has been minimized.

Copy link
Member

@vargaz vargaz commented Apr 12, 2019

I can reproduce with the assemblies from that zip file.

@vargaz

This comment has been minimized.

Copy link
Member

@vargaz vargaz commented Apr 12, 2019

There seems to be a problem with the BugInterpRecursion.clr file. If I run ildasm+ilasm on it, the problem goes away.

@jeromelaban

This comment has been minimized.

Copy link
Contributor Author

@jeromelaban jeromelaban commented Apr 12, 2019

Could it be related to the linker, or a combination of CSC + ILinker ? I'm building using VS2019 16.0. (windows)

@vargaz

This comment has been minimized.

Copy link
Member

@vargaz vargaz commented Apr 12, 2019

Seems to be because ins->il_offset == td->header->code_size at transform.c:5440, because of the tailcall opt in transform_call () does this:
++td->ip; /* gobble the CEE_RET if it isn't branched to */
and after that, it does:

			last_seq_point = interp_add_ins (td, MINT_SDB_SEQ_POINT);
			// This seq point is actually associated with the instruction following the call
			last_seq_point->il_offset = td->ip - header->code;
			last_seq_point->flags = INTERP_INST_FLAG_SEQ_POINT_NONEMPTY_STACK;
lewurm added a commit to lewurm/mono that referenced this issue Apr 17, 2019
It could be a tailcall that hasn't any opcodes after it, so just leave
it as-is in those cases.

Fixes mono#12981
lewurm added a commit to lewurm/mono that referenced this issue Apr 17, 2019
lewurm added a commit to lewurm/mono that referenced this issue Apr 17, 2019
monojenkins added a commit that referenced this issue Apr 18, 2019
[interp] disable tail call opt if managed debugger is enabled 

Fixes #12981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.