segmentation fault

Started by Nihongo^, Jul 20, 2023, 08:36 AM

Previous topic - Next topic

Nihongo^

Quote from: habi on Aug 18, 2023, 07:36 AMi have no idea why this is caused. To investigate, we need the reply string from proxycheck.io which when passed to JsonParser is throwing the error.
Did you bypassed their daily limit or something so something different is send back as reply?
The inference is the string may not be in the format preferred by JsonParser.
Try to print the string like this
foreach(s in str)stdout.writen(s, 'c'); in line 190.
Well maybe this error was unexpected, i mean now it doesn't show any bug and server showed "segmentation fault" and turned off
its only happen when 5 6 people joined the server at a time

habi

#46
I understand it is occuring when 3-4 players join the server. So it must have something to do with onPlayerJoin function also. Post your onPlayerJoin function.

Nihongo^

I understand it is occuring when 3-4 players join the serverYes only when they keep join in a row
here's my function
function onPlayerJoin( player )
{
status[ player.ID ] = Playerstats();
chat[player.ID] = ChatClass()
CheckProxy(player.IP);
CheckTempBan(player);
CheckBan(player.ID);
local nickcheck = IsNum(player.Name)
    if (nickcheck) {
       ServerMessage("[#FF0000]** Auto Kick[#FFFFFF] [ " +player.Name+" ][#FF0000] Reason: [#FFFFFF][Invalid nick numbers not allowed Connect with proper nick ]");
       EchoMessage("** Auto Kick [ " +player.Name+" ] Reason: [ Invalid nick numbers not allowed Connect with proper nick ]");
        KickPlayer( player );
    }
  player.Angle = -12.90654;
 
AddAlias( player );
local country = geoip_country_name_by_addr(player.IP);
if (country != null) // the plugin returned a meaningful result
ServerMessage("[#FFFFFF][ " +player.Name+" ] is connecting from [ " + country + " ] ["+ geoip_country_code_by_addr(player.IP) + "]");
EchoMessage("* [ " + player.Name + " ] is connecting from [ " + country + " ]. [" + geoip_country_code_by_addr(player.IP) + "]");

PlayerInfo(player);
GetSpawnWepData(player);

status[ player.ID ].Timeplayed = time();

   local q = QuerySQL(db, "SELECT Name,Warn FROM Warn WHERE Name='"+player.Name+"'");
if (GetSQLColumnData(q,0) == null)
{
QuerySQL(db, "INSERT INTO Warn (Name, Warn) VALUES ('"+player.Name+"', '0')");}
if (GetSQLColumnData(q,0) == player.Name)
{
QuerySQL(db, "UPDATE Warn SET Warn='0' WHERE Name='" + player.Name + "'");}
FreeSQLQuery( q );
}

habi

Here are a few suggestions:
1. Add a return statement after KickPlayer(player);
KickPlayer( player );
return;
Because after kicking player, do not use player.ID, player.Name, etc etc


Add a print statement 'before and after' in onPlayerJoin.
function onPlayerJoin(player)
{
 print("onPlayerJoin for player"+player.Name+" called");
...
 //here all codes
...
 print("onPlayerJoin completed");
}

Now please join 4-5 players and show us the result of console.(you can copy paste them in '['code']'