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] NRE in DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB #66024

Closed
radical opened this issue Mar 1, 2022 · 2 comments · Fixed by #73524
Closed

[wasm] NRE in DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB #66024

radical opened this issue Mar 1, 2022 · 2 comments · Fixed by #73524
Assignees
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Milestone

Comments

@radical
Copy link
Member

radical commented Mar 1, 2022

Hit on a unrelated PR #66017:
Build, and log.

[19:28:59] info: Inspector-88[0] console.warning: 
[19:28:59] info: Inspector-88[0] console.warning: Unhandled Exception:
[19:28:59] info: Inspector-88[0] console.warning: System.NullReferenceException: Object reference not set to an instance of an object.
[19:28:59] info: Inspector-88[0] console.warning:    at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990
[19:28:59] dbug: Inspector-88[0] Failing all waiters because: Runtime.exceptionThrown: {   "timestamp": 1646162939709.186,   "exceptionDetails": {     "exceptionId": 2,     "text": "Uncaught",     "lineNumber": 2,     "columnNumber": 46776,     "scriptId": "6",     "url": "http://localhost:9400/dotnet.js",     "stackTrace": {       "callFrames": [         {           "functionName": "_convert_exception_for_method_call",           "scriptId": "6",           "url": "http://localhost:9400/dotnet.js",           "lineNumber": 2,           "columnNumber": 46776         },         {           "functionName": "_handle_exception_for_call",           "scriptId": "6",           "url": "http://localhost:9400/dotnet.js",           "lineNumber": 2,           "columnNumber": 47416         },         {           "functionName": "_debugger_test__TestHotReloadUsingSDB_RunMethod",           "scriptId": "36",           "url": "https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod",           "lineNumber": 24,           "columnNumber": 4         },         {           "functionName": "invoke_static_method",           "scriptId": "3",           "url": "http://localhost:9400/debugger-driver.html",           "lineNumber": 25,           "columnNumber": 10         },         {           "functionName": "",           "scriptId": "33",           "url": "",           "lineNumber": 0,           "columnNumber": 31         }       ]     },     "exception": {       "type": "object",       "subtype": "error",       "className": "Error",       "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",       "objectId": "3464803935764391451.1.57",       "preview": {         "type": "object",         "subtype": "error",         "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",         "overflow": false,         "properties": [           {             "name": "stack",             "type": "string",             "value": "Error: System.NullReferenceException: Object refer…bugger-driver.html:26:11)\n    at <anonymous>:1:32"           },           {             "name": "message",             "type": "string",             "value": "System.NullReferenceException: Object reference no…ger/tests/debugger-test/debugger-test.cs:line 990"           }         ]       }     },     "executionContextId": 1   } }
[19:28:59] dbug: InspectorClient-88[0] RunLoop stopped, reason: Shutdown. (parentToken: True, linked: True): 
[19:28:59] dbug: InspectorClient-88[0] Failing 0 pending cmds
[19:28:59] dbug: InspectorClient-88[0] Loop ended with socket: Aborted
[xUnit.net 00:03:17.04]     DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB [FAIL]
  Failed DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB [1 s]
  Error Message:
   System.ArgumentException : {
  "timestamp": 1646162939709.186,
  "exceptionDetails": {
    "exceptionId": 2,
    "text": "Uncaught",
    "lineNumber": 2,
    "columnNumber": 46776,
    "scriptId": "6",
    "url": "http://localhost:9400/dotnet.js",
    "stackTrace": {
      "callFrames": [
        {
          "functionName": "_convert_exception_for_method_call",
          "scriptId": "6",
          "url": "http://localhost:9400/dotnet.js",
          "lineNumber": 2,
          "columnNumber": 46776
        },
        {
          "functionName": "_handle_exception_for_call",
          "scriptId": "6",
          "url": "http://localhost:9400/dotnet.js",
          "lineNumber": 2,
          "columnNumber": 47416
        },
        {
          "functionName": "_debugger_test__TestHotReloadUsingSDB_RunMethod",
          "scriptId": "36",
          "url": "https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod",
          "lineNumber": 24,
          "columnNumber": 4
        },
        {
          "functionName": "invoke_static_method",
          "scriptId": "3",
          "url": "http://localhost:9400/debugger-driver.html",
          "lineNumber": 25,
          "columnNumber": 10
        },
        {
          "functionName": "",
          "scriptId": "33",
          "url": "",
          "lineNumber": 0,
          "columnNumber": 31
        }
      ]
    },
    "exception": {
      "type": "object",
      "subtype": "error",
      "className": "Error",
      "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",
      "objectId": "3464803935764391451.1.57",
      "preview": {
        "type": "object",
        "subtype": "error",
        "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",
        "overflow": false,
        "properties": [
          {
            "name": "stack",
            "type": "string",
            "value": "Error: System.NullReferenceException: Object refer…bugger-driver.html:26:11)\n    at <anonymous>:1:32"
          },
          {
            "name": "message",
            "type": "string",
            "value": "System.NullReferenceException: Object reference no…ger/tests/debugger-test/debugger-test.cs:line 990"
          }
        ]
      }
    },
    "executionContextId": 1
  },
  "__forMethod": "Runtime.exceptionThrown"
}
  Stack Trace:
     at DebuggerTests.DebuggerTestBase.LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(String asm_file, String pdb_file, String class_name, String method_name) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 1276
   at DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB() in /_/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs:line 756
