Issue with Linux (Debian) server
#1

I've recently bought a VPS for recreational activities and I wanted to set up a SA:MP server so I could test things on it. The OS is 64 bits Debian v7 (Wheezy) and the server starts correctly and all of the plugins are successful in loading. But, when a player types a command I have it logged to a massive log file. Therefor, when the player types the command, the server crashes.

I have tested this on my local windows machine, and it works properly.

I was getting:
Код:
samp03svr: amx/amxfile.c:222: fputs_cell:
Assertion `fp!=((void *)0)' failed.
But then I installed crashdetect.so and now this is the full error log when a player types a command.

Код:
[14:50:59] [debug] Server crashed while executing RP.amx
[14:50:59] [debug] AMX backtrace:
[14:50:59] [debug] #0 native fwrite () from samp03svr
[14:50:59] [debug] #1 00014f88 in ?? (0, 40588, -1) from RP.amx
[14:50:59] [debug] #2 000112ec in public OnPlayerCommandReceived (0, 4440936) from RP.amx
[14:50:59] [debug] #3 native CallLocalFunction () from samp03svr
[14:50:59] [debug] #4 00005b80 in public OnPlayerCommandText (0, 4440912) from RP.amx
[14:50:59] [debug] Native backtrace:
[14:50:59] [debug] #0 f7483e8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[14:50:59] [debug] #1 f747cbcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[14:50:59] [debug] #2 f747ddbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[14:50:59] [debug] #3 f747e226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[14:50:59] [debug] #4 f7483adc in ?? () from plugins/crashdetect.so
[14:50:59] [debug] #5 f7769420 in ?? ()
[14:50:59] [debug] #6 f7769440 in ?? ()
[14:50:59] [debug] #7 f74d26c1 in gsignal () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[14:50:59] [debug] #8 f74d5af2 in abort () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[14:50:59] [debug] #9 f74cb878 in __assert_fail () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[14:50:59] [debug] #10 0809b99c in ?? () from ./samp03svr
[14:50:59] [debug] #11 0809bdff in ?? () from ./samp03svr
[14:50:59] [debug] #12 080950e4 in ?? () from ./samp03svr
[14:50:59] [debug] #13 f747f94b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[14:50:59] [debug] #14 f74828f8 in ?? () from plugins/crashdetect.so
[14:50:59] [debug] #15 f7486916 in amx_Exec () from plugins/crashdetect.so
[14:50:59] [debug] #16 f747ebe6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[14:50:59] [debug] #17 f7482659 in ?? () from plugins/crashdetect.so
[14:50:59] [debug] #18 f73c625c in ?? () from plugins/streamer.so
[14:50:59] [debug] #19 080dfd62 in ?? () from ./samp03svr
[14:50:59] [debug] #20 080950e4 in ?? () from ./samp03svr
[14:50:59] [debug] #21 f747f94b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[14:50:59] [debug] #22 f74828f8 in ?? () from plugins/crashdetect.so
[14:50:59] [debug] #23 f7486916 in amx_Exec () from plugins/crashdetect.so
[14:50:59] [debug] #24 f747ebe6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[14:50:59] [debug] #25 f7482659 in ?? () from plugins/crashdetect.so
[14:50:59] [debug] #26 f73c625c in ?? () from plugins/streamer.so
[14:50:59] [debug] #27 080a5632 in ?? () from ./samp03svr
[14:50:59] [debug] #28 080b1751 in ?? () from ./samp03svr
[14:50:59] [debug] #29 08071d38 in ?? () from ./samp03svr
[14:50:59] [debug] #30 08071e32 in ?? () from ./samp03svr
[14:50:59] [debug] #31 0807bc50 in ?? () from ./samp03svr
[14:50:59] [debug] #32 080aed3d in ?? () from ./samp03svr
[14:50:59] [debug] #33 080aef02 in ?? () from ./samp03svr
[14:50:59] [debug] #34 080aa13a in ?? () from ./samp03svr
[14:50:59] [debug] #35 f74bee46 in __libc_start_main () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[14:50:59] [debug] #36 0804b4e1 in ?? () from ./samp03svr
Yes I have chmodded my entire SA:MP directory to 777, that is not the issue. And as I said, the issue is most likely with logging as the server works fine up until the point where the commands are logged.

Here are the two callbacks mentioned in the error log:

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    return 
0;
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    Array[
0] = 0;
    
format(Array, sizeof(Array), "[command text] [%s] %s"GetName(playerid), cmdtext);
    
printf("%s", Array);
    
Log(0, Array);
    
DeletePVar(playerid"LastTyped");
    return 
1;

Any ideas?
Reply
#2

Show us the Log function, something is wrong with fwrite.
Reply
#3

https://dracoblue.net/dev/amxamxfile...-in-fputscell/
Reply
#4

Quote:
Originally Posted by BornHuman
Посмотреть сообщение
Yes I have chmodded my entire SA:MP directory to 777, that is not the issue.
But it is a terribly bad idea. Besides, if the file exists in the folder but the server does not have permission to write in it then it can still be the issue. Execute these commands in the main server directory, as the user that you run the server with (hopefully not root!):

Код:
whoami
Код:
ls -la
Код:
ls -la scriptfiles
Post results.
Reply
#5

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
Show us the Log function, something is wrong with fwrite.
PHP код:
Log(typestring[], group = -1)
{
    new 
File:logfilelogstring[300];
    
format(logstringsizeof(logstring), "[%s] %s\r\n"GetDateFormat(gettime(), 2), string);
    switch(
type)
    {
        case 
0// Server
        
{
            
logfile fopen("Logs/Server.log"io_append);
            
fwrite(logfilelogstring);
            
fclose(logfile);
        }
         }

Like I said, this works on windows.

-------------------------

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Quote:
Originally Posted by BornHuman
Посмотреть сообщение
Yes I have chmodded my entire SA:MP directory to 777, that is not the issue.
-------------------------

Quote:
Originally Posted by Vince
Посмотреть сообщение
But it is a terribly bad idea. Besides, if the file exists in the folder but the server does not have permission to write in it then it can still be the issue. Execute these commands in the main server directory:

Код:
whoami
Код:
ls -la
Код:
ls -la scriptfiles
Post results.
PHP код:
root@---:~/SAMP# whoami
root
root
@---:~/SAMP# ls -la
total 4376
drwxrwxrwx 6 root root    4096 Jun 29 14
:47 .
drwxrwxrwx 6 root root    4096 Jun 27 01:26 ..
-
rwxrwxrwx 1 root root   10936 Jan 24  2015 announce
drwxrwxrwx 2 root root    4096 Jun 24 02
:55 filterscripts
drwxrwxrwx 2 root root    4096 Jun 24 03
:12 gamemodes
-rwxrwxrwx 1 root root 2387912 Jun 19  2010 libmysqlclient.so.15
-rwxrwxrwx 1 root root    3777 Aug  9  2010 LICENSE
drwxrwxrwx 2 root root    4096 Jun 29 14
:40 plugins
-rwxrwxrwx 1 root root 1416792 Jul 14  2015 samp03svr
-rwxrwxrwx 1 root root  591652 Jul 11  2015 samp-npc
drwxrwxrwx 3 root root    4096 Jun 29 14
:20 scriptfiles
-rwxrwxrwx 1 root root     393 Jun 29 14:42 server.cfg
-rwxrwxrwx 1 root root     309 Jun 24 03:42 server.cfg.save
-rwxrwxrwx 1 root root   18987 Jun 29 14:59 server_log.txt
root
@---:~/SAMP# ls -la scriptfiles
total 12
drwxrwxrwx 3 root root 4096 Jun 29 14
:20 .
drwxrwxrwx 6 root root 4096 Jun 29 14:47 ..
drwxrwxrwx 2 root root 4096 Jun 29 14:20 Logs 
Reply
#6

Aw man, running as root.

Do the same for the scriptfiles/Logs directory, please. I need to see the permissions on the actual file itself.
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
Aw man, running as root.

Do the same for the scriptfiles/Logs directory, please. I need to see the permissions on the actual file itself.
This server is private meaning I never intend to open it to the public. I do not care about the security or efficiency of these methods for this project. In the event I did (which will never happen), I know the correct security measures to take on linux to run all programs on a user-base level.

PHP код:
root@---:~/SAMP/scriptfiles# ls -la Logs
total 68
drwxrwxrwx 2 root root  4096 Jun 29 14
:20 .
drwxrwxrwx 3 root root  4096 Jun 29 15:24 ..
-
rwxrwxrwx 1 root root  2450 Jun 29 14:20 Admin.log
-rwxrwxrwx 1 root root  1023 Jun 29 14:20 EditGroup.log
-rwxrwxrwx 1 root root    50 Jun 29 14:20 Group.log
-rwxrwxrwx 1 root root   498 Jun 29 14:20 HeadAdmin.log
-rwxrwxrwx 1 root root  1154 Jun 29 14:20 JobEdit.log
-rwxrwxrwx 1 root root 30156 Jun 29 15:27 Server.log 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)