Dedicated Server API Client Communication

Discuss the Dedicated Server Tools developed by Nadeo Live such as ManiaLive, Trust Circles, Dedicated Manager, Competition Manager and Lobbies

Moderator: NADEO

Post Reply
reaby
Posts: 956
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: Dedicated Server API Client Communication

Post by reaby »

SO many thanks :1010 :yes: :clap: :lol: :thx: :thumbsup: :3 :pil
oliverde8
Posts: 1286
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Dedicated Server API Client Communication

Post by oliverde8 »

The_Big_Boo wrote:I had to do it for testing so why should you do the same job again? :P And as I know the changes I made, it's easier for me to find possible issues. ^^
Hey, I saw that you replaced the \Maniaplanet\DedicatedServer\Structures\Player classes by \ManiaLive\Data\Player class
But this class doesen't exist neither in the original Manialive repo nor in yours. So I suppose you forget to push something? :D

Edit didn't saw your other branch in it :oops:
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
User avatar
Jojo_44
Posts: 485
Joined: 12 Jul 2010, 15:58
Location: Germany->Bavaria
Contact:

Re: Dedicated Server API Client Communication

Post by Jojo_44 »

The interrupts coming frome line 264 in the GbxRemote.php:

Code: Select all

		$data = '';
		while(strlen($data) < $size)
		{
			$buf = fread($this->socket, $size - strlen($data));
			if($buf === '' || $buf === false)
				return false;
			$data .= $buf;
		}
Since you have a non-blocking fread it can happen that it trys to read something from the stream when no bytes are available. But you return false in that case(line 264 first if case). I don´t know why you have a if there anyway but I think you should remove the if(line 264/265).

Btw it would be nice if you can update the composer json because the current one is pointing to the original dedicated library because of the fork you did I guess.

Jojo
Image
my english sounds very unfriendly but it isn´t ;)
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated Server API Client Communication

Post by The_Big_Boo »

Jojo_44 wrote:Since you have a non-blocking fread it can happen that it trys to read something from the stream when no bytes are available. But you return false in that case(line 264 first if case). I don´t know why you have a if there anyway but I think you should remove the if(line 264/265).
It's actually a blocking fread: it returns false when it times out, which is after 5s by default but can be configured. I don't think a server controller can afford waiting minutes... 5s without a single byte when you're waiting for an immediate answer is not that short.
Jojo_44 wrote:Btw it would be nice if you can update the composer json because the current one is pointing to the original dedicated library because of the fork you did I guess.
The goal is still to merge my fork back in the original.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
Jojo_44
Posts: 485
Joined: 12 Jul 2010, 15:58
Location: Germany->Bavaria
Contact:

Re: Dedicated Server API Client Communication

Post by Jojo_44 »

The_Big_Boo wrote:
Jojo_44 wrote:Since you have a non-blocking fread it can happen that it trys to read something from the stream when no bytes are available. But you return false in that case(line 264 first if case). I don´t know why you have a if there anyway but I think you should remove the if(line 264/265).
It's actually a blocking fread: it returns false when it times out, which is after 5s by default but can be configured. I don't think a server controller can afford waiting minutes... 5s without a single byte when you're waiting for an immediate answer is not that short.
Are you sure ? What´s the reason behind this comparison in the if statement ?

Code: Select all

$buf === ''
Jojo
Image
my english sounds very unfriendly but it isn´t ;)
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated Server API Client Communication

Post by The_Big_Boo »

From stream_select documentation ;)
The streams listed in the read array will be watched to see if characters become available for reading (more precisely, to see if a read will not block - in particular, a stream resource is also ready on end-of-file, in which case an fread() will return a zero length string).
Though fread should return false when reaching eof in our case, better safe than sorry.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
Jojo_44
Posts: 485
Joined: 12 Jul 2010, 15:58
Location: Germany->Bavaria
Contact:

Re: Dedicated Server API Client Communication

Post by Jojo_44 »

Yes so according to the log I think he´s calling GetMapList() which is the most time consuming method for the dedi server because the dedi reads the matchsettings file from the disk. After that fread gets called instantly but since GetMapList() can take 2sec to transmit all data to the client there´s a point where maybe half of the data was read but furthermore no data available(End of file). End of file means fread returns empty string and empty string means you return false what also means you throw an Exception. That´s what I think causes the interrupts but of course I´m not sure ;)

Jojo
Image
my english sounds very unfriendly but it isn´t ;)
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated Server API Client Communication

Post by The_Big_Boo »

Jojo_44 wrote:After that fread gets called instantly but since GetMapList() can take 2sec to transmit all data to the client there´s a point where maybe half of the data was read but furthermore no data available(End of file). End of file means fread returns empty string and empty string means you return false what also means you throw an Exception.
For a stream, eof means the connection was closed. As long as the connection is alive, eof isn't supposed to be reached even if there are no data available. Moreover, the exception was thrown while trying to read the header, thus the 8 first bytes of answer, and it seems it's the most common case (maybe even the only case) of "random" interrupt exception.

Which lets these theories:
- the dedicated didn't receive the request
=> so the connection is indeed interrupted
- the dedicated didn't answer at all
=> the only reason I can think of is reaching a bit more than 2 billions requests, which is highly unlikely (though easily fixable)
- the dedicated didn't answer in time
=> was it too busy with something else?
- the response was read but not recognized
=> pretty unlikely as only the GbxRemote is using the socket and it waits for the answer immediately after sending the request
- the response was never received
=> so the connection is indeed interrupted
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
Post Reply

Return to “Dedicated Server Tools”

Who is online

Users browsing this forum: No registered users and 0 guests