--- End of stack trace from previous location ---
@radical radical added arch-wasm WebAssembly architecture area-Debugger-mono labels Mar 1, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 1, 2022
@ghost
Copy link

ghost commented Mar 1, 2022

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

Hit on a unrelated PR #66017:
Build, and log.

[19:28:59] info: Inspector-88[0] console.warning: 
[19:28:59] info: Inspector-88[0] console.warning: Unhandled Exception:
[19:28:59] info: Inspector-88[0] console.warning: System.NullReferenceException: Object reference not set to an instance of an object.
[19:28:59] info: Inspector-88[0] console.warning:    at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990
[19:28:59] dbug: Inspector-88[0] Failing all waiters because: Runtime.exceptionThrown: {   "timestamp": 1646162939709.186,   "exceptionDetails": {     "exceptionId": 2,     "text": "Uncaught",     "lineNumber": 2,     "columnNumber": 46776,     "scriptId": "6",     "url": "http://localhost:9400/dotnet.js",     "stackTrace": {       "callFrames": [         {           "functionName": "_convert_exception_for_method_call",           "scriptId": "6",           "url": "http://localhost:9400/dotnet.js",           "lineNumber": 2,           "columnNumber": 46776         },         {           "functionName": "_handle_exception_for_call",           "scriptId": "6",           "url": "http://localhost:9400/dotnet.js",           "lineNumber": 2,           "columnNumber": 47416         },         {           "functionName": "_debugger_test__TestHotReloadUsingSDB_RunMethod",           "scriptId": "36",           "url": "https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod",           "lineNumber": 24,           "columnNumber": 4         },         {           "functionName": "invoke_static_method",           "scriptId": "3",           "url": "http://localhost:9400/debugger-driver.html",           "lineNumber": 25,           "columnNumber": 10         },         {           "functionName": "",           "scriptId": "33",           "url": "",           "lineNumber": 0,           "columnNumber": 31         }       ]     },     "exception": {       "type": "object",       "subtype": "error",       "className": "Error",       "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",       "objectId": "3464803935764391451.1.57",       "preview": {         "type": "object",         "subtype": "error",         "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",         "overflow": false,         "properties": [           {             "name": "stack",             "type": "string",             "value": "Error: System.NullReferenceException: Object refer…bugger-driver.html:26:11)\n    at <anonymous>:1:32"           },           {             "name": "message",             "type": "string",             "value": "System.NullReferenceException: Object reference no…ger/tests/debugger-test/debugger-test.cs:line 990"           }         ]       }     },     "executionContextId": 1   } }
[19:28:59] dbug: InspectorClient-88[0] RunLoop stopped, reason: Shutdown. (parentToken: True, linked: True): 
[19:28:59] dbug: InspectorClient-88[0] Failing 0 pending cmds
[19:28:59] dbug: InspectorClient-88[0] Loop ended with socket: Aborted
[xUnit.net 00:03:17.04]     DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB [FAIL]
  Failed DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB [1 s]
  Error Message:
   System.ArgumentException : {
  "timestamp": 1646162939709.186,
  "exceptionDetails": {
    "exceptionId": 2,
    "text": "Uncaught",
    "lineNumber": 2,
    "columnNumber": 46776,
    "scriptId": "6",
    "url": "http://localhost:9400/dotnet.js",
    "stackTrace": {
      "callFrames": [
        {
          "functionName": "_convert_exception_for_method_call",
          "scriptId": "6",
          "url": "http://localhost:9400/dotnet.js",
          "lineNumber": 2,
          "columnNumber": 46776
        },
        {
          "functionName": "_handle_exception_for_call",
          "scriptId": "6",
          "url": "http://localhost:9400/dotnet.js",
          "lineNumber": 2,
          "columnNumber": 47416
        },
        {
          "functionName": "_debugger_test__TestHotReloadUsingSDB_RunMethod",
          "scriptId": "36",
          "url": "https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod",
          "lineNumber": 24,
          "columnNumber": 4
        },
        {
          "functionName": "invoke_static_method",
          "scriptId": "3",
          "url": "http://localhost:9400/debugger-driver.html",
          "lineNumber": 25,
          "columnNumber": 10
        },
        {
          "functionName": "",
          "scriptId": "33",
          "url": "",
          "lineNumber": 0,
          "columnNumber": 31
        }
      ]
    },
    "exception": {
      "type": "object",
      "subtype": "error",
      "className": "Error",
      "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",
      "objectId": "3464803935764391451.1.57",
      "preview": {
        "type": "object",
        "subtype": "error",
        "description": "Error: System.NullReferenceException: Object reference not set to an instance of an object.\n   at TestHotReloadUsingSDB.RunMethod(String className, String methodName) in /_/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs:line 990\n    at _convert_exception_for_method_call (http://localhost:9400/dotnet.js:3:46777)\n    at _handle_exception_for_call (http://localhost:9400/dotnet.js:3:47417)\n    at _debugger_test__TestHotReloadUsingSDB_RunMethod (https://mono-wasm.invalid/_debugger_test__TestHotReloadUsingSDB_RunMethod:25:5)\n    at invoke_static_method (http://localhost:9400/debugger-driver.html:26:11)\n    at <anonymous>:1:32",
        "overflow": false,
        "properties": [
          {
            "name": "stack",
            "type": "string",
            "value": "Error: System.NullReferenceException: Object refer…bugger-driver.html:26:11)\n    at <anonymous>:1:32"
          },
          {
            "name": "message",
            "type": "string",
            "value": "System.NullReferenceException: Object reference no…ger/tests/debugger-test/debugger-test.cs:line 990"
          }
        ]
      }
    },
    "executionContextId": 1
  },
  "__forMethod": "Runtime.exceptionThrown"
}
  Stack Trace:
     at DebuggerTests.DebuggerTestBase.LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(String asm_file, String pdb_file, String class_name, String method_name) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 1276
   at DebuggerTests.BreakpointTests.DebugHotReloadMethodUnchangedUsingSDB() in /_/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs:line 756
