View Issue Details

IDProjectCategoryView StatusLast Update
1547RackTablesdefaultpublic2016-09-02 18:02
Reportermikemol Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionunable to reproduce 
PlatformLinuxOSCentOSOS Version6
Product Version0.20.10 
Summary1547: usePreparedSelectBlade query fails when run against MySQL 5.7.10
DescriptionUpgraded database from 5.1 to 5.5, then 5.5 to 5.6, then 5.6 to 5.7.10. At the end of the day, one of my IP ranges throws a PDO exception when viewed:

Partial stack trace (proprietary info if I go any further down)

Pdo exception: PDOException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'container_id' in 'where clause' (42S22)

at file /usr/share/RackTables/wwwroot/inc/database.php, line 3979

/usr/share/RackTables/wwwroot/inc/database.php:3979 execute(Array
(
    [0] => object
    [1] => 7
)
)
/usr/share/RackTables/wwwroot/inc/database.php:590 usePreparedSelectBlade('SELECT tag_id, TagStorage.user as tag_user, UNIX_TIMESTAMP(TagStorage.date) AS tag_time, RackObject.id, RackObject.name, RackObject.label, RackObject.asset_no, RackObject.objtype_id, (SELECT MIN(rack_id) FROM RackSpace WHERE object_id = RackObject.id) as rack_id, (SELECT MIN(parent_entity_id) FROM EntityLink WHERE child_entity_type='object' AND child_entity_id = RackObject.id AND parent_entity_type = 'rack') as rack_id_2, (SELECT MIN(parent_entity_id) FROM EntityLink WHERE child_entity_type='object' AND child_entity_id = RackObject.id AND parent_entity_type = 'object') as container_id, (SELECT name FROM RackObject WHERE id = container_id) as container_name, (SELECT objtype_id FROM RackObject WHERE id = container_id) as container_objtype_id, RackObject.has_problems, RackObject.comment, (SELECT COUNT(*) FROM Port WHERE object_id = RackObject.id) as nports, (SELECT domain_id FROM VLANSwitch WHERE object_id = id LIMIT 1) as 8021q_domain_id, (SELECT template_id FROM VLANSwitch WHERE object_id = id LIMIT 1) as 8021q_template_id FROM RackObject LEFT JOIN TagStorage on entity_realm = ? and entity_id = RackObject.id WHERE RackObject.id = ? ORDER BY tag_id', Array
(
    [0] => object
    [1] => 7
)
)
/usr/share/RackTables/wwwroot/inc/interface-lib.php:1066 spotEntity('object', '7')
/usr/share/RackTables/wwwroot/inc/interface.php:2939 makeIPAllocLink('
*#?', Array
(
    [type] => regular
    [name] => snmp
    [object_id] => 7
    [object_name] => erg
)
, 1)
/usr/share/RackTables/wwwroot/inc/interface.php:2850 renderIPv4NetworkAddresses(Array
(


It looks like the container_id subselect isn't visible to subsequent subselects in the query. I suspect some semantic changed between MySQL 5.1 and MySQL 5.7.10 that affects that visibility. Query gets chopped off in the PDO exception, so I can't just feed it into MySQL and start taking it apart to see what's happening. I can pull the full query once I enable the general query log, but I've got other priorities right now.
TagsNo tags attached.

Relationships

related to 1635 closedinfrastation Pdo exception: PDOException 

Activities

adoom42

adoom42

2015-12-09 00:06

administrator   ~0003043

I'm unable to reproduce this issue. Please provide more details and ideally specific steps to reproduce.

Until then, this issue will be considered "on hold pending user data".
mikemol

mikemol

2015-12-10 16:23

reporter   ~0003045

a GET request (while logged into MantisBT) to http://f.q.d.n/racktables/index.php?page=ipv4net&id=3

is the URI I used to trigger the the exception. Short of a full database dump, I really don't know what more I can offer you. We're about to replace this particular MySQL 5.7 instance with a Percona 5.6 instance. In the mean time, maybe try your unit test suite against MySQL 5.7, if you haven't?
mikemol

mikemol

2015-12-10 20:56

reporter   ~0003047

Full query:

SELECT 
    tag_id,
    TagStorage.user AS tag_user,
    UNIX_TIMESTAMP(TagStorage.date) AS tag_time,
    RackObject.id,
    RackObject.name,
    RackObject.label,
    RackObject.asset_no,
    RackObject.objtype_id,
    (SELECT 
            MIN(rack_id)
        FROM
            RackSpace
        WHERE
            object_id = RackObject.id) AS rack_id,
    (SELECT 
            MIN(parent_entity_id)
        FROM
            EntityLink
        WHERE
            child_entity_type = 'object'
                AND child_entity_id = RackObject.id
                AND parent_entity_type = 'rack') AS rack_id_2,
    (SELECT 
            MIN(parent_entity_id)
        FROM
            EntityLink
        WHERE
            child_entity_type = 'object'
                AND child_entity_id = RackObject.id
                AND parent_entity_type = 'object') AS container_id,
    (SELECT 
            name
        FROM
            RackObject
        WHERE
            id = container_id) AS container_name,
    (SELECT 
            objtype_id
        FROM
            RackObject
        WHERE
            id = container_id) AS container_objtype_id,
    RackObject.has_problems,
    RackObject.comment,
    (SELECT 
            COUNT(*)
        FROM
            Port
        WHERE
            object_id = RackObject.id) AS nports,
    (SELECT 
            domain_id
        FROM
            VLANSwitch
        WHERE
            object_id = id
        LIMIT 1) AS 8021q_domain_id,
    (SELECT 
            template_id
        FROM
            VLANSwitch
        WHERE
            object_id = id
        LIMIT 1) AS 8021q_template_id
FROM
    RackObject
        LEFT JOIN
    TagStorage ON entity_realm = 'object'
        AND entity_id = RackObject.id
WHERE
    RackObject.id = '7'
ORDER BY tag_id



When run against Percona 5.6, this works fine. When run against MySQL 5.7 with the same dataset, this fails.
Axenow

Axenow

2016-01-19 15:44

reporter   ~0003109

I can confirm, that this mistake is appeared only in MySQL 5.7.X
infrastation

infrastation

2016-05-19 17:09

administrator   ~0003201

This probably has to do with MySQL SQL mode changes in versions 5.7.x.
racktabler

racktabler

2016-06-02 15:15

reporter   ~0003217

No issues so far with MySQL 5.7.12.

I just removed "NO_ZERO_DATE" from 5.7 default modes, so RT install works

file my.cnf

[mysqld]
sql_mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
infrastation

infrastation

2016-06-02 15:50

administrator   ~0003219

If you try to click a row one of the queries will fail because of ONLY_FULL_GROUP_BY. I would like to avoid managing the MySQL server if possible.
racktabler

racktabler

2016-06-02 16:40

reporter   ~0003221

I clicked some rows but all looks fine.
I also can execute the full query in mysql without errors. (Empty Set of course)
If i change RackObject.id i get some rows.
infrastation

infrastation

2016-06-04 00:27

administrator   ~0003223

A user on the mailing list has experienced the issue I meant.
infrastation

infrastation

2016-06-14 17:48

administrator   ~0003233

The solution to bug 1635 may have worked around this bug too, it would be great if anybody could check and update. I have not seen this bug reproducing.
infrastation

infrastation

2016-06-22 16:16

administrator   ~0003243

Could anybody test if the original issue still reproduces with the change mentioned in the previous comment applied? Thank you.
infrastation

infrastation

2016-06-29 18:35

administrator   ~0003277

This query does not fail on my MySQL server version 5.7.12. To work on this bug it is necessary to see how to reproduce it.
infrastation

infrastation

2016-08-10 23:11

administrator   ~0003425

If anybody can provide exact instructions how to reproduce this issue, please reopen.

Issue History

Date Modified Username Field Change
2015-12-08 16:17 mikemol New Issue
2015-12-09 00:06 adoom42 Note Added: 0003043
2015-12-09 00:06 adoom42 Status new => feedback
2015-12-10 16:23 mikemol Note Added: 0003045
2015-12-10 16:23 mikemol Status feedback => new
2015-12-10 20:56 mikemol Note Added: 0003047
2016-01-19 15:44 Axenow Note Added: 0003109
2016-05-19 17:09 infrastation Note Added: 0003201
2016-06-02 15:15 racktabler Note Added: 0003217
2016-06-02 15:50 infrastation Note Added: 0003219
2016-06-02 16:40 racktabler Note Added: 0003221
2016-06-04 00:27 infrastation Note Added: 0003223
2016-06-04 00:29 infrastation Relationship added related to 1635
2016-06-10 11:08 infrastation Status new => acknowledged
2016-06-14 17:48 infrastation Note Added: 0003233
2016-06-22 16:16 infrastation Note Added: 0003243
2016-06-22 16:16 infrastation Status acknowledged => feedback
2016-06-29 18:35 infrastation Note Added: 0003277
2016-08-10 23:11 infrastation Note Added: 0003425
2016-08-10 23:11 infrastation Status feedback => closed
2016-08-10 23:11 infrastation Resolution open => unable to reproduce
2016-09-02 18:04 hclima Issue cloned: 1681