List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:July 5 1999 11:48pm
Subject:Re: How to close sockets, ports ?
View as plain text  
Michael Widenius wrote:
> 
> >>>>> "Plamen" == Plamen Petkov <plamendp@stripped> writes:
> 
> Plamen> 1. I got the following error as an output from safe_mysqld:
> Plamen> ===
> Plamen> [~/mysql] UserName@sun00404(pts/3)
> Plamen> [5:41am]# bin/safe_mysqld
> Plamen> Starting mysqld daemon with databases from
> /usr/sites/bgstore.com/mysql/var
> Plamen> mysqld daemon ended
> Plamen> [~/mysql] UserName@sun00404(pts/3)
> Plamen> [5:42am]#
> Plamen> ===
> 
> Plamen> 2. This is from <hostname>.err log file:
> 
> Plamen> ===
> Plamen> ...
> Plamen> 990705  5:42:04  Can't start server: Bind on TCP/IP port: Address already
> in
> Plamen> use
> Plamen> 990705  5:42:04  Do you already have another mysqld server running on
> port:
> Plamen> 3306 ?
> Plamen> 990705  5:42:04  Aborting
> Plamen> ===
> 
> Plamen> NOTE: nobody on this server is running another mysql on port 3306. I've
> Plamen> checked it out.
> 
> Plamen> 3. netstat -a | grep mysql
> Plamen> f66c8158 stream-ord f697b090        0
> Plamen> /usr/sites/bgstore.com/mysql/mysql.sock
> Plamen> f66c8d58 stream-ord f676a9c0        0
> Plamen> /usr/sites/bgstore.com/mysql/mysql.sock
> 
> Plamen> But there are NO socket files existing.
> 
> Plamen> 4. netstat -a | grep 3306
> 
> Plamen> *.3306               *.*                0      0     0      0 LISTEN
> 
> Plamen> This is a result from  'my' mysql daemon. But I shot it down succesfully
> ??
> Plamen> I this is still here ?
> 
> Plamen> Well, I am not a 'network guru'. How can I clean this mess ?
> 
> Plamen> ---
> Plamen> Plamen D. Petkov, plamendp@stripped
> Plamen> ICQ 2214327
> Plamen> FBiS First Bulgarian Internet Store
> Plamen> http://www.bgstore.com
> Plamen> ---
> 
> Hi!
> 
> mysqld gets the above error comes from bind() unix call.  I am not
> aware of any possible error source than that there is someone that is
> using this socket.
> 
> Try starting mysqld directly (without safe_mysqld).
> 
> libexec/mysqld
> 
> Check also the default socket mysqld is trying to use with:
> 
> libexec/mysqld --help
> 
> and
> 
> libexec/mysqld --print-defaults
> 
> Regards,
> Monty
> 

You can get this error if mysqld gets killed while there is an open
connection to it. Then the socket might  go to FIN_WAIT2, while the
client for some reason (he probably does not realize that the connection
is dead) does not send FIN_ACK to finanlize the socket shutdown. In that
situation, if possible, make all the clients exist - they will send a
FIN_ACK, the socket will be closed, and the port will be available
again. If that is not possible or does not help, just wait a few minutes
- most systems will time out FIN_WAIT2 connections withing 5 minutes.

And of course, if someone else is listening on port 3306, you are in
trouble!
-- 
Sasha Pachev
http://www.sashanet.com
Thread
How to close sockets, ports ?Plamen Petkov5 Jul
  • How to close sockets, ports ?Michael Widenius5 Jul
  • Re: How to close sockets, ports ?Sasha Pachev6 Jul