multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.42k stars 438 forks source link

Linux server freeze with empty file src #738

Closed CrosRoad95 closed 5 years ago

CrosRoad95 commented 5 years ago

Describe the bug If you provide resource with <file src=""/> linux server go freeze.

To reproduce freeze.zip just let your server load this resource. copy script into resource directory and start server, if you have linux, server will freeze.

Expected behaviour Don't freeze and print that could not find

Screenshots image

Version MTA:SA Server v1.5.6-release-14688

Additional context Working only on linux, i tested on windows and everything working.

I noticed that my server consume a lot of cpu.

qaisjp commented 5 years ago

Can't reproduce this one, I just get [14:19:17] ERROR: Couldn't find file for resource freeze (on Linux)

CrosRoad95 commented 5 years ago

i can reproduce this every single time, did you download resource that i provided? screenshot from console image

qaisjp commented 5 years ago

Yes, with your resource:

start freeroam
[14:36:45] start: Requested by Console
[14:36:45] Starting freeroam
[14:36:45] start: Resource 'freeroam' started
refresh
[14:36:56] ERROR: Couldn't find file  for resource freeze
[14:36:56] Loading of resource 'freeze' failed
[14:36:56] Resources: 1 loaded, 0 failed

say hi
[14:37:00] CONSOLECHAT: hi

I'm using a custom debug build though, so it could be release-only.

CrosRoad95 commented 5 years ago

proof of work https://i.gyazo.com/47cd2c9a02bed8b069a218462a04483e.mp4 freeze after i execute /refresh command ( only resource freeze is installed ) and server files ( latest nightly ) multitheftauto_linux_x64-1.5.6-rc-16177.zip

qaisjp commented 5 years ago

Linux fez 4.9.0-7-amd64 #1 SMP Debian 4.9.110-3+deb9u1 (2018-08-03) x86_64 GNU/Linux

CrosRoad95 commented 5 years ago

Linux DESKTOP-O9QIRJK 4.4.0-17134-Microsoft # 471-Microsoft Fri Dec 07 20:04:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux Debian,

my linux, on my hosting provider ( serverproject.pl ) this resource also cause freeze

could someone else test it?

qaisjp commented 5 years ago

Can't reproduce with multitheftauto_linux_x64-1.5.6-rc-16177.tar.gz multitheftauto_linux_x64-1.4.1-rc-7382-net1D8.tar.gz (from https://nightly.mtasa.com/)

say hi
[15:18:33] CONSOLECHAT: hi
refresh
[15:18:36] ERROR: Couldn't find file  for resource freeze
[15:18:36] Loading of resource 'freeze' failed
say hi
[15:18:38] CONSOLECHAT: hi

Linux hgs 4.4.0-134-generic #160-Ubuntu SMP Wed Aug 15 14:58:00 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

qaisjp commented 5 years ago

I can reproduce the https://github.com/multitheftauto/mtasa-blue/issues/738#issuecomment-449745620 if you unzip the resource.

edit: this is actually multitheftauto_linux_x64-1.4.1-rc-7382-net1D8.tar.gz

botder commented 5 years ago

The server tries to generate a checksum for a directory and the implementation opens the directory with fopen, which actually works on Linux, and then reads repeatedly 65536 bytes in a loop.

https://github.com/multitheftauto/mtasa-blue/blob/13771a4f7fbe28f497a1786711e2460c31fb0f9d/Server/mods/deathmatch/logic/CResource.cpp#L553

https://github.com/multitheftauto/mtasa-blue/blob/13771a4f7fbe28f497a1786711e2460c31fb0f9d/vendor/bochs/bochs_internal/crc32.cpp#L40-L51