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

#pragma Dynamic Crashing Server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 02-19-2015 , 12:58   #pragma Dynamic Crashing Server
Reply With Quote #1

So i have this code which is spitting errors in console !

PHP Code:
[AMXXDisplaying debug trace (plugin "test.amxx")
[
AMXXRun time error 3stack error 
[AMXX]    [0level.sma::Event_TeamInfo_All (line 3354
Line 3354 is marked in RED comment in the below code.

PHP Code:
public Event_TeamInfo_All()
{
    new 
id,iTeam 
    id 
read_dataTeamInfo_PlayerID )
    if( !
g_isAlive[id] && g_isConnected[id] )
    { 
        
iTeam get_pdata_int(idm_iTeamXO_PLAYER)      
        if( 
iTeam != get_user_team(id) )  //LINE 3354 
        
{
            
emessage_begin(MSG_BROADCASTgmsgScoreInfo)
            
ewrite_byteid )
            
ewrite_shortget_user_frags(id) )
            
ewrite_shortget_pdata_int(idm_iDeathsXO_PLAYER) )
            
ewrite_short)
            
ewrite_shortiTeam )
            
emessage_end()
        }
    }

So i searched and found it to be associated with memory allocation issues.

Case 1 :
I put #pragma dynamic 32768 .. Crashes the server (No idea why !)

Case 2 :
So alternatively i decided to bring the stack/heap value below the default memory stack (16KB (16384 bytes) in our case) and decreased array / variable sizes and all possible things i could .
SO after i was done .. COmpiled the plugin ..

PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2013 ITB CompuPhaseAMX Mod X Team
Header size
:           4812 bytes
Code size
:           101968 bytes
Data size
:            80944 bytes
Stack
/heap size:      16384 bytesmaxusage is unknowndue to recursion
Total requirements
:  204108 bytes
Done

But the problem still persists .. Same error thrown at the same line .. Any Alternatives or maybe can someone tell me what i am doing wrong ?
Suggestions / Alternatives / Solutions / Possibilities xD Anything will be helpful

Thanks in Advance
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-19-2015 , 14:21   Re: #pragma Dynamic Crashing Server
Reply With Quote #2

PHP Code:
        iTeam get_pdata_int(idm_iTeamXO_PLAYER)      
        if( 
iTeam != get_user_team(id) )  //LINE 3354 
Why you are comparing if player has same team? does not make any sense, its using same as

if(get_user_team(id) != get_user_team(id))

LOL
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 02-19-2015 , 14:48   Re: #pragma Dynamic Crashing Server
Reply With Quote #3

Quote:
Originally Posted by ^SmileY View Post
PHP Code:
        iTeam get_pdata_int(idm_iTeamXO_PLAYER)      
        if( 
iTeam != get_user_team(id) )  //LINE 3354 
Why you are comparing if player has same team? does not make any sense, its using same as

if(get_user_team(id) != get_user_team(id))

LOL
I think this is supposed to be a fix for get_user_team returning false team if player is moved till 1 round after he's moved
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-19-2015 , 17:47   Re: #pragma Dynamic Crashing Server
Reply With Quote #4

Quote:
Originally Posted by aron9forever View Post
I think this is supposed to be a fix for get_user_team returning false team if player is moved till 1 round after he's moved
But this is not working, and their problem is not pragma dynamic

He simple can use get_pdata directly
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 02-19-2015 at 17:56.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 02-20-2015 , 02:02   Re: #pragma Dynamic Crashing Server
Reply With Quote #5

Yes right .. Thats get_user_team fix .. So i had no other choice but to remove the code for now to stop the errors.

But still i dont get the point .. why #Pragma dynamic is crashing the server when it shouldnt even if the heap size require is lesser than default heap (16 KB).

Also WITHOUT #Pragma dynamic the plugin is working perfectly. No errors. No crashes.
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 02-20-2015 , 04:46   Re: #pragma Dynamic Crashing Server
Reply With Quote #6

I run #pragma dynamic 32768 in one of my larger plugins and it works fine
build 5787 , amxx 1.8.1, latest metamod_p

here's a little suggestion: change the heaps to normal, remove pragma, and on line 3354 change "new" to "static"
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 02-20-2015 at 04:47.
aron9forever is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 02-20-2015 , 04:59   Re: #pragma Dynamic Crashing Server
Reply With Quote #7

Quote:
Originally Posted by aron9forever View Post
I run #pragma dynamic 32768 in one of my larger plugins and it works fine
build 5787 , amxx 1.8.1, latest metamod_p

here's a little suggestion: change the heaps to normal, remove pragma, and on line 3354 change "new" to "static"
Thanks for actively suggesting possible solutions

Back to the point..

Havent tried on 5787 .. This crash is occuring on hlds build 6153 , amxx 1.8.2 .. not sure about metamod version as the server isnt mine.

Unfortunately , I already tried changing new to static .. but the errors remained as it is.


Currently, i removed the get_user_team fix code as well as #pragma .. and plugin works fine now.
So until i find the actual fix to this .. i cant put the code back in my plugin..
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then

Last edited by devilicioux; 02-20-2015 at 05:00.
devilicioux is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-20-2015 , 05:20   Re: #pragma Dynamic Crashing Server
Reply With Quote #8

Would be ueful to have a test plugin or whatever the plugin, ready as it is, and giving reproductible steps to crash the server.
__________________
Arkshine is offline
Reply



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 03:35.


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