17.03.2012, 03:36
It's making me crazy...
how is possible fwrite to make a server crash?
Oh, ok. I know fopen in io_read method can do this, bug... fwrite? how??
And even when the same code happens a lot of times, it works 99% of them, and 1% it makes server crash, WTF!? o.O
look at this code:
Log:
Other exemple (that is the only one that get something not null on ext[]="...":
a lot of other exemples if someone want:
I tought that it could be some "forbidden" char, so I did:
but nothing about crash, just a crazy sound and the server stopped responding (and I had to press ctrl+alt+del, but it didnt crash)
how is possible fwrite to make a server crash?
Oh, ok. I know fopen in io_read method can do this, bug... fwrite? how??
And even when the same code happens a lot of times, it works 99% of them, and 1% it makes server crash, WTF!? o.O
look at this code:
PHP код:
stock WriteLog(filename[],text[])
{
printf("%s => %s", filename, text);
new File:file;
new filepath[60], string[256], year,day,month, hour,minute,second;
getdate(year,month,day); gettime(hour,minute,second);
format(filepath,sizeof(filepath),"RPG/logs/%s.log",filename);
file = fopen(filepath,io_append);
format(string,sizeof(string),"[%02d/%02d/%d|%02d:%02d:%02d] %s\r\n",day,month,year,hour,minute,second,text);
fwrite(file,string);
fclose(file);
return 1;
}
#define FormatLog(%1,%2,%3) do{new _string[128]; format(_string,sizeof(_string),%2,%3); WriteLog(%1, _string);} while(False)
public ABroadCast(color,const string[],level)
{
FormatLog("abroadcast", "%s", string);
foreach(Player, i)
if(Admins[Player[i][pAdminID]][aLevel] >= level || Player[i][pEnigma] > 0)
SendClientMessage(i, color, string);
return 1;
}
Quote:
[14/03/12 22:18:11] abroadcast => [RELATOS] Cesar_Medeiros (id: 5) relatou: como ganha cash? [14/03/12 22:18:11] [debug] Server crashed while executing BSL2.amx [14/03/12 22:18:11] [debug] Backtrace (most recent call first): [14/03/12 22:18:11] [debug] #0 ?? in native fwrite () from samp-server.exe [14/03/12 22:18:12] [debug] #1 00138d58 in WriteLog (filename[]=@0x00362b58 "abroadcast", text[]=@0x0049c624 "") at C:\xxxx\gamemodes\BSL2.pwn:24724 [14/03/12 22:18:12] [debug] #2 000a49fc in public ABroadCast (color=3550040, string[]=@0x0049c624 "", level=91) at C:\xxxx\gamemodes\BSL2.pwn:16096 [14/03/12 22:18:12] [debug] #3 001cfe84 in dcmd_relato (playerid=3550040, params[]=@0x0049c624 "") at C:\xxxx\gamemodes\BSL2.pwn:38799 [14/03/12 22:18:12] [debug] #4 0011244c in dcmd_relatorio (playerid=3550040, params[]=@0x0049c624 "") at C:\xxxx\gamemodes\BSL2.pwn:21229 [14/03/12 22:18:12] [debug] #5 001024f8 in public OnPlayerCommandText (playerid=3550040, cmdtext[]=@0x0049c624 "") at C:\xxxx\gamemodes\BSL2.pwn:21017 |
Other exemple (that is the only one that get something not null on ext[]="...":
Quote:
[15/03/12 23:37:39] sms => [SMS] lug_Lucas: pilantra eh a mгe, atirei no teu amigo porque ele atirou em mim |Danrley_FC(Tel:11535) [15/03/12 23:37:39] [debug] Server crashed while executing BSL2.amx [15/03/12 23:37:39] [debug] Backtrace (most recent call first): [15/03/12 23:37:39] [debug] #0 ?? in native fwrite () from samp-server.exe [15/03/12 23:37:39] [debug] #1 00138d58 in WriteLog (filename[]=@0x003de4b4 "sms", text[]=@0x00080ca4 "[SMS] lug_Lucas: pilantra eh a...") at C:\xxxx\gamemodes\BSL2.pwn:24724 [15/03/12 23:37:39] [debug] #2 0017d058 in dcmd_sms (playerid=4056244, params[]=@0x00080ca4 "[SMS] lug_Lucas: pilantra eh a...") at C:\xxxx\gamemodes\BSL2.pwn:31094 [15/03/12 23:37:39] [debug] #3 000e6758 in public OnPlayerCommandText (playerid=4056244, cmdtext[]=@0x00080ca4 "[SMS] lug_Lucas: pilantra eh a...") at C:\xxxx\gamemodes\BSL2.pwn:20700 |
a lot of other exemples if someone want:
PHP код:
[14/03/12 22:19:42] connections => matador2000 conectou no servidor. (id: 24 - IP: 189.182.98.225)
[14/03/12 22:19:42] [debug] Server crashed while executing BSL2.amx
[14/03/12 22:19:42] [debug] Backtrace (most recent call first):
[14/03/12 22:19:42] [debug] #0 ???????? in native fwrite () from samp-server.exe
[14/03/12 22:19:42] [debug] #1 00138d58 in WriteLog (filename[]=@0x0034b610 "connections", text[]=@0x0049c3c8 "") at C:\xxxx\gamemodes\BSL2.pwn:24724
[14/03/12 22:19:42] [debug] #2 0005f198 in public Itter_OnPlayerConnect (playerid=3454480) at C:\xxxx\gamemodes\BSL2.pwn:10185
[14/03/12 22:19:42] [debug] #3 ???????? in native CallLocalFunction () from samp-server.exe
[14/03/12 22:19:42] [debug] #4 000067b0 in public Streamer_OnPlayerConnect (playerid=3454480) at C:\sampserver\pawno\include\foreach.inc:479
[14/03/12 22:19:42] [debug] #5 ???????? in native CallLocalFunction () from samp-server.exe
[14/03/12 22:19:42] [debug] #6 000061d8 in public OnPlayerConnect (playerid=3454480) at C:\sampserver\pawno\include\streamer.inc:299
[14/03/12 22:20:24] connections => Jhon_Cena conectou no servidor. (id: 0 - IP: 187.19.237.172)
[14/03/12 22:20:24] [debug] Server crashed while executing BSL2.amx
[14/03/12 22:20:24] [debug] Backtrace (most recent call first):
[14/03/12 22:20:24] [debug] #0 ???????? in native fwrite () from samp-server.exe
[14/03/12 22:20:24] [debug] #1 00138d58 in WriteLog (filename[]=@0x0034b610 "connections", text[]=@0x0049c3c8 "") at C:\xxxx\gamemodes\BSL2.pwn:24724
[14/03/12 22:20:24] [debug] #2 0005f198 in public Itter_OnPlayerConnect (playerid=3454480) at C:\xxxx\gamemodes\BSL2.pwn:10185
[14/03/12 22:20:24] [debug] #3 ???????? in native CallLocalFunction () from samp-server.exe
[14/03/12 22:20:24] [debug] #4 000067b0 in public Streamer_OnPlayerConnect (playerid=3454480) at C:\sampserver\pawno\include\foreach.inc:479
[14/03/12 22:20:24] [debug] #5 ???????? in native CallLocalFunction () from samp-server.exe
[14/03/12 22:20:24] [debug] #6 000061d8 in public OnPlayerConnect (playerid=3454480) at C:\sampserver\pawno\include\streamer.inc:299
[14/03/12 22:21:02] connections => John_White conectou no servidor. (id: 0 - IP: 187.75.64.149)
[14/03/12 22:21:02] [debug] Server crashed while executing BSL2.amx
[14/03/12 22:21:02] [debug] Backtrace (most recent call first):
[14/03/12 22:21:02] [debug] #0 ???????? in native fwrite () from samp-server.exe
[14/03/12 22:21:02] [debug] #1 00138d58 in WriteLog (filename[]=@0x0034b610 "connections", text[]=@0x0049c3c8 "") at C:\xxxx\gamemodes\BSL2.pwn:24724
[14/03/12 22:21:02] [debug] #2 0005f198 in public Itter_OnPlayerConnect (playerid=3454480) at C:\xxxx\gamemodes\BSL2.pwn:10185
[14/03/12 22:21:02] [debug] #3 ???????? in native CallLocalFunction () from samp-server.exe
[14/03/12 22:21:02] [debug] #4 000067b0 in public Streamer_OnPlayerConnect (playerid=3454480) at C:\sampserver\pawno\include\foreach.inc:479
[14/03/12 22:21:02] [debug] #5 ???????? in native CallLocalFunction () from samp-server.exe
[14/03/12 22:21:02] [debug] #6 000061d8 in public OnPlayerConnect (playerid=3454480) at C:\sampserver\pawno\include\streamer.inc:299
[14/03/12 22:22:05] Radio => (Radio) Capitгo QRA_Luke: Amr eu vou sair, cвmbio.
[14/03/12 22:22:05] [debug] Server crashed while executing BSL2.amx
[14/03/12 22:22:05] [debug] Backtrace (most recent call first):
[14/03/12 22:22:05] [debug] #0 ???????? in native fwrite () from samp-server.exe
[14/03/12 22:22:05] [debug] #1 00138d58 in WriteLog (filename[]=@0x0045e3b4 "Radio", text[]=@0x0049c638 "") at C:\xxxx\gamemodes\BSL2.pwn:24724
[14/03/12 22:22:05] [debug] #2 00223c60 in dcmd_radio (playerid=4580276, params[]=@0x0049c638 "") at C:\xxxx\gamemodes\BSL2.pwn:45548
[14/03/12 22:22:05] [debug] #3 00223980 in dcmd_r (playerid=4580276, params[]=@0x0049c638 "") at C:\xxxx\gamemodes\BSL2.pwn:45529
[14/03/12 22:22:05] [debug] #4 000e2dd8 in public OnPlayerCommandText (playerid=4580276, cmdtext[]=@0x0049c638 "") at C:\xxxx\gamemodes\BSL2.pwn:20658
[14/03/12 22:23:28] Radio => (Radio) Iniciante OTAK_ADVANCED: AQUI O SERV TA PESSIMO, cвmbio.
[14/03/12 22:23:28] [debug] Server crashed while executing BSL2.amx
[14/03/12 22:23:28] [debug] Backtrace (most recent call first):
[14/03/12 22:23:28] [debug] #0 ???????? in native fwrite () from samp-server.exe
[14/03/12 22:23:28] [debug] #1 00138d58 in WriteLog (filename[]=@0x0045e3b4 "Radio", text[]=@0x0049c64c "") at C:\xxxx\gamemodes\BSL2.pwn:24724
[14/03/12 22:23:28] [debug] #2 00223c60 in dcmd_radio (playerid=4580276, params[]=@0x0049c64c "") at C:\xxxx\gamemodes\BSL2.pwn:45548
[14/03/12 22:23:28] [debug] #3 000f0578 in public OnPlayerCommandText (playerid=4580276, cmdtext[]=@0x0049c64c "") at C:\xxxx\gamemodes\BSL2.pwn:20813
I tought that it could be some "forbidden" char, so I did:
Код:
#include <a_samp> public OnGameModeInit() { new string[300]; for(new i = 0; i < 3000; i++) { printf("i = %d", i); format(string,sizeof(string),"%s",i); WriteLog("aaaaa",string); } return 1; } stock WriteLog(filename[],text[]) { printf("%s => %s", filename, text); new File:file; new filepath[60], string[256], year,day,month, hour,minute,second; getdate(year,month,day); gettime(hour,minute,second); format(filepath,sizeof(filepath),"%s.log",filename); file = fopen(filepath,io_append); format(string,sizeof(string),"[%02d/%02d/%d|%02d:%02d:%02d] %s\r\n",day,month,year,hour,minute,second,text); fwrite(file,string); fclose(file); return 1; }