Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#9756 closed Bug Report - General (fixed)

DBHostName=localhost causes MythSocket to attempt to contact mysql on ::1 (ipv6 localhost)

Reported by: Stuart Auchterlonie Owned by:
Priority: minor Milestone: 0.25
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by Stuart Auchterlonie)

I have a mysql.txt as follows.

DBHostName=localhost
DBUserName=mythtv
DBPassword=password
DBName=mythconverg
DBType=QMYSQL3

When the backend tries to startup it fails to connect to mysql because it attempts to contact it on the ipv6 localhost address (which mysql doesn't even support before 5.5). Logs are as follows

2011-04-30 18:43:21.886 mythbackend version: master [v0.25pre-1867-gad091ec-dirty] www.mythtv.org
2011-04-30 18:43:21.906 Using runtime prefix = /usr/local/myth-svn
2011-04-30 18:43:21.930 Using configuration directory = /home/mythdev/.mythtv
2011-04-30 18:43:21.956 (old)Settings::ReadSettings(settings.txt) - No such file
2011-04-30 18:43:21.982 (old)Settings::ReadSettings(settings.txt) - No such file
2011-04-30 18:43:22.005 (old)Settings::ReadSettings(/usr/local/myth-svn/share/mythtv/mysql.txt) - No such file
2011-04-30 18:43:22.030 (old)Settings::ReadSettings(/usr/local/myth-svn/etc/mythtv/mysql.txt) - No such file
2011-04-30 18:43:22.056 (old)Settings::ReadSettings(/home/mythdev/.mythtv/mysql.txt) - 'DBHostName' = 'localhost'.
2011-04-30 18:43:22.081 (old)Settings::ReadSettings(/home/mythdev/.mythtv/mysql.txt) - 'DBUserName' = 'mythtv'.
2011-04-30 18:43:22.109 (old)Settings::ReadSettings(/home/mythdev/.mythtv/mysql.txt) - 'DBPassword' = 'password'.
2011-04-30 18:43:22.125 (old)Settings::ReadSettings(/home/mythdev/.mythtv/mysql.txt) - 'DBName' = 'mythconverg'.
2011-04-30 18:43:22.142 (old)Settings::ReadSettings(/home/mythdev/.mythtv/mysql.txt) - 'DBType' = 'QMYSQL3'.
2011-04-30 18:43:22.159 (old)Settings::ReadSettings(./mysql.txt) - No such file
2011-04-30 18:43:22.175 Empty LocalHostName.
2011-04-30 18:43:22.192 Using localhost value of ganymede
2011-04-30 18:43:22.209 MCP::DefaultUPnP() - No default UPnP backend
2011-04-30 18:43:22.226 MythSocket(2008ac0:0): new socket
2011-04-30 18:43:22.267 MythSocket(2008ac0:0): attempting connect() to (0:0:0:0:0:0:0:1:3306)
2011-04-30 18:43:22.291 MythSocket(2008ac0:0): connect() failed (InternalError)
2011-04-30 18:43:22.308 MythSocket(2008ac0:0): DownRef: -1
2011-04-30 18:43:22.325 MythSocket(2008ac0:-1): delete socket
2011-04-30 18:43:22.342 SSDP::ctor - Starting up SSDP Thread...
2011-04-30 18:43:22.359 SSDP::ctor - SSDP Thread Started.
2011-04-30 18:43:22.360 SSDP::Run - SSDP Thread Started.
2011-04-30 18:43:22.415 SSDPCache - Constructor
2011-04-30 18:43:22.472 TaskQueue::ctor - Starting TaskQueue Thread...
2011-04-30 18:43:22.491 TaskQueue::ctor - TaskQueue Thread Started.
.2011-04-30 18:43:22.492 TaskQueue::run - TaskQueue Thread Running.
...........................................................................
2011-04-30 18:43:24.424 UPnPautoconf() - No UPnP backends found
2011-04-30 18:43:24.446 No UPnP backends found

No UPnP backends found

Would you like to configure the database connection now? [no]  
[console is not interactive, using default 'no']
2011-04-30 18:43:24.563 Failed to init MythContext.

You can see mythsocket attempt to connect to the incorrect address MythSocket?(2008ac0:0): attempting connect() to (0:0:0:0:0:0:0:1:3306) which immediately fails because mysql isn't listening there.

I've worked around the issue for now, by setting DBHostName=<hostname>

Change History (3)

comment:1 Changed 13 years ago by Stuart Auchterlonie

Description: modified (diff)

comment:2 Changed 13 years ago by Github

Milestone: unknown0.25
Resolution: fixed
Status: newclosed

Don't ping DB port for localhost.

Do not test to see if something is listening on the DB host and port if the DB host is localhost. This change is required on systems that have localhost mapped to the ipv6 ::1 or that disable MySQL TCP/IP connections, after the change at 859ad36a6 (and, for users that specify 127.0.0.1 for the DBHostName, the change at 3364c44e4).

Users who changed to the routable IP address, rather than using localhost or 127.0.0.1 for the DBHostName while this was broken should change back, now, to get best performance.

Fixes #9756. Thanks to Chris Pinkham for finding the cause.

Changeset: 03f345115494ab6a64dfb4abac140bca462503ee

comment:3 Changed 13 years ago by Github

Don't ping DB port for localhost.

Do not test to see if something is listening on the DB host and port if the DB host is localhost. This change is required on systems that have localhost mapped to the ipv6 ::1 or that disable MySQL TCP/IP connections, after the change at 859ad36a6 (and, for users that specify 127.0.0.1 for the DBHostName, the change at 3364c44e4).

Users who changed to the routable IP address, rather than using localhost or 127.0.0.1 for the DBHostName while this was broken should change back, now, to get best performance.

Fixes #9756. Thanks to Chris Pinkham for finding the cause.

Branch: new-logging Changeset: 03f345115494ab6a64dfb4abac140bca462503ee

Note: See TracTickets for help on using tickets.