--- End of stack trace from previous location ---
Author: radical
Assignees: -
Labels:

arch-wasm, area-Debugger-mono

Milestone: -

@radical radical removed the untriaged New issue has not been triaged by the area owner label Mar 1, 2022
@radical radical self-assigned this Mar 2, 2022
@radical
Copy link
Member Author

radical commented Mar 2, 2022

Related failure:

[19:59:52] info: Inspector-94[0] waiting for the runtime to be ready
  Failed DebuggerTests.BreakpointTests.DebugHotReloadMethodChangedUserBreak [31 ms]
  Error Message:
   Assert.True() Failure
Expected: True
Actual:   False
  Stack Trace:
     at DebuggerTests.DebuggerTestBase.LoadAssemblyAndTestHotReload(String asm_file, String pdb_file, String asm_file_hot_reload, String class_name, String method_name) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 1358
   at DebuggerTests.BreakpointTests.DebugHotReloadMethodChangedUserBreak() in /_/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs:line 327
--- End of stack trace from previous location ---

@thaystg thaystg added this to the 7.0.0 milestone Jul 5, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 7, 2022
radical added a commit that referenced this issue Aug 9, 2022
## 1. Fix random HotReload test failures
Some of the hot reload tests fail randomly because they call the updated methods too early.
The tests used `Thread.Sleep(3000)` to wait for the method to get updated, and the proxy
to respond to that. And that's essentially racy.

Instead, wait for the `breakpointResolved` event, or the `scriptParsed` events for the methods,
as appropriate.

Fixes #66024
Fixes #72946 

## 2. Fix race in adding/removing event handlers

Use ConcurrentDictionary for event listeners, and notification handlers, since they can be modified
from different threads.

Fixes #69144 .

## 3. Fix a race condition where the tests start calling methods before the app is ready

Fixes #73528
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 9, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants