Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux server freeze with empty file src #738

Closed
CrosRoad95 opened this issue Dec 24, 2018 · 9 comments
Closed

Linux server freeze with empty file src #738

CrosRoad95 opened this issue Dec 24, 2018 · 9 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@CrosRoad95
Copy link
Contributor

CrosRoad95 commented Dec 24, 2018

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.

@CrosRoad95 CrosRoad95 added the bug Something isn't working label Dec 24, 2018
@qaisjp
Copy link
Contributor

qaisjp commented Dec 24, 2018

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

@CrosRoad95
Copy link
Contributor Author

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

@qaisjp
Copy link
Contributor

qaisjp commented Dec 24, 2018

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
Copy link
Contributor Author

CrosRoad95 commented Dec 24, 2018

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
Copy link
Contributor

qaisjp commented Dec 24, 2018

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

@CrosRoad95
Copy link
Contributor Author

CrosRoad95 commented Dec 24, 2018

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
Copy link
Contributor

qaisjp commented Dec 24, 2018

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
Copy link
Contributor

qaisjp commented Dec 24, 2018

I can reproduce the #738 (comment) if you unzip the resource.

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

@qaisjp qaisjp added this to the Backlog milestone Dec 24, 2018
@qaisjp qaisjp changed the title Linux server freeze Linux server freeze with empty file src Dec 25, 2018
@botder
Copy link
Member

botder commented Jan 6, 2019

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.

CChecksum cachedChecksum = CChecksum::GenerateChecksumFromFile(strCachedFilePath);

// While we're not at the end
char pBuffer [65536];
do
{
// Try to read 65536 bytes. It returns number of bytes actually read.
// Then CRC that using the CRC from last loop as beginning. This should
// be faster/more compatible than allocating a huge buffer for the entire
// file.
size_t sizeRead = fread ( pBuffer, 1, 65536, pFile );
ulCRC = crc32 ( ulCRC, (Bytef*) pBuffer, sizeRead );
}
while ( !feof ( pFile ) );

@botder botder closed this as completed in 5c85de2 Jan 6, 2019
@botder botder modified the milestones: Backlog, 1.5.7 Jan 6, 2019
@botder botder self-assigned this Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants