[MDEV-11935] Queries in stored procedures with and EXISTS(SELECT * FROM VIEW) crashes and closes hte conneciton. Created: 2017-01-29 Updated: 2017-02-27 Resolved: 2017-02-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Stored routines |
| Affects Version/s: | 10.0, 10.1, 10.1.21, 10.2 |
| Fix Version/s: | 10.0.30, 10.1.22, 10.2.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Nicholas Denning | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Centos 7 x64 |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 10.0.30 | ||||||||||||||||
| Description |
|
I am getting an error: (conn:7) Could not read packet: unexpected end of stream, read 0 bytes from 4 I see a reference to a similar problem reported in https://jira.mariadb.org/browse/CONJ-348 for the connector. this recommends the solution of adding ?useServerPrepStmts=false to the connection string. Unfortunately I am making heavy use of stored procedures and stored procedures automatically have their prepared statemsnts buffered so the second time I use the procedure it crashes with the above error. this error comes from a statement similar to: SELECT * The view is quite complicated and essentially implements a security system I have been working on for some months so its a bit of blocker to rolling out a system. the text in / |
| Comments |
| Comment by Elena Stepanova [ 2017-01-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What exactly do you mean by "it crashes"? Does the server crash, or does the connector return an exception? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nicholas Denning [ 2017-02-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have added a mysqldump of the test database I have created to illustrate the problem, plus details of the table definitions and the stored procedures that illustrate teh issue. SP_EXAMPLE_SELECT works and has the full query that I am using. SP_EXAMPLE_SELECT2 has the vebose part of the query replaced with a VIEW. SP_EXAMPLE_SELECT2 succeeds the first time it is called, but because the procedure has then been compiled and the plan stored, it then fails on the second call with the error loosing the connection below. error 2013 (HY000) Lost connection to MySQL Server during query. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nicholas Denning [ 2017-02-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena, when I say it crashes, what I mean is that I get an error error 2013 (HY000) Lost connection to MySQL Server during query. and the connection is lost. this is consistent, whether I am running mysql on the linux machine where the database is located, or else running a tool such as Heidi to connect from my development environment. So perhaps your implication is correct that I should not have used the phrase crash. if I try to re-run on using mysql I get a message ERROR 2006 (HY000) : MySQL Server has gone away. So my session reconnects, runs the query again the first time but fails on a second try. Incidentally did I say, I am running on Centos 7, configured as a minimum server with all yum updates up to date. Mariadb is installed by deploying the MariaDB.repo file and then using yum to install / update. I am currently running MariaDB 10.1.21 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nicholas Denning [ 2017-02-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sorry did not read your note properly. Attached is the error log. For some reason on my system there was no error log being produced as far as i could see so I have defined log_error to be a file in the /tmp directory so I can get some output. I fired the query a couple of times to show it erroring then reconnecting then erroring again. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nicholas Denning [ 2017-02-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena, sorry about the two account thing. Not quite sure what happened there, but i can get to this via the link. do you have enough information now? I note your reference to a SHOW CREATE ... and I am not quite sure what is meant there. Anyway hopefully the exmple in the code and data in the example dump file will be sufficient as it is i hope repeatable for you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-02-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks a lot for the report and test case. Yes, I can reproduce it now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-02-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
sanja,
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-02-22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
looks like a bit deja vu (some of 10.2 bugs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-02-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
WHERE condition is impossible, so probably subselect also is reboved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-02-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Problem is that Item taken out of subselect in first execution on second start finding SELECT_LEX from current (which is top SELECT). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-02-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
revision-id: 5eb9c19cfe3d5d0150d63a0fa3d5ea4f7a63f680 (mariadb-10.0.29-34-g5eb9c19)
Use correct start point even for taken out from subselect items in process of exists2in conversion. — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-02-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
github branch bb-10.0- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2017-02-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sanja, Ok to push, but see my question in email. |