Pottus / Texture-Studio

86 stars 90 forks source link

Server Crash With Two Players #109

Closed erfanasbari closed 4 years ago

erfanasbari commented 4 years ago

Hi, I Have Same Problem That Is Posted In This Link

I Tested It On Two Different VPS And Recompile It Multiple Times And It Still Crashes With Two Players.

I Test It A Little Bit More And I Realized That When Player 1 Enters The Server And Write Some Command Player 2 Cannot Write Any Commands And He Has To Wait Until Player 1 In Done And Then Restart The Server. This Way Server Won't Crash.

When Player 1 Is Working If Player 2 Write A Command Even If It's Not Defined The Server Will Crash 99% When Player 1 Write A Command After Player 2.

And The Crash Always Happen When OnPlayerCommandText Is Called. My English Is Not Good I Hope You Understand. And Thank You For Developing This Useful FS <3

This Is The Crash Detect Plugin Log:

23:49:15] [debug] Server crashed while executing tstudio.amx [23:49:15] [debug] AMX backtrace: [23:49:15] [debug] #0 native format () from samp-server.exe [23:49:15] [debug] #1 00008cc4 in ?? (22217208, 128, 22320256, 1968374260) from tstudio.amx [23:49:15] [debug] #2 00037be0 in ?? (1, 47044248) from tstudio.amx [23:49:15] [debug] #3 000203e8 in public OnPlayerCommandText (1, 47044248) from tstudio.amx [23:49:16] [debug] Native backtrace: [23:49:16] [debug] #0 0046cff0 in ?? () from samp-server.exe [23:49:16] [debug] #1 0046f992 in ?? () from samp-server.exe [23:49:16] [debug] #2 6aa5d60a in ?? () from plugins\crashdetect.DLL [23:49:16] [debug] #3 6aa64078 in ?? () from plugins\crashdetect.DLL [23:49:16] [debug] #4 6aa5a767 in ?? () from plugins\crashdetect.DLL [23:49:16] [debug] #5 6aa5d65a in ?? () from plugins\crashdetect.DLL [23:49:16] [debug] #6 0046b168 in ?? () from samp-server.exe [23:49:16] [debug] #7 00492a21 in ?? () from samp-server.exe [23:49:16] [debug] #8 02cdd698 in ?? () [23:49:16] [debug] #9 4f5fb8a1 in ?? () from samp-server.exe [23:49:16] [debug] Registers: [23:49:16] [debug] EAX: 00000000 EBX: 0019f660 ECX: 004f4f80 EDX: ffffffff [23:49:16] [debug] ESI: 7aaaa238 EDI: 00000004 EBP: 3075c085 ESP: 00492a29 [23:49:16] [debug] EIP: 4f5fb8a1 EFLAGS: 00010286 [23:49:16] [debug] Stack: [23:49:16] [debug] ESP+00000000: 85088b00 8d2574c9 52182454 b245e853 [23:49:16] [debug] ESP+00000020: 5056ff6a ffd88ee8 10c483ff 18248c8d [23:49:16] [debug] ESP+00000040: 8bfffbaf 0234248c 5e5f0000 000d8964 [23:49:16] [debug] ESP+00000060: cccccccc 6acccccc b2eb68ff a164004a [23:49:16] [debug] ESP+00000080: 848b0000 00013c24 56555300 5708c083 [23:49:16] [debug] ESP+000000a0: e81c245c fffbadcf 5fb80d8b 718b004f [23:49:16] [debug] ESP+000000c0: 4c2484c7 00000001 66000000 ff045889 [23:49:16] [debug] ESP+000000e0: 00016484 b0bde800 8166ffff 8b03e8fb [23:49:16] [debug] ESP+00000100: 0fc08500 00014084 ce8b5300 fd3606e8 [23:49:16] [debug] ESP+00000120: c82bcd8b 07d0f981 8c0f0000 00000119 [23:49:16] [debug] ESP+00000140: 244489c0 a98c0f14 33000000 8d08ebff [23:49:16] [debug] ESP+00000160: 8c8b0000 0249fcbe 74c98500 6a016a7b [23:49:16] [debug] ESP+00000180: 8bfffbb3 0facbe84 016a0000 4c8d206a [23:49:16] [debug] ESP+000001a0: 5d040d8b 198b0051 24548d57 93ff5226 [23:49:16] [debug] ESP+000001c0: 41896611 040d8b04 ff00515d 016a4c53 [23:49:16] [debug] ESP+000001e0: fffbb333 1424448b fdb70f45 8e0ff83b [23:49:16] [debug] ESP+00000200: 24448d10 4c8d501c 54893424 04e82024 [23:49:16] [debug] ESP+00000220: 83006a00 c48b08ec 3089006a 24748b66 [23:49:16] [debug] ESP+00000240: ff004b9e 00008092 244c8d00 2484c728 [23:49:16] [debug] ESP+00000260: 0000013c 645d5e5f 00000d89 815b0000 [23:49:16] [debug] ESP+00000280: 68ff6a04 004ab2eb 25896450 00000000 [23:49:16] [debug] ESP+000002a0: d1840f57 85000000 c9840fc0 99000000 [23:49:16] [debug] ESP+000002c0: 40006a03 4c8d5650 38e82024 6afffbac [23:49:16] [debug] ESP+000002e0: 00000001 e8000000 fffbad5b 5fb80d8b [23:49:16] [debug] ESP+00000300: 3889c48b 04588966 00e492ff 3d660000 [23:49:16] [debug] ESP+00000320: b8a14274 8b004f5f 8bc98508 b48b0468 [23:49:16] [debug] ESP+00000340: 2c408689 08740000 e8575053 fffdb297 [23:49:16] [debug] ESP+00000360: fffd8693 14244c8d 302484c7 ff000001 [23:49:16] [debug] ESP+00000380: 89645d5e 0000000d c4815b00 00000124 [23:49:16] [debug] ESP+000003a0: 68ff6a04 004ab2b6 25896450 00000000 [23:49:16] [debug] ESP+000003c0: 00fc840f c0850000 00f4840f 83990000 [23:49:16] [debug] ESP+000003e0: 5040006a 244c8d55 ab19e820 8c8dfffb [23:49:16] [debug] Loaded modules: [23:49:16] [debug] 00400000 - 00519000 samp-server.exe [23:49:16] [debug] 77880000 - 77a0c000 ntdll.dll [23:49:16] [debug] 77100000 - 771d0000 KERNEL32.DLL [23:49:16] [debug] 75f70000 - 76148000 KERNELBASE.dll [23:49:16] [debug] 74370000 - 756a9000 SHELL32.dll [23:49:16] [debug] 76930000 - 769ed000 msvcrt.dll [23:49:16] [debug] 774a0000 - 774d8000 cfgmgr32.dll [23:49:16] [debug] 76810000 - 76926000 ucrtbase.dll [23:49:16] [debug] 76c30000 - 76cb8000 shcore.dll [23:49:16] [debug] 773d0000 - 7748e000 RPCRT4.dll [23:49:16] [debug] 742a0000 - 742c0000 SspiCli.dll [23:49:16] [debug] 74290000 - 7429a000 CRYPTBASE.dll [23:49:16] [debug] 775b0000 - 77607000 bcryptPrimitives.dll [23:49:16] [debug] 74320000 - 74363000 sechost.dll [23:49:16] [debug] 76d60000 - 76fa5000 combase.dll [23:49:16] [debug] 758c0000 - 75e87000 windows.storage.dll [23:49:16] [debug] 77500000 - 77578000 advapi32.dll [23:49:16] [debug] 767c0000 - 76805000 shlwapi.dll [23:49:16] [debug] 77580000 - 775a2000 GDI32.dll [23:49:16] [debug] 761c0000 - 7631e000 gdi32full.dll [23:49:16] [debug] 756b0000 - 7572c000 msvcp_win.dll [23:49:16] [debug] 77220000 - 77395000 USER32.dll [23:49:16] [debug] 758a0000 - 758b6000 win32u.dll [23:49:16] [debug] 76a10000 - 76a1e000 kernel.appcore.dll [23:49:16] [debug] 77610000 - 77655000 powrprof.dll [23:49:16] [debug] 769f0000 - 76a04000 profapi.dll [23:49:16] [debug] 72060000 - 72068000 WSOCK32.dll [23:49:16] [debug] 76150000 - 761b6000 WS2_32.dll [23:49:16] [debug] 704c0000 - 704e4000 WINMM.dll [23:49:16] [debug] 70370000 - 70393000 WINMMBASE.dll [23:49:16] [debug] 773a0000 - 773c5000 IMM32.DLL [23:49:16] [debug] 6aa40000 - 6aa90000 crashdetect.DLL [23:49:16] [debug] 6a9d0000 - 6aa39000 MSVCP100.dll [23:49:16] [debug] 6a910000 - 6a9cf000 MSVCR100.dll [23:49:16] [debug] 10000000 - 1000d000 sscanf.DLL [23:49:16] [debug] 6a8d0000 - 6a90f000 streamer.DLL [23:49:16] [debug] 026e0000 - 0270c000 filemanager.DLL [23:49:16] [debug] 6a830000 - 6a8cc000 MSVCP100D.dll [23:49:16] [debug] 6a6b0000 - 6a822000 MSVCR100D.dll [23:49:16] [debug] 703d0000 - 70425000 mswsock.dll [23:49:16] [debug] 6c550000 - 6c561000 napinsp.dll [23:49:16] [debug] 6c530000 - 6c546000 pnrpnsp.dll [23:49:16] [debug] 6c510000 - 6c523000 NLAapi.dll [23:49:16] [debug] 701c0000 - 70254000 DNSAPI.dll [23:49:16] [debug] 77490000 - 77497000 NSI.dll [23:49:16] [debug] 73b40000 - 73b70000 IPHLPAPI.DLL [23:49:16] [debug] 6c4c0000 - 6c4cc000 winrnr.dll [23:49:16] [debug] 6cb50000 - 6cb9e000 fwpuclnt.dll [23:49:16] [debug] 73a40000 - 73a59000 bcrypt.dll [23:49:16] [debug] 6cbd0000 - 6cbd8000 rasadhlp.dll

erfanasbari commented 4 years ago

I'm Trying My Self To Find The Issue If I Can :D

erfanasbari commented 4 years ago

@Crayder I Changed #define FORMAT_REPLACE_NATIVES true to #define FORMAT_REPLACE_NATIVES false in formatex.inc In This Line

And Replaced every format( In TS files To formatex( except in cmdbuffer.pwn in This Line And This Line And The Problem Never Happened Again ;D

Crayder commented 4 years ago

Dude you are amazing. Could you make a pull request for just this change?

Do you have any idea why this happens? Also I wonder if this affects speed greatly.

erfanasbari commented 4 years ago

Omg I'm Sorry i was wrong It Happens Agian and it didn't fixed the problem -_-

This Is The Log:

[13:33:35] [debug] Server crashed while executing tstudio.amx
[13:33:35] [debug] AMX backtrace:
[13:33:35] [debug] #0 native printf () from samp-server.exe
[13:33:35] [debug] #1 00044f58 in ?? (... <2 arguments>) at tstudio\cmdbuffer.pwn:33
[13:33:35] [debug] #2 00027d24 in public OnPlayerCommandText (playerid=1, cmdtext[]=@02f47cec "/tcar") at D:\projects\Samp IG\UI UX\TS Map Maker\pawno\include\YSI\y_hooks/impl.inc:929

I Tried Changing format(CommandBuffer[playerid][i], 128, "%s", CommandBuffer[playerid][i - 1]); To CommandBuffer[playerid][i] = CommandBuffer[playerid][i - 1]; And This Time Server Didn't Crash But a Runtime Error happens:

[13:45:12] [debug] Run time error 5: "Invalid memory access"
[13:45:12] [debug] AMX backtrace:
[13:45:12] [debug] #0 00044fb4 in ?? (... <2 arguments>) at tstudio\cmdbuffer.pwn:33
[13:45:12] [debug] #1 00027d24 in public OnPlayerCommandText (playerid=1, cmdtext[]=@02f47c5c "/cobject") at D:\projects\Samp IG\UI UX\TS Map Maker\pawno\include\YSI\y_hooks/impl.inc:929

i'm Still Trying to find the problem

erfanasbari commented 4 years ago

I Did Some Tests and there are the results:

i Add This Log Under OnPlayerCommandText In cmdbuffer.pwn:

for (new i = 0; i < MAX_COMMAND_BUFFER; i++)
{
    printf("Buffer ID: %d, String: %s", i, CommandBuffer[playerid][i]);
}

And This was one The Log When Server Crash:

[15:45:09] Buffer ID: 0, String: PLHD@<840,($ 
[15:45:09] Buffer ID: 1, String: 
[15:45:09] Buffer ID: 2, String: 
[15:45:09] Buffer ID: 3, String: 
[15:45:09] Buffer ID: 4, String: 
[15:45:09] Buffer ID: 5, String: 
[15:45:09] Buffer ID: 6, String: 
[15:45:09] Buffer ID: 7, String: 
[15:45:09] Buffer ID: 8, String: 
[15:45:09] Buffer ID: 9, String: 
[15:45:09] Buffer ID: 10, String: 
[15:45:09] Buffer ID: 11, String: 
[15:45:09] Buffer ID: 12, String: 
[15:45:09] Buffer ID: 13, String: 
[15:45:09] Buffer ID: 14, String: 
[15:45:09] Buffer ID: 15, String: 
[15:45:09] Buffer ID: 16, String: 
[15:45:09] Buffer ID: 17, String: 
[15:45:09] Buffer ID: 18, String: 
[15:45:09] Buffer ID: 19, String: 

And i Found out When i use fsdebug before tstudio In server.cfg It Doesn't Crash At All. And That Was the Reason I thought replacing format( with formatex( can fix the problem ( i was mapping with my friend for 2 hours and nothing happens )

This Is The CMD Buffer Log when i use fsdebug before tstudio In server.cfg:

[15:39:51] Buffer ID: 0, String: /tcar
[15:39:51] Buffer ID: 1, String: /tcar
[15:39:51] Buffer ID: 2, String: /tcar
[15:39:51] Buffer ID: 3, String: /tcar
[15:39:51] Buffer ID: 4, String: /tcar
[15:39:51] Buffer ID: 5, String: /tcar
[15:39:51] Buffer ID: 6, String: /tcar
[15:39:51] Buffer ID: 7, String: /tcar
[15:39:51] Buffer ID: 8, String: 
[15:39:51] Buffer ID: 9, String: 
[15:39:51] Buffer ID: 10, String: 
[15:39:51] Buffer ID: 11, String: 
[15:39:51] Buffer ID: 12, String: 
[15:39:51] Buffer ID: 13, String: 
[15:39:51] Buffer ID: 14, String: 
[15:39:51] Buffer ID: 15, String: 
[15:39:51] Buffer ID: 16, String: 
[15:39:51] Buffer ID: 17, String: 
[15:39:51] Buffer ID: 18, String: 
[15:39:51] Buffer ID: 19, String: 

[15:41:12] Buffer ID: 0, String: /tcar
[15:41:12] Buffer ID: 1, String: /tcar
[15:41:12] Buffer ID: 2, String: /tcar
[15:41:12] Buffer ID: 3, String: /tcar
[15:41:12] Buffer ID: 4, String: /tcar
[15:41:12] Buffer ID: 5, String: /tcar
[15:41:12] Buffer ID: 6, String: /tcar
[15:41:12] Buffer ID: 7, String: /tcar
[15:41:12] Buffer ID: 8, String: /tcar
[15:41:12] Buffer ID: 9, String: 
[15:41:12] Buffer ID: 10, String: 
[15:41:12] Buffer ID: 11, String: 
[15:41:12] Buffer ID: 12, String: 
[15:41:12] Buffer ID: 13, String: 
[15:41:12] Buffer ID: 14, String: 
[15:41:12] Buffer ID: 15, String: 
[15:41:12] Buffer ID: 16, String: 
[15:41:12] Buffer ID: 17, String: 
[15:41:12] Buffer ID: 18, String: 
[15:41:12] Buffer ID: 19, String: 

And there was no more strange strings!

But when i used fsdebug before tstudio In server.cfg The /Remobject doesn't Work! And Even Removed buildings Of the maps That I created before doesn't Work Too !

I Have No Idea about this behavior. But i think it's because of YSI ( not sure )

Still Trying To find out ...

erfanasbari commented 4 years ago

@Crayder I found the problem! Looks like there was some problem with Slash ( "/" ). i will make a PR right now

114

Crayder commented 4 years ago

Merged! I haven't tested. I will keep this open for the moment, but would you mind running a server that I can join to further confirm before making a new release candidate?

erfanasbari commented 4 years ago

I Test It With 2 Players In The Server.

but would you mind running a server that I can join to further confirm before making a new release candidate?

For sure ! But Can You send Your Discord id So I Can send server ip to you?