Raised This Month: $12 Target: $400
 3% 

Overflow scenario?


Post New Thread Reply   
 
Thread Tools Display Modes
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-22-2016 , 14:17   Re: Overflow scenario?
Reply With Quote #21

Because it is a known issue in the engine which causes overflow in some circumstances, for example this
__________________
Depresie is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 07-22-2016 , 14:32   Re: Overflow scenario?
Reply With Quote #22

Quote:
Originally Posted by Depresie View Post
Because it is a known issue in the engine which causes overflow in some circumstances, for example this
Well, i don't know about with.
Wich circumstances?
For example what?

Be more descriptive please.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 07-22-2016 , 14:48   Re: Overflow scenario?
Reply With Quote #23

Quote:
Originally Posted by Depresie View Post
Would something like this work to avoid overflow?

PHP Code:
public HandleTeams()
{
    new 
iPlayers[32] , iNum Player;
    
get_playersiPlayers iNum "h" );
    
    for ( new 
iNum i++ )
    {    
        
Player iPlayers[i];
      
        
set_task( (0.05 i), "JoinGame"Player)
    }
}

public 
JoinGame(id)
{
    if(!
is_user_connected(id)) 
        return;
    
    
engclient_cmd(id"jointeam""5")
    
engclient_cmd(id"joinclass","5")

I just want to keep them unasigned after map change, i managed to do that

Then after 30 seconds i want the server to automatically assign them to CT/T teams at the same time without causing overflow ( cs_set_user_team won't work here because as stated by arkshine the players must have their teams and classes selected before using it on them)

All i want is an answer to the question above, if i send them to teams with a delay of 0.05 between each player, using set_task, will it avoid overflowing?
Yes, it is a must to work. But may you have to find which is the minimum delay to use.

I think that something like '0.5' seconds is fine. But may be not.
If not, use a higher value than '0.5' seconds as '0.75' seconds.
If yes, you can try use a lower value than '0.5' seconds, to the things ready faster.

If I test it right when developing my plugin, '0.5' seconds does not cause overflow for ~10 console lines printed every '0.5' seconds. But on that time, I think I was not looking for a minimum time:
https://github.com/addonszz/Multi-Mod_Manager/blob/59973f43f43b2443ba2b51f0bfbcdbedeaeaa63b/scripting/multimod_manager.sma#L463

You can try with 'print_chat' to find the minimum value for the task to not cause overflow.

However, on your case it must not to trigger the overflow bug, as already said by fysiks.
Because you are sending it to different clients (not the same client).
Quote:
Originally Posted by fysiks View Post
It will be as if the player is sending those two command really really fast.
Overflow example:
Code:
stock kickALuckyGuyByOverflow( luckyGuyId ) {     for( new index = 0; index < 1000; ++index )     {         client_print( luckyGuyId, print_chat, "Hi friend, you will be kicked by the overflow!" );     } }


Update:

What could may be cause an overflow, is sending these 2 commands at once to the same player:
Code:
    engclient_cmd(id, "jointeam", "5")     engclient_cmd(id, "joinclass","5")
But I doubt that, to know it for sure, just enter on you server and do it with yourself, if it not overflow you (kick you), it is fine.


Update2:

Do not do it accumulative/increasing as you are doing it:
Code:
set_task( (0.05 * i), "JoinGame", Player)
It should be the same time/period/equal interval as '0.5' seconds.
To accomplish that, you can use a recursive function, that call itself using the 'set_tast' with the same interval as '0.5' seconds.
Example: (I was not much inspired when I wrote this, I kind do not like how it is today)
Code:
/** * Recursive function call, by the set task to avoid overflowing the client. */
public printHelp( player_id )
{     new formatted_string[32];         player_id = player_id - TASKIS_PRINT_HELP         new current_print_page_total      = g_current_print_page[ player_id ] * LINES_PER_PAGE     g_current_print_page[ player_id ] = g_current_print_page[ player_id ] + 1         // print the page header (creates a recursive call),     // there are not much 'g_cmdsAvailables' them I am not splitting it on multiple recursive call to print them     if( !current_print_page_total )     {         for( new i = 0; i < sizeof( g_cmdsAvailables ); i++ )         {             client_print( player_id, print_console, g_cmdsAvailables[ i ] )         }        
        set_task( 1.0, "printHelp", player_id + TASKIS_PRINT_HELP )
        return     }         // print the page body, until all the pages being printed. (creates a recursive call)     if( current_print_page_total - LINES_PER_PAGE < g_modCounter )     {         new internal_current_page_limit = 0                 new menu_page_total_int = g_modCounter / LINES_PER_PAGE         new menu_page_total     = floatround( float( g_modCounter ) / float( LINES_PER_PAGE ), floatround_ceil )                 if( g_modCounter < LINES_PER_PAGE + 3 )         {             menu_page_total_int = 1             menu_page_total     = 1         }                 client_print( player_id, print_console, "^nPrinting Page: %d of %d",                 g_current_print_page[ player_id ] - 1,                 ( g_modCounter % LINES_PER_PAGE < 2 ) ? menu_page_total_int : menu_page_total )                 for( new i = 3 + current_print_page_total - LINES_PER_PAGE; i <= g_modCounter; i++ )         {             ArrayGetString( g_mod_names, i, g_mod_name_temp, charsmax( g_mod_name_temp ) )             ArrayGetString( g_mod_shortNames, i, g_mod_short_name_temp, charsmax( g_mod_short_name_temp ) )                         formatex( formatted_string, charsmax( formatted_string ), "%s 1", g_mod_short_name_temp )                         client_print( player_id, print_console, "amx_setmod %-22s| to use %s", formatted_string,                     g_mod_name_temp )                         if( internal_current_page_limit++ >= ( LINES_PER_PAGE - 1 )                 && i < g_modCounter )             {
                set_task( 0.5, "printHelp", player_id + TASKIS_PRINT_HELP )
                break             }         }     }         // Resets the pages as we finished printing them     if( current_print_page_total > g_modCounter )     {         g_current_print_page[ player_id ] = 0     } }
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 07-22-2016 at 18:22. Reason: misspellings
addons_zz is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-22-2016 , 15:41   Re: Overflow scenario?
Reply With Quote #24

I used something like this

PHP Code:
switch(id)
case 
1..8 -> set_task 0.2
case 9..16 -> set_task 0.4
etc 
JoinTeam and JoinClass are working fine btw
Well, i will see more later when i'll get the work done and get it running with a full server
__________________
Depresie is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-22-2016 , 16:37   Re: Overflow scenario?
Reply With Quote #25

Use NBEX/ReHLDS(better) and forget about reliable channel overflows. Method with delay is not convenient and can be buggy.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-22-2016 , 17:16   Re: Overflow scenario?
Reply With Quote #26

Quote:
Originally Posted by PRoSToTeM@ View Post
Use NBEX/ReHLDS(better) and forget about reliable channel overflows. Method with delay is not convenient and can be buggy.
You can't just forget about it. You are basically implying that he can bombard clients with network messages after he installs NBEX. There's still a limitation on the client, and while you extend the buffer a bit, it's still not infinite in size.

You have to wait 1/sv_minupdaterate seconds before each update for the best result.
klippy is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-22-2016 , 17:24   Re: Overflow scenario?
Reply With Quote #27

Quote:
Originally Posted by KliPPy View Post
You can't just forget about it. You are basically implying that he can bombard clients with network messages after he installs NBEX. There's still a limitation on the client, and while you extend the buffer a bit, it's still not infinite in size.
Default reliable channel limit is 4kb, but it can be extended to 64kb (64/4 = 16 times!!!). Client limit is 64kb.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode