Bug #84312 Python MySQL cursor freezes at end of loop
Submitted: 22 Dec 2016 8:23 Modified: 26 Jan 2017 11:50
Reporter: Bender Rodriguez Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / Python Severity:S1 (Critical)
Version:2.1.3 OS:MacOS (OS X Yosemite 10.10.5)
Assigned to: Assigned Account CPU Architecture:Any
Tags: cursor, MySQL

[22 Dec 2016 8:23] Bender Rodriguez
Description:
sSQL = "select * from addresses"

oMySQLConfig = {
                'user': 'XXXXX',
                'host': 'XXXXX',
                'database': 'xxxxx',
                'raise_on_warnings': True,
                'charset': 'utf8mb4'
                }   

oConnection = mysql.connector.connect(**oMySQLConfig)

rsDocums = oConnection.cursor(dictionary=True)  
rsDocums.execute(sSQL)

row = rsDocums.fetchone()
while row is not None:
    print (row)
    row = rsDocums.fetchone()

How to repeat:
Create a table containing 3millions rows. Select 200,000 of these (do select *)

Schema:

CREATE TABLE `documents` (
  `docum_pkey` int(11) NOT NULL AUTO_INCREMENT,
  `docum_sorce_fkey` int(11) NOT NULL DEFAULT '0',
  `docum_url` varchar(3000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_title` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_title_en` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_description` varchar(5000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_description_en` varchar(5000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_title_tagged` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_title_stemmed` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_description_tagged` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_description_stemmed` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `docum_publish_dttm` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `docum_raw_html` mediumblob NOT NULL,
  `docum_tf_table` mediumblob NOT NULL,
  `docum_create_dttm` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`docum_pkey`),
  KEY `idx_documents_docum_url` (`docum_url`(191)),
  KEY `idx_documents_docum_publish_dttm` (`docum_publish_dttm`),
  KEY `idx_documents_docum_sorce_fkey` (`docum_sorce_fkey`),
  KEY `idx_documents_docum_create_dttm` (`docum_create_dttm`)
) ENGINE=InnoDB AUTO_INCREMENT=3313890 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
[22 Dec 2016 8:25] Bender Rodriguez
EDIT:

sSQL = "select * from addresses"

SHOULD BE

sSQL = "select * from documents"
[26 Dec 2016 11:50] Chiranjeevi Battula
Hello Bender Rodriguez,

Thank you for the bug report.
I tried to reproduce the issue at my end using Python 2.7.10 & 3.4.4 , MySQL 5.7.17 and Connector 2.1.4 but not seeing any issues in selecting data 5 millions records with setting global variable "max_allowed_packet".

Thanks,
Chiranjeevi.
[27 Jan 2017 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".