Search Unity

  1. Dismiss Notice
  2. We have added sub-forums for the experimental MLAPI and Unity Transport Package. Please use the new forums to discuss related topics.
    Dismiss Notice
  3. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  4. Dismiss Notice

Unity Multiplayer no free events for message - what does this mean?

Discussion in 'Multiplayer' started by noise256, Jun 9, 2015.

  1. noise256

    noise256

    Joined:
    Apr 7, 2013
    Posts:
    22
    Hi all,

    I have a prototype 'working' locally, using one application as server and the other client. However, when trying to test over the internet with a friend I get the following error message:



    As the title says, these error messages aren't very clear to me and I was hoping someone could point me in the right direction to start debugging this.


    edit: moderator note: we do not remove posts which have replies. I also restored your edited post so the thread is no longer confusing to other users.
     
    Last edited by a moderator: Nov 11, 2015
  2. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    434
    Actually, I'm having this problem too. Did you ever solve it?
    The exact message I have is 'no free events for long message'.
     
  3. yongilkim

    yongilkim

    Joined:
    Sep 15, 2014
    Posts:
    10
    I also experiencing such a phenomenon.
    After updating to 5.1.0f3 in 5.1.0f2
     
  4. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    there are 3 parameters which will affect this:
    1. config.fragmentsize
    2. config.MaxSentMessageQueueSize
    3. how fast you are trying to send.
    Long message will be divided on the fragments of config.fragmentsize and then send. Maximum fragments which you can send are config.MaxSentMessageQueueSize (but this value is shared with other channels of the connection). If you will send next Long message just after that (before network layer be able to send old ones) this number of available fragments will low, and you will possible receive this message.

    So, for full answer i need to know, qos of your channel, message size and send rate, if channel is reliable, i need to know rtt between your and your peer...
     
  5. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    434
    I'm sending large packets over reliable fragmented when client connects. Essentially the client needs to load a voxel world around them, so lots of data. I can spread it out over several frames. Is it a matter of trial and error? I'll have to look into those settings. Is it bad to just greatly increase the limits?
     
  6. SeriousBusinessFace

    SeriousBusinessFace

    Joined:
    May 10, 2014
    Posts:
    127
    Is the voxel world proceduraly generated? Could you just send seed(s)?
     
  7. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    > Is it bad to just greatly increase the limits?
    No it is not bad. This warning just show that you send too much too fast (for library) and need to change configuration or adjust you bandwidth. FragmentedReliable qos was created with the goal do not use them as main qos... I will probably add some sort of streaming qos (with interface like tcp) in the near future for cases like yours.
     
    Shinyclef likes this.
  8. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    434
    Some parts might be procedural with seeds, other parts might not. It's not a traditional voxel game as such, but will have many voxels nonetheless, and I'll definitely need to support worst case scenarios of having large quantities of data to send.

    I use standard reliable for most things, but yeah, my voxel data wasn't fitting in the 1500 MTU so had to use fragmented. Some kind of stream sounds ideal...
     
  9. vdasilva

    vdasilva

    Joined:
    May 11, 2015
    Posts:
    2
    I'm actually seeing the same thing. It's telling me I have no free events on channel 1

    I currently have 2 qos channels:
    0 - Reliable Sequenced
    1- Unreliable

    Currently only NetworkTransforms seem to be using channel 1, seeing as when I remove the channel completely, I get a whole bunch of errors related to the missing channel which comes from NetworkTransforms.

    (Invalid channel when sending buffered data, '1'. Current channel count is 1
    UnityEngine.Networking.NetworkTransform:Update())

    I was wondering how an unreliable channel could run out of events and it got me thinking. Could the two channels be flipped? I flipped the qos type on both channels and now, I no longer get that error message and the clients don't disconnect. On top of it, things seem to run smoother.

    Has anyone seen this?
     
  10. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Hi vdasilva.
    Unfortunately it is possible:( because sendmessage queue is one per connection and it is shared between channels. There are two different buffers for incoming messages: sendmessage queue, and acknowledgement buffer, where reliable messages are waiting for acknowledgements. While ack buffer is full - no new reliable message will be sent.

    Then imagine situation when ack buffer is full, you have additional reliable messages in sendqueue (waiting for send) and you send unreliable message, this message will pushed back to sendqueue and will get stuck by reliable messages on fron of them which are waiting while ack buffer will have free space...

    So it is a problem. What we need to decide, should we fix them (by adding two different queues for reliable/unreliable messages) or it is not very important? If you feel that it should be fixed, submit a bug about this.

    BTW there is a way to increase acknowledgement buffer by setting config.IsAcksLong = true. Other option is increasing sendqueue by setting config.MaxSentMessageQueueSize parameter
    Alex
     
  11. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    You can use the new Network panels of the Unity Profiler to see the amount of traffic your game is using. This may help track down the cause of this.
     
  12. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    We're running into this error with 5.1.0f3, and we suspect that our clients may be disconnecting due to not being able to communicate with the server for tens of seconds when the server is reporting this error. We are using the ReliableSequenced channel.

    Does ConnectionConfig.FragmentSize affect any QoS other than ReliableFragmented?

    If I read Alex's recommendations correctly, we want to experiment with:
    • ConnectionConfig.IsAcksLong = true
    • ConnectionConfig.MaxSentMessageQueueSize = 256 or higher (128 is default)
    • ConnectionConfig.FragmentSize to... our ConnectionConfig.PacketSize? What is the goal of having the default be 1/3 of default PacketSize (1500 and 500)?
     
  13. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Yes correct Chris.
    FragmentSize is depends of do you have alternative channels for sending or not and what is a message size for alternative channels. If not FragmeSize should be ( PacketSize - sizeof(possible headers)) (-50 should be safe do not remember exact value)
    Probably we need to add some functions for determine possible payload size depending from qos of channels?
     
  14. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    Thanks. So, ConnectionConfig.FragmentSize affects ReliableSequenced?
     
  15. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    No. it affects Fragmented qos only...
     
  16. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    Adding these lines to the Start method of our NetworkManager child class causes a server to immediately disconnect any client (same computer, different process), and give a bad message error:

    Code (CSharp):
    1.         base.connectionConfig.IsAcksLong = true; // larger ack buffer, 64 bit
    2.         base.connectionConfig.MaxSentMessageQueueSize = 512;
     
  17. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    arghh :( Yes Chris, you're right. Will fix asap. Thanks for this catch
     
  18. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    no problem. We might stay on 5.1.0f3 for a while, are either IsAcksLong = true or MaxSentMessageQueueSize = 256 or higher safe with 5.1.0f3?
     
  19. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    "either IsAcksLong = true or MaxSentMessageQueueSize = 256 or higher safe with 5.1.0f3?" - IsAcksLong = true won't work before fix :( so u can use larger buffer instead (256). for IsAckLong fix will be available for couple of weeks. Or if it's
     
    chrismarch likes this.
  20. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    Is it safe to use IsAcksLong = true in 5.1.1f1, 64 bit, Windows?
     
  21. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    it was fixed in 5.1.1 patch 3
     
    chrismarch likes this.
  22. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    190
    I am also having this issue even with IsAcksLong = true or MaxSentMessageQueueSize = 256. It only occurs when multiple clients simultaneously connect to the server (say 3+ clients) at the same time. I have tried setting the MaxSentMessageQueueSize higher to even 1024, but it only prolongs the inevitable, which is this error message.Once it happens packets stop sending to the clients.

    Is there anywhere else I should look in solving this?

    I am using Unity 5.1.1p4.
     
  23. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Hmm, questions:
    (1) How many messages do you send? (per sec)
    (2) What is a channel configurations?
    (3) What are you GlobalConfig.minthreadawake timeout and ConnectionConfig.minUpdatetimeout ?
    (4) what is your message size (rough)
    (5) what is rtt between players?
     
  24. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    190
    1) 20 before, recently changed it to 30 per second per connection
    2)

    Code (csharp):
    1.  
    2.   //Add Channels
    3.   config.AddChannel(QosType.Reliable);
    4.   config.AddChannel(QosType.Unreliable);
    5.   config.AddChannel(QosType.ReliableSequenced);
    6.   config.AddChannel(QosType.UnreliableSequenced);
    7.   config.AddChannel(QosType.ReliableFragmented);
    8.   config.AddChannel(QosType.UnreliableFragmented);
    9.   config.AddChannel(QosType.ReliableStateUpdate);
    10.   config.AddChannel(QosType.StateUpdate);
    11.   config.AddChannel(QosType.AllCostDelivery);
    12.  
    3) GlobalConfig.minthreadawake timeout = 0, ConnectionConfig.minUpdatetimeout = 2, selector reactor used
    4) Blank ~48 bytes (~136), with movement data ~150 bytes (~1300 bits)
    5) All local right now so 0

    Settings of everything in this pic: http://gyazo.com/81785d6d6229ae742b0185ec6bd3f545

    I think have caused something bad to happen. I was messing around with the settings and reading more about them in the new api docs but now it seems to happen once the third client connects, rather than before. Going to be looking into what I changed and if I can get to the bottom of this.
     
  25. GenaSG

    GenaSG

    Joined:
    Apr 19, 2014
    Posts:
    108
    Having the same issue on Unity 5.1.3f1.
    Sending player inputs every fixed update frame.
    Largest input Command has following arguments:sbyte forward, sbyte sides,sbyte vertical,float pitch,float yaw,bool sprint,bool crouch,float timeStamp
    Using Reliable Sequenced channel.
    It worked ok on 5.1.1f3.
    Please help. I'm blocked with this issue.
     
  26. TomTrenki

    TomTrenki

    Joined:
    Sep 7, 2015
    Posts:
    1
    I just upgraded to 5.1.3f1 and I'm having similar issues. I'm using the low-level API only, with standard GlobalConfig.
    I'm currently limited to testing everything locally.

    My server writes the game state into a single message each fixed timestep (32 times per second right now). This message is sent to the client through an UnreliableFragmented channel. When the client connects, everything runs fine for a few seconds, then the server starts reporting the NoResources error repeatedly when I attempt to send data to the client.

    I have tested a few different scenarios, with different game state size and different rtt (I'm using the built-in simulator for the rtt, only on the client side though). This is what I found:
    1. Increasing the game state size makes the problem worse
    2. Increasing the simulated rtt on the client makes the problem worse

    For example, when the game state size is ~2400 bytes (equals ~77 KB/s, which I think is a lot, but that's not the point) and the client does not simulate any delay, everything runs fine (at least for a few minutes). However, if the client runs with 100ms simulated rtt, everything runs fine for about 5 seconds, then the server starts spamming the NoResources error.

    Increasing the game state size even further always causes the problem, even with no simulated rtt, and the problem starts appearing already after about 1 or 2 seconds.
    The problem does not seem to appear when the game state size is small enough, but I've never run my program for more than 5 minutes, so I can't say for sure.

    To me it looks like something internally might be leaking, since the problem takes time to appear depending on the amount of data sent.
    Also, I find it particularly puzzling how the rtt affects the problem. I'm sending everything unreliably, so (I assume) the low-level API should not buffer anything of this data after it was sent.

    Please help, I'm hoping this info could be useful.
     
    GenaSG likes this.
  27. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    I think we saw this on 5.1.3f1 when I tested briefly, but I am curious if anyone is getting it with 5.2.0f2
    (we're sticking with 5.1.1f1 for now)
     
  28. GenaSG

    GenaSG

    Joined:
    Apr 19, 2014
    Posts:
    108
    It's still there. BUT as far as I've tested it appears only when using Network Simulation. My project works Ok without network simulation and with external network conditioning tool. So it's a bug in Unity.
     
    chrismarch likes this.
  29. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Hi Gena, as you said that you have got this problems when you use network simulator only, I would say it is probably bug in simulator, report it with reproducing steps please
     
  30. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    I'm seeing this with 5.1.1f1 on windows with a standalone server, and 2 standalone clients connected to it on the same computer after playing for a while with no errors. It happens 100% after about an hour or two, I forget the time, but it is roughly similar each time. We are not using the simulator, or connecting to clients on other computers. We can't upgrade to 5.2 due to bugs in the UI API.

    We are using Reliable Sequenced, and are trying to spread the server to client traffic over 36 channels, so that we don't go over our MaxPendingBuffers (128). We are not using isackslong, since it doesn't work in 5.1.1f1.
     
    Last edited: Oct 20, 2015
  31. rikey

    rikey

    Joined:
    Mar 3, 2015
    Posts:
    147
    I'm also seeing the "no free events for message" warning, which is soon followed by client disconnect. The client is the game running in the editor, and I have the host client running in a standalone. I feel like it happens during an RPC call.

    Using 5.2.1p3 on OS X
     
  32. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    (1) If I point the Network Messages profiler at our standalone server (while playing a client in the editor), and click on one of the frames with more traffic, we have Protocol Packets In: 26, Protocol Packets Out: 24, everything else zero. With 2 clients connected to the server, instead of 1, the profiler shows a similar result when pointed at the server, which I did not expect.
    (2) Reliable Sequenced, MaxPendingBuffers = 128. 36 channels allocated, 19 in use for now. PacketSize = 1200
    (3) default and NetworkManager>Timeouts>Min Update Timeout = 10 ms
    (4) from a few bytes to about 800 bytes.
    (5) 0 just for these tests, but we do have an alpha test environment with people playing around the world
     
    Last edited: Oct 20, 2015
  33. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    I still want to know exactly what "no free events" means, or how to profile the exact buffers that are filling up. Are any of the following true when "no free events" is written to the logs:

    A. The NetworkTransport layer buffer for outgoing packets that are not yet sent is full, and your code is attempting to add more to it. Your packet(s) will not be sent since they will not fit in the buffer.

    B. The NetworkTransport layer buffer for outgoing reliable packets that have not yet been acknowledged (but may have been sent) by the connection is full, and your code is attempting to add more to it to it. Your packet(s) will not be sent since they will not fit in the buffer.
     
    Last edited: Oct 20, 2015
  34. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    While we can profile our server's outgoing traffic using the Network Messages and Network Operations profilers, we don't seem to have a way to profile/trace the exact origin of full buffers and large packets that are causing our bugs:
    1. How full is the sent message queue on the server? What is it full of? Where did the messages come from (script name, network id, etc.)?
    2. We are also seeing a log that we believe is leading to a critical communication failure regarding a large packet (packets that will not be buffered by the HLAPI for retry if they fail to send), but we don't know how to track down where they bytes came from for this packet, as it seems to not be created by one of our custom OnSerialize methods. How do we track down the amounts each script is filling up each ChannelBuffer, in the case where it is not via our own OnSerialize?
    2015-10-20 12:19:31.122-07:00 [DBG] SendBytes large packet: 1192channel 0
    2015-10-20 12:19:31.127-07:00 [DBG] no free events for message
    2015-10-20 12:19:31.135-07:00 [ERR] Failed to send big message
     
    Last edited: Oct 20, 2015
  35. jason1025

    jason1025

    Joined:
    Nov 11, 2015
    Posts:
    1
    Hello All,

    I'm also encountering the same symptom - 'UNET Client Disconnect Error: Timeout' - even with Unity's Official: 1) Network Lobby Example via Pong and 2) TANKS! Networking Demo, while using Unity 5.2.2f1.

    When I try two computers, while my 2nd computer joins as a 'LAN Client' to my 1st Computer (which is the LAN Host as 192.168.1.76), my 2nd computer does successfully joins (cool :), but then gets kicked out after only a few minutes with a 'UNET Client Disconnect Error: Timeout'. Using the profiler, I found a 300-plus-repeating warning message: 'no free events for message; UnityEngine.Networking.NetworkingIdentity:UNetStaticUpdate()'.

    As a newbie programmer, do I also need to do the following code-patch from aabramychev/chrismarch:

    Code (CSharp):
    base.connectionConfig.IsAcksLong = true; // larger ack buffer, 64 bit
    base.connectionConfig.MaxSentMessageQueueSize = 512;​

    Or should I wait for a newer update for the Unity Engine?

    BTW, I teach High School Computer Science using Game Development, and I look forward in trying out Unity. :)

    Thanks in advance... :) Jason
     
  36. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    For the demos, you don't need to change the configuration for them to work. First, make sure you can run them on just one computer. Then, check that your computers are allowed to listen and connect on the ports that the demos use. You may need to talk to IT, or use ports that are allowed if they can't change them.
     
  37. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    976
    Wandering around from Google, and this thread popped out from the search.

    Has v5.2.3f1 added more room for IsAcksLong = true and MaxSentMessageQueueSize = 512, 1024, or 2048?
     
  38. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    431
    yes, although I haven't tested 2048
     
  39. diego-vieira

    diego-vieira

    Joined:
    Mar 27, 2015
    Posts:
    29
    @chrismarch
    Hello, using your experience, how would you recommend a configuration to a game with 100k networked objects?
     
  40. Deleted User

    Deleted User

    Guest

    @aabramychev it has been 2 years since you've mentioned that streaming might be a consideration for UNET. Will this still be implemented? I too have the requirement to sync a texture to clients after they connected and therefore need to send a large amount of data to them.
     
    augmentedlauri likes this.
unityunity