Bug #101019 LOAD DATA LOCAL INFILE Error Code: 2013. Lost connection to MySQL server during
Submitted: 1 Oct 2020 9:53 Modified: 19 Jan 2021 8:47
Reporter: Hiroshi Nakagawa Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.21 OS:Windows (10 Pro)
Assigned to: CPU Architecture:x86 (Intel(R) Core(TM) i7-6700CPU @ 4.00GHz 4.01 GHz)

[1 Oct 2020 9:53] Hiroshi Nakagawa
Description:
I get an error when I run the following query in Workbench.

ErrorMessage:
"Error Code: 2013. Lost connection to MySQL server during query"

Duration / Fetch: 0.672 sec

Query:
LOAD DATA LOCAL INFILE 'loaddatafile\\t_company.csv' INTO TABLE imp_company
FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY ''
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(
    @company_id,
・
・
・
    @delete_flag
)
SET
    company_id = NULLIF(@company_id,''),
・
・
・
    delete_flag = NULLIF(@delete_flag,'')
;

wb.log:
18:46:00 [DB1][      SqlEditor]: Auto saving workspace
18:46:00 [DB1][      SqlEditor]: Auto saving workspace
18:46:04 [DB1][SQL Editor Form]: Executing SQL in editor: SQL File 3* (current statement only: no)...
18:46:04 [DB1][      SqlEditor]: Auto saving workspace
18:46:04 [DB1][ SqlEditorPanel]: Preparing UI for query run
18:46:04 [DB1][ SqlEditorPanel]: Releasing old recordset(s) (if possible)
18:46:04 [DB2][SQL Editor Form]: Running without considering existing rsets
18:46:04 [DB3][       GRT task]: Sending task "execute sql queries" to dispatcher (don't wait)...
18:46:04 [DB3][  GRTDispatcher]: Running task "execute sql queries"
18:46:04 [DB1][SQL Editor Form]: Background task for sql execution started
18:46:04 [DB3][SQL Editor Form]: Executing statement range: 0, 3260...
18:46:04 [DB3][SQL Editor Form]: Determined statement type: 12
18:46:04 [DB3][SQL Editor Form]: Running...
18:46:04 [DB2][SQL Editor Form]: Updating SQL menu and toolbar
18:46:04 [ERR][SQL Editor Form]: Error Code: 2013. Lost connection to MySQL server during query
18:46:04 [DB3][SQL Editor Form]: Executing statement range: 3303, 3436...
18:46:04 [DB3][SQL Editor Form]: Determined statement type: 0
18:46:04 [DB3][SQL Editor Form]: Running...
18:46:04 [ERR][SQL Editor Form]: Error Code: 2006. MySQL server has gone away
18:46:04 [DB1][SQL Editor Form]: SQL execution finished
18:46:04 [DB2][SQL Editor Form]: Updating SQL menu and toolbar
18:46:04 [DB2][ SqlEditorPanel]: Query successfully finished in editor SQL File 3*
18:46:04 [DB1][        WQE.net]: Post processing sql execution
18:46:04 [DB3][  GRTDispatcher]: Task "execute sql queries" finished
18:46:10 [DB1][      SqlEditor]: Auto saving workspace
18:46:10 [DB1][      SqlEditor]: Auto saving workspace

How to repeat:
The size of t_company.csv is 41.6M.
Running this file in Mysql Workbench 6.3.9 with the same query succeeds.
However, when I run it on Mysql Workbench 8.0.21, I get an error.

Reducing this file to a size of 6M was successful.
I want to know why this is the case.
[20 Oct 2020 10:54] MySQL Verification Team
Hello Hiroshi Nakagawa,

Thank you for the requested details.
I tried to reproduce your issue on windows 10 with workbench 8.0.21 using the data shared but I am not seeing any issues at my end.

Regards,
Ashwini Patil
[20 Oct 2020 10:55] MySQL Verification Team
8.0.21 test results

Attachment: 101019_test_results.PNG (image/png, text), 163.50 KiB.

[21 Oct 2020 3:04] Hiroshi Nakagawa
Hello Ashwini Patil san.

I see, it didn't reappear there.
The following was displayed in the log (wb.1.log) that I sent before
I am interested.

"18:54:51 [ERR][SSHTunnelHandler]: Error during data transfer: unable to read, remote end disconnected"

I'm wondering if there is an error in the SSH connection
Is that environment also an SSH connection?

Thank you for your cooperation.
[18 Jan 2021 18:25] Jonatan Matthias Vinterbaek
I'm experiencing the same also LOAD DATA LOCAL INFILE using SSH.
Also resizing the file (splitting it into smaller parts of 5000 lines) make the problem go away. file size (not split) = 21MB
[19 Jan 2021 8:47] Hiroshi Nakagawa
Dear Jonatan 

We have learned that the same error occurs with SSH and that the error can be avoided by splitting the file.

Will this problem be solved by future software upgrades?

thank you for your cooperation.

Hiroshi Nakagawa.

Regards.