Raised This Month: $ Target: $400
 0% 

socket_recv() hangs?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 07-06-2006 , 19:29   Re: socket_recv() hangs?
Reply With Quote #1

my test server is still running with it but Dominion's servers kept on crashing. so i went on one of his servers with him and we did some testing.
he has 4 servers and server 1 and 4 are on the same machine, as well as server 2 and 3. from his debug log i noticed that server 4 is crashing when trying to receive the UDP answer from server 1. so we went on server 4 and deleted server 1 from the server checking list and TA-DAH: no crashes.
with server 1 added to the list both server 1 and 4 are crashing after some requests (3-5 or so). the socket number does NOT increase. i used default timeout value for socket_change. and i rechecked again with debug messages, it is still socket_recv where the server just hangs.

to sum this up:
the server is only hanging if the server it is receiving the UDP packet from is the same machine (thus on the same IP). of course both servers were on different ports so we had this situation:

server:27400 --- UDP request ---> server:27500
server:27500 --- UDP answer ---> server:27400

this works fine for like 3 times, then both servers lock up.



i really don't think that i can do anything about this myself, it seems to be an AMXX or Metamod bug or even worse: a bug in the linux sockets. oh and btw, he had crashes with AMXX 1.60 as well as 1.75a.

but first i want to hear your suggestions. should i post this to the bug forums or is there still a chance i made something wrong?
remember, this other plugin had the same problem. but there was never reported such a problem, because it's only there when a server is receiving a packet from itself.
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:
xOR is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-23-2011 , 10:06   Re: socket_recv() hangs?
Reply With Quote #2

bump.

The following problems detected:
In some cases socket get corrupted after receiving data from it for unknown reason.
As xOR said, socket_change actually returns 1 on socket error. It even returns 1 on closed socket. But there is more! socket_recv may or may not crush your server (depending on which version you use), but if there was error, it actually returns -1 and empty buffer. So conditional statemant if (socket_recv) is incorrect, use if (socket_recv>0) instead. You can also use if (socket_recv<0) to detect error.
So, the only stable way to ensure socket to work correctly is to reset (close/open) it each time after it socket_recv. But i still don't understand why it gets corrupted after socket_recv and why it works so fine after being reseted - it really should allocate a different port instead of using the same port - so incoming packets should be lost, but they are not, and you can be read them with socket_recv

Any explanation will be really appreciated!
__________________


Last edited by SonicSonedit; 04-23-2011 at 10:11.
SonicSonedit is offline
Old 04-25-2011, 10:53
SonicSonedit
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode