Raised This Month: $ Target: $400
 0% 

socket_recv() hangs?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 07-03-2006 , 18:57   Re: socket_recv() hangs
Reply With Quote #1

is the server crashing... or is it locking up and getting stuck? There is a difference. Server crash, its a fact of life, but they should not lock up completely. Only other thing I can think of is that the sockets are not getting freed correctly and after it builds up so many it makes the server puke. Try printing the socket numbers out, it should always stay the same and not increment. Everytime a socket is closed that number should be reused again.

-----

After testing mine with printing socket numbers I realized I had a leak. If an attempt was aborted because no data was found (socket_change was false 5 times) I was not using socket_close. Anytime you have a valid socket number and abort or are done with the socket you need to use socket_close.
__________________

Last edited by jtp10181; 07-03-2006 at 19:05.
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 07-03-2006 , 20:20   Re: socket_recv() hangs
Reply With Quote #2

it is completely locking up thus the automatic server restart isn't triggered as well. it just freezes with the last message displayed being my debug message before socket_recv() but the one after is not displayed anymore.

my code as it currently is (and was righ from the start) would always close the socket as long as the socket number is > 0 (meaning it was opened correctly) no matter whether socket_change(d) or not.

but you might still have a point there with the socket numbers. maybe i have some leak in a different way somewhere. printing the socket numbers is really a good hint. i will try this tomorrow, too tired now
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:
xOR is offline
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 07-04-2006 , 09:37   Re: socket_recv() hangs
Reply With Quote #3

although i said i was too tired i still changed these 2 things before going to sleep yesterday:

- as suggested by Hawk i left out the timeout value in socket_change() so the default value is used
- i added the socket number to my debug messages

the results after this night are:
- the server is still running and didn't crash yet, but this doesn't mean anything until it is stable for several days
- the socket numbers stayed the same for the whole night and never increased
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:
xOR is offline
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 07-05-2006 , 17:27   Re: socket_recv() hangs
Reply With Quote #4

server is running for 48 hours now without crash.
plus i noticed that i forgot to set mp_timelimit to something so the server was running
- 48 hours without restart
- with checking 8 servers
- with checking them every 5 seconds
stable and without a crash.

i will wait some more days though. i still wouldn't be surprised to see it crashing on the third day =/
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:
xOR is offline
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 07-06-2006 , 19:29   Re: socket_recv() hangs?
Reply With Quote #5

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
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 07-06-2006 , 20:00   Re: socket_recv() hangs?
Reply With Quote #6

could be a firewall issue, blocking something and making the sockets module fuck up. Also, try using 127.0.0.1ORT for the local IPs, just to test and see if it works. I might mess around with this later also to test it on windows. FYI I really doubt using the default timeout value will do anything usefull... using a timeout of 1 is the safest way to avoid the server lagging while waiting for data.
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 07-06-2006 , 20:27   Re: socket_recv() hangs?
Reply With Quote #7

Quote:
Originally Posted by jtp10181
could be a firewall issue, blocking something and making the sockets module fuck up. Also, try using 127.0.0.1ORT for the local IPs, just to test and see if it works. I might mess around with this later also to test it on windows. FYI I really doubt using the default timeout value will do anything usefull... using a timeout of 1 is the safest way to avoid the server lagging while waiting for data.
hmm firewall...but why then hang when receiving? the packet wouldn't arrive there if the firewall was blocking it.
anyway, trying loopback IP is a good idea.

unfortunately i don't have the same problem on my server. servers there can request packets from themselves without problems.

anyway, the timeout value was the only thing i changed when my server stopped crashing (at least for 3 days). so i must assume now that i changed it back to 1 that the crash problem is still there - i will see what happens over night.
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:
xOR is offline
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