Search Unity

Anyone got problem when sending byte[] using RPC after upgrading to 4.6.3?

Discussion in 'Multiplayer' started by splash5, Feb 26, 2015.

  1. splash5

    splash5

    Joined:
    Nov 8, 2014
    Posts:
    13
    Hi
    Is there anyone got problem when sending byte array using RPC with 4.6.3f1 ?
    Don't know if there is some problem in my code or something, but when sending byte array using RPC call,
    editor will just crash immediately.

    Got the same problem when running on Android and Webplayer.
     
  2. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I don't have a problem sending byte arrays via RPC, but that may be because I haven't attempted to :)

    Maybe post some code if possible? When you say the Editor "crashed" are you talking full Editor process terminates, or your game stops running and issues an error?
     
  3. PeteMc

    PeteMc

    Joined:
    Feb 26, 2015
    Posts:
    2
    I'm having the same issue, byte arrays crash the application on attempt to transmit over RPC after upgrade to latest version, was working with 4.5.4f1. I am not sure if this is because byte arrays were never listed as a supported type for RPC.

    Here's the end of the stack trace from output_log.txt on crash...
    Code (CSharp):
    1. (0x10054B1F) (mono): (filename not available): mono_type_get_type + 0x6
    2. (0x00BF9A50) c:\buildslave\unity\build\runtime\network\packmonorpc.cpp (188 + 0x0): IsValidRPCParameterArrayType + 0x20
    3. (0x00BFA0E9) c:\buildslave\unity\build\runtime\network\packmonorpc.cpp (413 + 0x6): PackRPCParameters + 0x1b9
    4. (0x00BFB489) c:\buildslave\unity\build\runtime\network\packmonorpc.cpp (157 + 0x22): PackRPCParameters + 0xa9
    5. (0x00BF8667) c:\buildslave\unity\build\runtime\network\networkview.cpp (185 + 0x41): NetworkView::RPCCallSpecificTarget + 0x127
    6. (0x00CB0BAE) c:\buildslave\unity\build\artifacts\standaloneplayergenerated\networking.cpp (198 + 0x53): NetworkView_CUSTOM_Internal_RPC_Target + 0x6e
    7. (0x0590EF14) (Mono JIT code): (filename not available):  (wrapper managed-to-native) UnityEngine.NetworkView:Internal_RPC_Target (UnityEngine.NetworkView,string,UnityEngine.NetworkPlayer,object[]) + 0x5c (0590EEB8 0590EF68) [045E6E70 - Unity Root Domain] + 0x0
    8. (0x0590EE93) (Mono JIT code): (filename not available):  UnityEngine.NetworkView:RPC (string,UnityEngine.NetworkPlayer,object[]) + 0x3b (0590EE58 0590EEAA) [045E6E70 - Unity Root Domain] + 0x0
    9.  
     
  4. Natrem

    Natrem

    Joined:
    Feb 24, 2015
    Posts:
    31
  5. PeteMc

    PeteMc

    Joined:
    Feb 26, 2015
    Posts:
    2
  6. splash5

    splash5

    Joined:
    Nov 8, 2014
    Posts:
    13
    My code is very simple... Just sending byte array with RPC call.
    And editor "crashed" is that the editor just close suddenly and then pop up an error report window.
    Hope that Unity team can fix this problem soon, my project use A LOT of RPC calls with byte array as parameter.

    Right now, I can only convert all byte array data into base64 string and sending it with string parameter...
     
  7. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    456
    Sending a byte[] with an RPC was an undocumented functionality in Unity4. I'm not positive you should suspect a fix for it anytime soon but it's likely they will fix it because so many seemed to have used it.
     
  8. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    suddenly today, out of the blue, this started to happen to me as well and now there is no way for me to connect to the game server without making the client crash. Any clue? It happens only on my PC. I guess it may be driver related. I do use strings as parameters.
     
  9. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    apparently I was wrong. Some functions were still using byte[]. I changed all of them and now it does not crash anymore. The string parameter cannot be longer than 4096 bytes though, I wonder if this is actually the reason why the byte[] version was crashing (that is, passing an array bigger than 4096 bytes)
     
  10. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    434
    No, there's a bug in 4.6.3 and above that's causing this. I can cause it to crash:

    networkView.RPC( "RpcBug", RPCMode.Others, new int[] { 1, 2, 3 } );

    So annoying. I have to downgrade again.
     
  11. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Good, half a day debugging for nothing. Do you anyway think that is safe to use the byte[] function? I wonder if it can cause disconnections for unhandled cases.
     
  12. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    434
    Well... it crashes the Unity editor, didn't bother to check the build. I would downgrade to 4.6.2 until it's fixed (that's what I had to do -- our product is 'mission critical' for broadcasting and we can't have any issues while live). It's ANY array not just byte[] or int[], I'm using NetworkViewID[].
     
  13. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Afaik they are not supported functions, so maybe it's not even a bug. I fixed it using strings and base64 codification. I wonder if it is actually a better approach.
     
  14. splash5

    splash5

    Joined:
    Nov 8, 2014
    Posts:
    13
    Here is my testing code, when you click Test3, the editor will just crash.
     

    Attached Files:

  15. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Did yoy already report this bug?
     
  16. splash5

    splash5

    Joined:
    Nov 8, 2014
    Posts:
    13
  17. jonbro5556

    jonbro5556

    Joined:
    Jan 1, 2013
    Posts:
    24
    hey, just wanted to pop in here and add my name to the list of people that are having this problem.

    For those that are sending all their data through a single RPC call, a simple workaround is
    Code (csharp):
    1. ReceiveData(Convert.FromBase64String(data));
    Code (csharp):
    1. SendData(Convert.ToBase64String(data));
    (this is noted up thread, but I thought I would put it here in case anyone else needs it)
     
  18. splash5

    splash5

    Joined:
    Nov 8, 2014
    Posts:
    13
    I just test my project with 4.6.4p2 and it seems to be fixed...