Raised This Month: $51 Target: $400
 12% 

bug with sockets


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kam1kaze
Junior Member
Join Date: Jun 2008
Old 09-22-2009 , 06:57   bug with sockets
Reply With Quote #1

Hi,

Mantis is down now

When I investigate this bug https://bugs.alliedmods.net/show_bug.cgi?id=3957,
I have found one more. The sockets are not closed after map change. I don't know this problem with your plugin or amxx module, but the sockets open by xredirect. There is listing of lsof command.

PHP Code:
# lsof -np 13646
COMMAND     PID USER   FD   TYPE             DEVICE     SIZE     NODE NAME
hlds_i686 13646 ugcs  cwd    DIR                8
,6     4096 17736704 /home/ugcs/111.111.111.111-27015/cs16amxx
hlds_i686 13646 ugcs  rtd    DIR                8
,1     4096        2 /
hlds_i686 13646 ugcs  txt    REG                8,6   177498 17738052 /home/ugcs/111.111.111.111-27015/cs16amxx/hlds_i686
hlds_i686 13646 ugcs  mem    REG                8
,6  5164807 17738057 /home/ugcs/111.111.111.111-27015/cs16amxx/libsteamvalidateuseridtickets.so
hlds_i686 13646 ugcs  mem    REG                8
,6 14655815 17738065 /home/ugcs/111.111.111.111-27015/cs16amxx/steamclient.so
hlds_i686 13646 ugcs  mem    REG                8
,6   177672 17737993 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/regex_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6    13824 17737987 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/sockets_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,1    49628   350488 /emul/ia32-linux/usr/lib/libgcc_s.so.1
hlds_i686 13646 ugcs  mem    REG                8
,1    67408   350207 /emul/ia32-linux/lib/libresolv-2.7.so
hlds_i686 13646 ugcs  mem    REG                8
,1    17876   350214 /emul/ia32-linux/lib/libnss_dns-2.7.so
hlds_i686 13646 ugcs  mem    REG                8
,6    27200 17737992 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/fun_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,1    38404   350210 /emul/ia32-linux/lib/libnss_files-2.7.so
hlds_i686 13646 ugcs  mem    REG                8
,6   469776 17738060 /home/ugcs/111.111.111.111-27015/cs16amxx/libvstdlib_s.so
hlds_i686 13646 ugcs  mem    REG                8
,6   828457 17738059 /home/ugcs/111.111.111.111-27015/cs16amxx/libtier0_s.so
hlds_i686 13646 ugcs  mem    REG                8
,6    11360 17768788 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/nsv/dlls/nsv_mm_i386.so
hlds_i686 13646 ugcs  mem    REG                8
,6    31096 17768781 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/cpustat/dlls/cpustat_mm_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6    48240 17737991 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/csx_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6    48008 17737981 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/cstrike_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6   310472 17737989 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/fakemeta_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6    84984 17737982 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/engine_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6   509256 17737997 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/modules/mysql_amxx_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6   526372 17768464 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/dlls/amxmodx_mm_core2.so
hlds_i686 13646 ugcs  mem    REG                8
,6  2564620 17737512 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/dlls/cs_i386.so
hlds_i686 13646 ugcs  mem    REG                8
,6   157652 17737921 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/metamod/dlls/metamod_i386.so
hlds_i686 13646 ugcs  mem    REG                8
,6   242182 17738049 /home/ugcs/111.111.111.111-27015/cs16amxx/filesystem_stdio_i386.so
hlds_i686 13646 ugcs  mem    REG                8
,1   145232   350212 /emul/ia32-linux/lib/libm-2.7.so
hlds_i686 13646 ugcs  mem    REG                8
,6   344892 17738055 /home/ugcs/111.111.111.111-27015/cs16amxx/libsteam_api_c.so
hlds_i686 13646 ugcs  mem    REG                8
,6   964376 17738048 /home/ugcs/111.111.111.111-27015/cs16amxx/engine_i686.so
hlds_i686 13646 ugcs  mem    REG                8
,1  1376492   350213 /emul/ia32-linux/lib/libc-2.7.so
hlds_i686 13646 ugcs  mem    REG                8
,1   107227   350209 /emul/ia32-linux/lib/libpthread-2.7.so
hlds_i686 13646 ugcs  mem    REG                8
,1     9680   350217 /emul/ia32-linux/lib/libdl-2.7.so
hlds_i686 13646 ugcs  mem    REG                8
,1   121440   350216 /emul/ia32-linux/lib/ld-2.7.so
hlds_i686 13646 ugcs    0u   CHR              136
,2                 5 /dev/pts/2
hlds_i686 13646 ugcs    1u   CHR              136
,2                 5 /dev/pts/2
hlds_i686 13646 ugcs    2u   CHR              136
,2                 5 /dev/pts/2
hlds_i686 13646 ugcs    3u   CHR                5
,0              1256 /dev/tty
hlds_i686 13646 ugcs    4w   REG                8
,6   413696 10444827 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/logs/L0922019.log
hlds_i686 13646 ugcs    5u  IPv4            7746587               UDP 111.111.111.111
:27015 
hlds_i686 13646 ugcs    6r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs    7r   REG                8
,6     5312 17738031 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/cmdaccess.ini
hlds_i686 13646 ugcs    8u  unix 0xffff88011d9f8c80           7746592 socket
hlds_i686 13646 ugcs    9u  unix 0xffff88011c8f3980           7746593 socket
hlds_i686 13646 ugcs   10u  IPv4            7746595               UDP 111.111.111.111
:26903 
hlds_i686 13646 ugcs   11u  IPv4            7746619               UDP 111.111.111.111
:43017->111.111.111.111:27015 
hlds_i686 13646 ugcs   12u  IPv4            7746620               UDP 111.111.111.111
:45742->111.111.111.111:27018 
hlds_i686 13646 ugcs   13u  IPv4            7746621               UDP 111.111.111.111
:43081->111.111.111.111:27016 
hlds_i686 13646 ugcs   14u  IPv4            7746622               UDP 111.111.111.111
:35245->111.111.111.111:27017 
hlds_i686 13646 ugcs   15u  IPv4            7746623               UDP 111.111.111.111
:37282->111.111.111.111:27001 
hlds_i686 13646 ugcs   16r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   17u  IPv4            7749311               UDP 111.111.111.111
:56671->111.111.111.111:27018 
hlds_i686 13646 ugcs   18u  IPv4            7749312               UDP 111.111.111.111
:39882->111.111.111.111:27016 
hlds_i686 13646 ugcs   19u  IPv4            7749313               UDP 111.111.111.111
:57561->111.111.111.111:27017 
hlds_i686 13646 ugcs   20u  IPv4            7749314               UDP 111.111.111.111
:33471->111.111.111.111:27001 
hlds_i686 13646 ugcs   21r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   22u  IPv4            7750199               UDP 111.111.111.111
:42510->111.111.111.111:27018 
hlds_i686 13646 ugcs   23u  IPv4            7750200               UDP 111.111.111.111
:48739->111.111.111.111:27016 
hlds_i686 13646 ugcs   24u  IPv4            7750201               UDP 111.111.111.111
:54693->111.111.111.111:27017 
hlds_i686 13646 ugcs   25u  IPv4            7750202               UDP 111.111.111.111
:59323->111.111.111.111:27001 
hlds_i686 13646 ugcs   26r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   27u  IPv4            7752049               UDP 111.111.111.111
:45948->111.111.111.111:27018 
hlds_i686 13646 ugcs   28u  IPv4            7752050               UDP 111.111.111.111
:38743->111.111.111.111:27016 
hlds_i686 13646 ugcs   29u  IPv4            7752051               UDP 111.111.111.111
:39913->111.111.111.111:27017 
hlds_i686 13646 ugcs   30u  IPv4            7752052               UDP 111.111.111.111
:57138->111.111.111.111:27001 
hlds_i686 13646 ugcs   31r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   32u  IPv4            7753083               UDP 111.111.111.111
:52920->111.111.111.111:27018 
hlds_i686 13646 ugcs   33u  IPv4            7753084               UDP 111.111.111.111
:37309->111.111.111.111:27016 
hlds_i686 13646 ugcs   34u  IPv4            7753085               UDP 111.111.111.111
:52832->111.111.111.111:27017 
hlds_i686 13646 ugcs   35u  IPv4            7753086               UDP 111.111.111.111
:41621->111.111.111.111:27001 
hlds_i686 13646 ugcs   36r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   37u  IPv4            7754155               UDP 111.111.111.111
:33327->111.111.111.111:27018 
hlds_i686 13646 ugcs   38u  IPv4            7754156               UDP 111.111.111.111
:58761->111.111.111.111:27016 
hlds_i686 13646 ugcs   39u  IPv4            7754157               UDP 111.111.111.111
:37335->111.111.111.111:27017 
hlds_i686 13646 ugcs   40u  IPv4            7754158               UDP 111.111.111.111
:37559->111.111.111.111:27001 
hlds_i686 13646 ugcs   41r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   42u  IPv4            7756406               UDP 111.111.111.111
:36017->111.111.111.111:27018 
hlds_i686 13646 ugcs   43u  IPv4            7756407               UDP 111.111.111.111
:43369->111.111.111.111:27016 
hlds_i686 13646 ugcs   44u  IPv4            7756408               UDP 111.111.111.111
:53429->111.111.111.111:27017 
hlds_i686 13646 ugcs   45u  IPv4            7756409               UDP 111.111.111.111
:57040->111.111.111.111:27001 
hlds_i686 13646 ugcs   46r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   47u  IPv4            7758129               UDP 111.111.111.111
:59436->111.111.111.111:27018 
hlds_i686 13646 ugcs   48u  IPv4            7758130               UDP 111.111.111.111
:41014->111.111.111.111:27016 
hlds_i686 13646 ugcs   49u  IPv4            7758131               UDP 111.111.111.111
:55743->111.111.111.111:27017 
hlds_i686 13646 ugcs   50u  IPv4            7758132               UDP 111.111.111.111
:35694->111.111.111.111:27001 
hlds_i686 13646 ugcs   51r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   52u  IPv4            7758167               UDP 111.111.111.111
:57689->111.111.111.111:27018 
hlds_i686 13646 ugcs   53u  IPv4            7758168               UDP 111.111.111.111
:48483->111.111.111.111:27016 
hlds_i686 13646 ugcs   54u  IPv4            7758169               UDP 111.111.111.111
:37904->111.111.111.111:27017 
hlds_i686 13646 ugcs   55u  IPv4            7758170               UDP 111.111.111.111
:41320->111.111.111.111:27001 
hlds_i686 13646 ugcs   56r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   57u  IPv4            7758429               UDP 111.111.111.111
:33388->111.111.111.111:27018 
hlds_i686 13646 ugcs   58u  IPv4            7758430               UDP 111.111.111.111
:42915->111.111.111.111:27016 
hlds_i686 13646 ugcs   59u  IPv4            7758431               UDP 111.111.111.111
:34523->111.111.111.111:27017 
hlds_i686 13646 ugcs   60u  IPv4            7758432               UDP 111.111.111.111
:52503->111.111.111.111:27001 
hlds_i686 13646 ugcs   61r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   62u  IPv4            7758692               UDP 111.111.111.111
:58780->111.111.111.111:27018 
hlds_i686 13646 ugcs   63u  IPv4            7758693               UDP 111.111.111.111
:55674->111.111.111.111:27016 
hlds_i686 13646 ugcs   64u  IPv4            7758694               UDP 111.111.111.111
:52240->111.111.111.111:27017 
hlds_i686 13646 ugcs   65u  IPv4            7758695               UDP 111.111.111.111
:48778->111.111.111.111:27001 
hlds_i686 13646 ugcs   66r   REG                8
,6      183 17738008 /home/ugcs/111.111.111.111-27015/cs16amxx/cstrike/addons/amxmodx/configs/maps.ini
hlds_i686 13646 ugcs   67u  IPv4            7760231               UDP 111.111.111.111
:42291->111.111.111.111:27018 
hlds_i686 13646 ugcs   68u  IPv4            7760232               UDP 111.111.111.111
:34055->111.111.111.111:27016 
hlds_i686 13646 ugcs   69u  IPv4            7760233               UDP 111.111.111.111
:33902->111.111.111.111:27017 
hlds_i686 13646 ugcs   70u  IPv4            7760234               UDP 111.111.111.111
:57248->111.111.111.111:27001 
serverlist.ini:
PHP Code:
[::Public:: #1]
address=111.111.111.111
port
=27015
cmdbackup
=5
noauto
=1

[::Public:: #2]
address=111.111.111.111
port
=27018
cmdbackup
=5

[::Arena::]
address=111.111.111.111
port
=27016
cmdbackup
=5
noauto
=1

[::DM EEA::]
address=111.111.111.111
port
=27017
cmdbackup
=5

[::Clan War::]
address=111.111.111.111
port
=27001
cmdbackup
=5
noauto
=1
password
=ugcw
publicpassword
=
PHP Code:
amxx cvars xred
Registered cvars
:
       
name                     value                    plugin          
 
[  1redirect_version         1.0.3.2                  xredirect.amxx  
 
[  2redirect_active          1                        xredirect.amxx  
 
[  3redirect_auto            2                        xredirect.amxx  
 
[  4redirect_manual          2                        xredirect.amxx  
 
[  5redirect_follow          0                        xredirect.amxx  
 
[  6redirect_external_addre                           xredirect.amxx  
 
[  7redirect_check_method    2                        xredirect.amxx  
 
[  8redirect_announce        240                      xredirect.amxx  
 
[  9redirect_announce_mode   2                        xredirect.amxx  
 
10redirect_announce_alive  -1.0                     xredirect.amxx  
 
11redirect_announce_alive  0.01                     xredirect.amxx  
 
12redirect_announce_deadp  -1.0                     xredirect.amxx  
 
13redirect_announce_deadp  0.35                     xredirect.amxx  
 
14redirect_show            0                        xredirect.amxx  
 
15redirect_adminslots      1                        xredirect.amxx  
 
16redirect_maxadmins       0                        xredirect.amxx  
 
17redirect_retry           1                        xredirect.amxx  
 
18redirect_hidedown        0                        xredirect.amxx  
 
19redirect_localslots      0                        xredirect.amxx  
19 cvars 
if you need some additional info, let me know.

Thanks for your work.
Kam1kaze is offline
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 09-22-2009 , 19:21   Re: bug with sockets
Reply With Quote #2

which Mantis are you talking about? mine's not offline, it just moved to www.bugs.exirc.net. if you try to access an old link just replace "boxxor" with "exirc" within it and it should work again, i migrated the whole database and IDs didn't change.

anyway, thanks for pointing that bug out. not many, but some people still have socket issues with xREDIRECT - maybe we have found the root of that now.

i remember a long time ago xREDIRECT had lag issues in some situations. by that time it was designed to constantly close and open sockets for each query - being done every 20 seconds i didn't think it could in any way cause a lag, especially with UDP where no persistent state needs to be handled. but then again of course some resources still have to be allocated and held open and on top of that most firewalls use SPI or any other guesswork, trying to detect and remember a connection for a connectionless protocol, which isn't the easiest job

so i changed that and not closing the socket anymore helped with that, no lags anymore.
when i did the change i was expecting that all file handles would be closed when any form of plugin unload occurs. but according to that bug entry that isn't the case, so yes, that would mean sockets stay open.

of course i will try to fix that in xREDIRECT - implementing plugin_end() with a socket_close should do the job. probably it's also a good idea to do the same on plugin_pause().
i am still happy to see that it will be changed in AMXX 1.8.2 too - many people are still using older xREDIRECT versions and closing the AMXX bug will make my earlier assumption become true and make those versions work clean too.

my time is very limited, if you want to speed up a release with the fix you could help me (again) and try a quick fix approach. just add this to the end of the xREDIRECT source before the line with "#else":
Code:
public close_sockets() {     new nCounter         for (nCounter = 0; nCounter < MAX_SERVERFORWARDS; nCounter++)     {         if (g_naServerSockets[nCounter] > 0)         {             socket_close(g_naServerSockets[nCounter])             g_naServerSockets[nCounter] = 0         }     } } public plugin_end() {     close_sockets() } public plugin_pause() {     close_sockets() }
please use the stable as base version.
it would really help if especially you could test it, because you can do the direct before-after-comparison.
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:
xOR is offline
Kam1kaze
Junior Member
Join Date: Jun 2008
Old 09-23-2009 , 02:17   Re: bug with sockets
Reply With Quote #3

I have added the code and recompiled the plugin. It looks like problem has been resolved, but I will additionally test it today and let you know.

Thank you.

Last edited by Kam1kaze; 09-23-2009 at 02:21.
Kam1kaze is offline
Kam1kaze
Junior Member
Join Date: Jun 2008
Old 09-23-2009 , 19:42   Re: bug with sockets
Reply With Quote #4

Unfortunately, the problem is not resolved. When I checked the servers after several hours, I found no close sockets.
Kam1kaze is offline
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 09-24-2009 , 07:41   Re: bug with sockets
Reply With Quote #5

hmm, could you maybe watch your sockets list and check whether the number of xREDIRECT sockets really increases exactly when there is a mapchange? maybe it is some other issue which is causing this.

it is probably also a good idea to add a log message to the close_sockets() function, so we can see whether the new code is actually ever executed:
Code:
public close_sockets() {     new nCounter         for (nCounter = 0; nCounter < MAX_SERVERFORWARDS; nCounter++)     {         if (g_naServerSockets[nCounter] > 0)         {             log_amx("closing socket %d with ID %d", nCounter, g_naServerSockets[nCounter])             socket_close(g_naServerSockets[nCounter])             g_naServerSockets[nCounter] = 0         }         else         {             log_amx("NOT closing socket %d, already closed", nCounter)         }     } }
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:

Last edited by xOR; 09-24-2009 at 07:49.
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 15:58.


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