Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Exception thrown when calling ReadyServerForPlayersAsync with Multiplay 1.0.4 package

Discussion in 'Game Server Hosting' started by lsaeteurn, Jun 8, 2023.

  1. lsaeteurn

    lsaeteurn

    Joined:
    Jan 26, 2023
    Posts:
    90
    I'm getting a serialization error when calling this method after server has been allocated:
    MultiplayService.Instance.ReadyServerForPlayersAsync()

    This did not happen in 1.0.0-pre.9. I'm using Multiplay 1.0.4 package with Matchmaking.

    Stack trace:
    Unity.Services.Multiplay.Http.ResponseDeserializationException: Value cannot be null.
    Parameter name: s ---> System.ArgumentNullException: Value cannot be null.
    Parameter name: s
    at System.IO.StringReader..ctor (System.String s) [0x00009] in <4d56092c9a8849cab50a947b257065a3>:0
    at (wrapper remoting-invoke-with-check) System.IO.StringReader..ctor(string)
    at Unity.Services.Multiplay.Http.IsolatedJsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00007] in <36b9d87424c14cd4ae0be3147b90d289>:0
    at Unity.Services.Multiplay.Http.IsolatedJsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <36b9d87424c14cd4ae0be3147b90d289>:0
    at Unity.Services.Multiplay.Http.ResponseHandler.TryDeserializeResponse[T] (Unity.Services.Multiplay.Http.HttpClientResponse response) [0x0001f] in <36b9d87424c14cd4ae0be3147b90d289>:0
    --- End of inner exception stack trace ---
    at Unity.Services.Multiplay.Http.ResponseHandler.TryDeserializeResponse[T] (Unity.Services.Multiplay.Http.HttpClientResponse response) [0x00036] in <36b9d87424c14cd4ae0be3147b90d289>:0
    at Unity.Services.Multiplay.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.Multiplay.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) [0x000e1] in <36b9d87424c14cd4ae0be3147b90d289>:0
    at Unity.Services.Multiplay.Apis.GameServer.GameServerApiClient.ReadyServerAsync (Unity.Services.Multiplay.GameServer.ReadyServerRequest request, Unity.Services.Multiplay.Configuration operationConfiguration) [0x0011f] in <36b9d87424c14cd4ae0be3147b90d289>:0
    at Unity.Services.Multiplay.Internal.WrappedMultiplayService.ReadyServerForPlayersAsync () [0x000d7] in <36b9d87424c14cd4ae0be3147b90d289>:0
     
    earthcrosser and idominguez like this.
  2. earthcrosser

    earthcrosser

    Joined:
    Oct 13, 2010
    Posts:
    121
    //Here is my stack trace. pretty similar to yours I'm also on version 1.0.4.


    DEDICATED_SERVER CHARACTER SELECT
    ReadyServerForPlayersAsync
    Unloading 18 unused Assets to reduce memory usage. Loaded Objects now: 3344.
    Total: 5.937589 ms (FindLiveObjects: 0.190790 ms CreateObjectMapping: 0.171029 ms MarkObjects: 5.464814 ms DeleteObjects: 0.110351 ms)
    ArgumentNullException: Value cannot be null.
    Parameter name: s
    at System.IO.StringReader..ctor (System.String s) [0x00009] in <6a7073c34fd84694af6ceb3e0d94723f>:0
    at (wrapper remoting-invoke-with-check) System.IO.StringReader..ctor(string)
    at Unity.Services.Multiplay.Http.IsolatedJsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00007] in <16bc70132e78455e91d545a8a968b91f>:0
    at Unity.Services.Multiplay.Http.IsolatedJsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <16bc70132e78455e91d545a8a968b91f>:0
    at Unity.Services.Multiplay.Http.ResponseHandler.TryDeserializeResponse[T] (Unity.Services.Multiplay.Http.HttpClientResponse response) [0x0001f] in <16bc70132e78455e91d545a8a968b91f>:0
    Rethrow as ResponseDeserializationException: Value cannot be null.
    Parameter name: s
    at Unity.Services.Multiplay.Http.ResponseHandler.TryDeserializeResponse[T] (Unity.Services.Multiplay.Http.HttpClientResponse response) [0x00036] in <16bc70132e78455e91d545a8a968b91f>:0
    at Unity.Services.Multiplay.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.Multiplay.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) [0x000e1] in <16bc70132e78455e91d545a8a968b91f>:0
    at Unity.Services.Multiplay.Apis.GameServer.GameServerApiClient.ReadyServerAsync (Unity.Services.Multiplay.GameServer.ReadyServerRequest request, Unity.Services.Multiplay.Configuration operationConfiguration) [0x0011f] in <16bc70132e78455e91d545a8a968b91f>:0
    at Unity.Services.Multiplay.Internal.WrappedMultiplayService.ReadyServerForPlayersAsync () [0x000d7] in <16bc70132e78455e91d545a8a968b91f>:0
    at CharacterSelectReady.Start () [0x00073] in <028fd712e4084c83a5b93542dea3550e>:0
    at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <6a7073c34fd84694af6ceb3e0d94723f>:0
    at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00002] in <8382331eb16a45de892e077c2a31245f>:0
    at UnityEngine.UnitySynchronizationContext.Exec () [0x0005d] in <8382331eb16a45de892e077c2a31245f>:0
    at UnityEngine.UnitySynchronizationContext.ExecuteTasks () [0x00014] in <8382331eb16a45de892e077c2a31245f>:0
    DEDICATED_SERVER MultiplayEventCallbacks_Allocate
    Already auto allocated!
     
  3. BSimonSweet

    BSimonSweet

    Joined:
    Aug 17, 2022
    Posts:
    55
    I've the same exception when running the build on a test allocation. My logs is similar to @earthcrosser.

    Edit : tried to update to 23.3f1, but the bug is still occurring (rolled back to 22.18 now). I'm unable to test a server build right now, there is no workaround ...
     
    Last edited: Jun 16, 2023
  4. earthcrosser

    earthcrosser

    Joined:
    Oct 13, 2010
    Posts:
    121
    Hi just curious what are the build settings that you are using. I've tried Dedicated Server and linux build but I'm not sure what to choose in project settings. I have ILCPP and and .NET Standard 2.1 chosen in player setting configuration right now. I can't seem to find a straight answer on what those should be.
     
  5. BSimonSweet

    BSimonSweet

    Joined:
    Aug 17, 2022
    Posts:
    55
    I'm building to Linux Dedicated, with Mono and .Net Standard 2.1. I don't think the build settings are the cause, because the build starts correctly on Multiplay. It's just the call to "ReadyServerForPlayersAsync()" that fails.

    I've looked a bit into the methods call from the error callstack, it's looks like the method expect a JSON response after an HTTP request, but it gets nothing; an empty byte array, which will returns a null string object that is then passed to a StringReader ... And it doesn't like empty string.

    So I guess there a deeper issue with the Multiplay SDK / Services, I don't think it is normal that the service returns an empty response ...
     
  6. earthcrosser

    earthcrosser

    Joined:
    Oct 13, 2010
    Posts:
    121
    @BSimonSweet @lsaeteurn well I uninstalled the package com.unity.services.multiplay and then re-installed but I set the version to 1.0.3 and the problem went away. (sheesh what a pain). Anyway hope this works for you all as well.
     
    BSimonSweet likes this.
  7. SuperBytes

    SuperBytes

    Joined:
    Jan 28, 2020
    Posts:
    8
    Having exactly the same error here, same logs. Anybody has finally found a workaround or solution?
     
  8. earthcrosser

    earthcrosser

    Joined:
    Oct 13, 2010
    Posts:
    121
    What version of the package do you have installed? My solution was to go to version 1.0.3.
     
  9. kashif789us

    kashif789us

    Joined:
    May 2, 2013
    Posts:
    163
    I downgraded to 1.0.3 but still facing the exception :(
     
  10. BSimonSweet

    BSimonSweet

    Joined:
    Aug 17, 2022
    Posts:
    55
    This solution works for me. I'll keep working with version 1.0.3, but Unity needs to fix the bug on 1.0.4.
     
  11. orcunsari

    orcunsari

    Joined:
    Jul 21, 2016
    Posts:
    23
    Any news on this thread? I'm still encountering the issue with 1.0.3
     
  12. orcunsari

    orcunsari

    Joined:
    Jul 21, 2016
    Posts:
    23
    I did same but now I'm encountering error at GetPayload Async, which package version do you use for Matchmaker?
     
  13. kashif789us

    kashif789us

    Joined:
    May 2, 2013
    Posts:
    163
    It's working for me after downgrading to version: 1.0.0-pre.10
     
  14. BSimonSweet

    BSimonSweet

    Joined:
    Aug 17, 2022
    Posts:
    55
    I'm not using Matchmaker right now, but will later. And I've not yet used the GetPlayloadAsync method, so I can not help you :/
     
  15. SuperBytes

    SuperBytes

    Joined:
    Jan 28, 2020
    Posts:
    8
    How did you change the version? It is not published on the package manager...
     
  16. BSimonSweet

    BSimonSweet

    Joined:
    Aug 17, 2022
    Posts:
    55
    You can do that manually in the
    manifest.json
    file of your project.

    upload_2023-6-22_11-58-57.png
     
  17. jackward84

    jackward84

    Joined:
    Jan 26, 2017
    Posts:
    87
    I also get the same error, so I just don't call the function. It doesn't seem to be called in example projects either, so I'm not totally sure what it does. Players still get allocated and connect instantly via matchmaker.
     
  18. spikyworm5

    spikyworm5

    Joined:
    Jul 13, 2020
    Posts:
    31
  19. earthcrosser

    earthcrosser

    Joined:
    Oct 13, 2010
    Posts:
    121