Skip to content

[wasm] System.Net.Http.BrowserHttpHandler.SendAsync() throws NRE #53872

Closed

Description

@pavelsavara

In unit test System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.GetAsync_RequestHeadersAddCustomHeaders_HeaderAndEmptyValueSent(remoteServer: (BaseUri: https://127.0.0.1:61813/, HttpVersion: 1.1) on WASM and browser.

System.NullReferenceException : Object reference not set to an instance of an object.
   at System.Net.Http.BrowserHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.GetAsync_RequestHeadersAddCustomHeaders_HeaderAndEmptyValueSent(RemoteServer remoteServer, Uri uri)

This is not network related issue, it could be reproduced without BrowserHttpHandler see https://github.com/dotnet/runtime/pull/54453/files

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Jun 8, 2021
  2. added a commit that references this issue on Jun 8, 2021
  3. added this to the 6.0.0 milestone on Jun 8, 2021
  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Jun 8, 2021
  5. lewing commented on Jun 8, 2021

    @lewing
    Member

    Looking at the test I don't see an obvious reason it should fail like this. Is this failing on all browser lanes? There was some work done allow trimming more of the header logic out and if these tests weren't running they may have regressed.

  6. pavelsavara commented on Jun 10, 2021

    @pavelsavara
    MemberAuthor

    Here is example of the failure on CI
    https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-53925-merge-160a064b73f24741b2/System.Net.Http.Functional.Tests/console.3a6c0e9f.log?sv=2019-07-07&se=2021-06-30T09%3A14%3A59Z&sr=c&sp=rl&sig=qBO1wWtqkq9AGYRX0b82P6An%2BBE0LKFnuckJY0ed6BU%3D

    This time different test and on ubuntu, not windows.
    System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.GetAsync_ServerNeedsAuthAndNoCredential_StatusCodeUnauthorized

    Maybe race condition ?

  7. pavelsavara commented on Jun 10, 2021

    @pavelsavara
    MemberAuthor

    Yes second CI run on the same code as above is green.

  8. changed the title [-][wasm] System.Net.Http.BrowserHttpHandler.SendAsync() throws NPE[/-] [+][wasm] System.Net.Http.BrowserHttpHandler.SendAsync() throws NRE[/+] on Jun 10, 2021
  9. pavelsavara commented on Jun 10, 2021

    @pavelsavara
    MemberAuthor

    Another locally

    System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.GetAsync_RequestHeadersAddCustomHeaders_HeaderAndValueSent(remoteServer: (BaseUri: https://127.0.0.1:57664/, HttpVersion: 1.1), name: "X-CustomHeader", value: "x-value", uri: https://127.0.0.1:57664/Echo.ashx)
      info: System.NullReferenceException : Object reference not set to an instance of an object.
      info:    at System.Net.Http.BrowserHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
      info:    at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
      info:    at System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.GetAsync_RequestHeadersAddCustomHeaders_HeaderAndValueSent(RemoteServer remoteServer, String name, String value, Uri uri)
    
  10. pavelsavara commented on Jun 10, 2021

    @pavelsavara
    MemberAuthor
    System.ArgumentNullException : Value cannot be null. (Parameter 'fetchResponse')
      info:    at System.Net.Http.BrowserHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    
  11. pavelsavara commented on Jun 10, 2021

    @pavelsavara
    MemberAuthor

    Repro at pavelsavara@a2b0a7b#diff-66ce677ded58c3a6a0639d321f4460bb0b2c4bcaeb3216ff3db4381937365bd8

    It fails randomly with s, q, x3 and x10 as last state

    I think JSObject is returned as null from some of the marshaling calls.

    @lewing @kg thoughts ?

  12. kg commented on Jun 10, 2021

    @kg
    Contributor

    Most likely explanation is a GC issue. I think if it were memory corruption in the runtime (which has been known to happen, but hasn't - afaik - been seen recently) it wouldn't just be consistently producing NREs, other bad stuff would be happening.

  13. pavelsavara commented on Jun 19, 2021

    @pavelsavara
    MemberAuthor

    Very simple steps to reproduce here https://github.com/dotnet/runtime/pull/54453/files

    dotnet build /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release /t:Test src\libraries\System.Private.Runtime.InteropServices.JavaScript\tests /p:WithCategories="Pavel"
    
  14. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jun 21, 2021
  15. lewing commented on Jun 28, 2021

    @lewing
    Member

    looks similar to

    [20:02:53] info: Initializing.....
    [20:02:55] info: {"method":"console.error","payload":{},"arguments":[{}]}
    [20:02:55] fail: Error: System.NullReferenceException: Object reference not set to an instance of an object.
                        at System.Runtime.InteropServices.JavaScript.Runtime.<>c__DisplayClass27_0.<SetupJSContinuation>g__Complete|0()
                        at System.Runtime.InteropServices.JavaScript.Runtime.SetupJSContinuation(Task task, JSObject continuationObj)
                         at Object._convert_exception_for_method_call (http://127.0.0.1:35977/dotnet.js:1:171696)
                         at Object._handle_exception_for_call (http://127.0.0.1:35977/dotnet.js:1:173665)
                         at Object._handle_exception_and_produce_result_for_call (http://127.0.0.1:35977/dotnet.js:1:173986)
                         at Object._call_method_with_converted_args (http://127.0.0.1:35977/dotnet.js:1:175060)
                         at Object.call_method (http://127.0.0.1:35977/dotnet.js:1:173455)
                         at Object._unbox_task_rooted (http://127.0.0.1:35977/dotnet.js:1:152563)
                         at Object._unbox_mono_obj_rooted_with_known_nonprimitive_type (http://127.0.0.1:35977/dotnet.js:1:153449)
                         at Object._unbox_mono_obj_root (http://127.0.0.1:35977/dotnet.js:1:154685)
                         at Object._handle_exception_and_produce_result_for_call (http://127.0.0.1:35977/dotnet.js:1:174106)
                         at Object._call_method_with_converted_args (http://127.0.0.1:35977/dotnet.js:1:175060)
    [20:02:55] info: Discovering: System.Xml.Linq.xNodeBuilder.Tests.dll (method display = ClassAndMethod, method display options = None)
    [20:02:55] info: Discovered:  System.Xml.Linq.xNodeBuilder.Tests.dll (found 7 of 8 test cases)
    [20:02:55] info: Starting:    System.Xml.Linq.xNodeBuilder.Tests.dll
    [20:02:55] info: Finished:    System.Xml.Linq.xNodeBuilder.Tests.dll
    [20:02:55] info: 
    [20:02:55] info: === TEST EXECUTION SUMMARY ===
    

    from https://dev.azure.com/dnceng/public/_build/results?buildId=1206770&view=logs&j=108d2c4a-8a62-5a58-8dad-8e1042acc93c&t=568f884b-cc12-5fd3-e7fe-790b5ac403f4&l=125

  16. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 15, 2021
  17. ghost locked as resolved and limited conversation to collaborators on Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmWebAssembly architecture

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions