[mythtv] Solved: Could not connect to server "" @ port -1

Marc MERLIN marc_mtv at merlins.org
Tue Sep 23 23:17:41 UTC 2008


[Dear dev folks, see last paragraph on how it would really help if
mythbackend had more error checking/reporting when it gets an empty return
from a crutial mysql query like MasterServerIP]

Ok. I finally got it figured out thanks to help from Mikal Still
who suggested that I trace the mysql queries between the client and server.

Nick was right when he said I should have
MasterServerIP          192.168.205.61  NULL
and not
MasterServerIP          192.168.205.61  myth

but nothing was working when I put NULL in there.
The reason was that I put NULL with phpmyadmin, which put the string "NULL"
as opposed to NULL (empty).
Of course, they look exactly the same when you do an SQL query, so I
couldn't see the difference.

Once I inserted a real NULL back in there, things started working again.

Thanks to all for your patience and help.

I'll suggest some additional debugging/error reporting to the myth-dev
folks, mythbackend should have complained that the 
SELECT data FROM settings WHERE value = 'MasterServerIP' AND hostname IS NULL;
query was returning an empty set and then causing connections to 0.0.0.0
(i.e., it silently continues and fails in the weird ways I saw).

Obviously, this problem doesn't happen too often I hope, but adding a few
error checking statements after those SQL queries would have saved me 10H
and half the hair on my scalp :)

Cheers,
Marc

On Tue, Sep 23, 2008 at 02:37:47PM -0700, Marc MERLIN wrote:
> On Tue, Sep 23, 2008 at 12:27:06PM -0500, Kevin Kuphal wrote:
> > On Tue, Sep 23, 2008 at 11:53 AM, Marc MERLIN <marc_mtv at merlins.org> wrote:
> > 
> > > So, at this point it looks like there is just a small bug in my DB on
> > > backend vs master server, or something that causes my slave backend to be
> > > confused about it.
> > >
> > > Here are my current values:
> > > MasterServerIP          192.168.205.61  myth
> > > ZoneMinderServerIP      192.168.205.61  myth
> > > BackendServerIP         192.168.205.61  myth
> > > BackendServerIP         192.168.205.3   gargamel.svh.merlins.org
> > > BackendServerIP         192.168.205.62  myth-lvr
> > >
> > 
> > Why does gargamel.svh.merlins.org have .3 as the backend IP.  Shouldn't it
> > be .61?
> 
> Doesn't look like it.
> 
> I checked my old DB (before the master backend upgrade and IP change) and it said:
> +--------------------+----------------+--------------------------+
> | value              | data           | hostname                 |
> +--------------------+----------------+--------------------------+
> | BackendServerIP    | 192.168.205.11 | myth                     |
> | MasterServerIP     | 192.168.205.11 | NULL                     |
> | BackendServerIP    | 192.168.205.3  | gargamel.svh.merlins.org |
> | ZoneMinderServerIP | 127.0.0.1      | myth                     |
> +--------------------+----------------+--------------------------+
> 
> BackendServerIP for gargamel did point to itself back then, and that worked fine.
> 
> This however confirmed that I ought to have:
> > > MasterServerIP          192.168.205.61  NULL (not myth)
> > > ZoneMinderServerIP      127.0.0.1  myth (not the server IP)
> 
> But as soon as I set
> MasterServerIP          192.168.205.61  NULL (not myth)
> 
> then my master backend is unable to start as master backend anymore:
> Running as a slave backend.
> 2008-09-23 12:31:51.857 mythbackend: MythBackend started as a slave backend
> 
> so I put the hostname value back to 'myth' instead of NULL and it starts
> as master backend again.
> 
> For now, I stuck with the master backend that says tries to connect to
> 0.0.0.0:65535 which yields Could not connect to server "" @ port -1 
> (see logs below) and the slave that connects to 0.0.0.0:6543 instead of
> 192.168.205.61:6543
> 
> I'm really wondering what I did to get there. Debugging info doesn't help
> much :(
> 
> slave backend:
> > 2008-09-23 14:29:54.593 mythbackend version: 0.21.20080304-1 www.mythtv.org
> > 2008-09-23 14:29:54.593 Enabled verbose msgs: most
> > 2008-09-23 14:29:54.596 SG(): CheckAllStorageGroupDirs(): Checking All Storage Group directories
> > 2008-09-23 14:29:54.596 SG(Default): Checking directory '/var/spool/mythtv/recording.gargamel/' in group 'Default'.
> > 2008-09-23 14:29:55.596 MythSocket(8298430:12): new socket
> > 2008-09-23 14:29:55.597 Connecting to master server: :6543
> > 2008-09-23 14:29:55.597 MythSocket(8298430:12): attempting connect() to (0.0.0.0:6543)
> > 2008-09-23 14:29:55.598 MythSocket(8298430:12): state change Idle -> Connected
> > 2008-09-23 14:29:55.598 Connected successfully
> > 2008-09-23 14:29:55.598 TVRec(5): CancelNextRecording(1) -- begin
> > 2008-09-23 14:29:55.598 TVRec(5): CancelNextRecording(1) -- error, unknown recording
> > 2008-09-23 14:29:55.599 TVRec(6): CancelNextRecording(1) -- begin
> > 2008-09-23 14:29:55.599 TVRec(6): CancelNextRecording(1) -- error, unknown recording
> > 2008-09-23 14:29:55.600 write -> 12 741     ANN SlaveBackend gargamel.svh.merlins.org 192.168.205.3[]:[][]:[]...
> 
> Master backend starts but spews out socket connect errors:
> > 2008-09-23 14:26:54.682 MythSocket(8672618:-1): DownRef: 0
> > 2008-09-23 14:26:54.683 MythSocket(8672618:-1): DownRef: -1
> > 2008-09-23 14:26:54.697 MythSocket(8672618:-1): delete socket
> > 2008-09-23 14:26:59.181 MythSocket(842c7b8:23): new socket
> > 2008-09-23 14:26:59.190 MythSocket(842c7b8:23): setSocket: 22
> > 2008-09-23 14:26:59.196 MythSocket(842c7b8:22): state change Idle -> Connected
> > 2008-09-23 14:26:59.204 MythSocket(842c7b8:22): UpRef: 1
> > 2008-09-23 14:26:59.204 MythSocket(842c7b8:22): socket is readable
> > 2008-09-23 14:26:59.212 MythSocket(842c7b8:22): cb->readyRead()
> > 2008-09-23 14:26:59.213 MythSocket(842c7b8:22): UpRef: 2
> > 2008-09-23 14:26:59.213 read  <- 22 19      ANN Playback myth 0
> > 2008-09-23 14:26:59.221 MainServer::HandleAnnounce Playback
> > 2008-09-23 14:26:59.229 adding: myth as a client (events: 0)
> > 2008-09-23 14:26:59.229 write -> 22 2       OK
> > 2008-09-23 14:26:59.230 MythSocket(84cf630:24): new socket
> > 2008-09-23 14:26:59.237 MythSocket(84cf630:24): setSocket: 23
> > 2008-09-23 14:26:59.246 MythSocket(84cf630:23): state change Idle -> Connected
> > 2008-09-23 14:26:59.246 MythSocket(84cf630:23): UpRef: 1
> > 2008-09-23 14:26:59.254 MythSocket(84cf630:23): socket is readable
> > 2008-09-23 14:26:59.262 MythSocket(84cf630:23): cb->readyRead()
> > 2008-09-23 14:26:59.271 MythSocket(84cf630:23): UpRef: 2
> > 2008-09-23 14:26:59.271 read  <- 23 31      ANN FileTransfer myth 0 0[]:[]/
> > 2008-09-23 14:26:59.279 MainServer::HandleAnnounce FileTransfer
> > 2008-09-23 14:26:59.287 adding: myth as a remote file transfer
> > 2008-09-23 14:26:59.230 MythSocket(842c7b8:22): DownRef: 1
> > 2008-09-23 14:26:59.288 RingBuf(): OpenFile(, 0)
> > 2008-09-23 14:26:59.304 MythSocket(84d0ca8:24): new socket
> > 2008-09-23 14:26:59.312 MythSocket(84d0ca8:24): attempting connect() to (0.0.0.0:65535)
> > 2008-09-23 14:26:59.313 MythSocket(84d0ca8:24): connect() failed (ConnectionRefused)
> > 2008-09-23 14:26:59.321 RemoteFile::openSocket(control socket):
> >                         Could not connect to server "" @ port -1
> > 2008-09-23 14:26:59.321 MythSocket(84d0ca8:24): DownRef: -1
> > 2008-09-23 14:26:59.329 MythSocket(84d0ca8:-1): delete socket
> > 2008-09-23 14:26:59.329 MythSocket(84d0ca8:24): new socket
> > 2008-09-23 14:26:59.337 MythSocket(84d0ca8:24): attempting connect() to (0.0.0.0:65535)
> > 2008-09-23 14:26:59.338 MythSocket(84d0ca8:24): connect() failed (ConnectionRefused)
> > 2008-09-23 14:26:59.346 RemoteFile::openSocket(file data socket):
> >                         Could not connect to server "" @ port -1
> > 2008-09-23 14:26:59.346 MythSocket(84d0ca8:24): DownRef: -1
> > 2008-09-23 14:26:59.346 MythSocket(84d0ca8:-1): delete socket
> > 2008-09-23 14:26:59.354 RingBuffer::RingBuffer(): Failed to open remote file ()
> > 2008-09-23 14:26:59.355 RingBuf(): CalcReadAheadThresh(139279384 KB)
> >                          -> threshhold(64 KB) min read(0 KB) blk size(32 KB)
> > 2008-09-23 14:26:59.362 write -> 23 21      OK[]:[]23[]:[]0[]:[]0
> > 2008-09-23 14:26:59.363 MythSocket(842c7b8:22): socket is readable
> > 2008-09-23 14:26:59.371 MythSocket(842c7b8:22): cb->readyRead()
> > 2008-09-23 14:26:59.379 MythSocket(842c7b8:22): UpRef: 2
> > 2008-09-23 14:26:59.379 read  <- 22 45      QUERY_FILETRANSFER 23[]:[]REQUEST_BLOCK[]:[]0
> > 2008-09-23 14:26:59.387 write -> 22 1       0
> > 2008-09-23 14:26:59.388 MythSocket(842c7b8:22): DownRef: 1
> > 2008-09-23 14:26:59.388 MythSocket(842c7b8:22): socket is readable
> > 2008-09-23 14:26:59.404 MythSocket(842c7b8:22): cb->readyRead()
> > 2008-09-23 14:26:59.412 MythSocket(842c7b8:22): UpRef: 2
> > 2008-09-23 14:26:59.413 read  <- 22 30      QUERY_FILETRANSFER 23[]:[]DONE
> > 2008-09-23 14:26:59.421 write -> 22 2       ok
> > 2008-09-23 14:26:59.429 MythSocket(84cf630:23): socket is readable
> > 2008-09-23 14:26:59.437 MythSocket(84cf630:23): socket closed
> > 2008-09-23 14:26:59.446 MythSocket(84cf630:23): state change Connected -> Idle
> > 2008-09-23 14:26:59.446 MythSocket(84cf630:-1): cb->connectionClosed()
> > 2008-09-23 14:26:59.454 MythSocket(84cf630:-1): DownRef: 0
> > 2008-09-23 14:26:59.454 MythSocket(84cf630:-1): DownRef: -1
> > 2008-09-23 14:26:59.462 MythSocket(84cf630:-1): delete socket
> > 2008-09-23 14:26:59.430 MythSocket(842c7b8:22): state change Connected -> Idle
> > 2008-09-23 14:26:59.471 MythSocket(842c7b8:-1): cb->connectionClosed()
> > 2008-09-23 14:26:59.363 MythSocket(84cf630:-1): DownRef: -1
> > 2008-09-23 14:26:59.480 MythSocket(842c7b8:-1): writeStringList: Error, socket went unconnected.
> > 2008-09-23 14:26:59.496 MythSocket(842c7b8:-1): DownRef: 1
> 
> 
> -- 
> "A mouse is a device used to point at the xterm you want to type in" - A.S.R.
> Microsoft is to operating systems & security ....
>                                       .... what McDonalds is to gourmet cooking
> Home page: http://marc.merlins.org/  
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
> 

-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  


More information about the mythtv-dev mailing list