LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   any way to kill/disconnect a unix domain socket? (https://www.linuxquestions.org/questions/linux-networking-3/any-way-to-kill-disconnect-a-unix-domain-socket-780070/)

ciuly 01-05-2010 02:07 PM

any way to kill/disconnect a unix domain socket?
 
I have described my issue in detail here: http://forums.mysql.com/read.php?24,...977#msg-297977
basically, I am having a mysql server which keeps piling up on it's unix domain socket connections.

here's a small example of netstat as it looks now (count about 80-100 connections paired with httpd):
Code:

Active UNIX domain sockets (servers and established)
Proto RefCnt Flags      Type      State        I-Node PID/Program name    Path
unix  2      [ ACC ]    STREAM    LISTENING    3521428 12429/mysqld        /tmp/mysql.sock
unix  3      [ ]        STREAM    CONNECTED    3789674 12429/mysqld        /tmp/mysql.sock
unix  3      [ ]        STREAM    CONNECTED    3789673 25867/httpd
unix  3      [ ]        STREAM    CONNECTED    3788603 12429/mysqld        /tmp/mysql.sock
unix  3      [ ]        STREAM    CONNECTED    3788602 25841/httpd
unix  3      [ ]        STREAM    CONNECTED    3788389 12429/mysqld        /tmp/mysql.sock

This is indeed a mysql server issue as far as I managed to debug it but until a workaround/fix is found I need to have my server responsive and the first idea that comes to my mind is to somehow kill those stray connections. as described in the mysql topic mentioend above, killing from mysql will not work. I need to kill them from outside mysql.
I have setup a crontab script to kill and restart the mysql server when it cannot connect and it runs every 5 min. however this only lead to mysql being down sooner rather than later because in many cases just kill -9 and then service start mysql does not do the job (it's either part of the same issue of mysql or another issue). basically I need to manually kill mysqld instances a bunch of times until it's ok, OR, if that doesn't work, stop everything that is using mysql, wait a few minutes, and then start mysql. so I ditched that script and now I am manually restarting mysql server every ~ 24 hours.

so basically it's a pain. if I were to kill the stray connections however, I will not have to bother every day with restarting mysql. I hope.

so, any ideas?

thanks.

ciuly 01-05-2010 03:24 PM

I just made a test and:
service apache restart
** this took a little while to stop
killall -29 mysqld
** waited about 10 seconds or so
** tried to connect, failed
killall -9 mysqld
** connected successfully

this appears to be a good workaround. if nothing comes up in the following days, I will keep testing this scenario and see if it works all/most of the time.

ciuly 01-06-2010 02:38 PM

between the killall -29 and killall -9 there is definitely some timing thing. I had to issue a few killall -9 's before I was able to reconnect (this was with all command executed with about 2-4 seconds between them.

though this appears to be a workaround, I would very much like to get some ideas to test in an attempt to actually fix this.

just in case it matters (though it didn't matter with mysql 4.x), my server is an old PIII with 256 MB ram and 512 MB swap, RH 9 in text mode only. as I said, this server behaved very good before the upgrade so unless mysql 5.1.x comes with some high minimum requirements, this shouldn't be the cause.


All times are GMT -5. The time now is 06:19 PM.