{"action":"created","issue":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/385","labels_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/385/labels{/name}","comments_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/385/comments","events_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/385/events","html_url":"https://github.com/go-sql-driver/mysql/issues/385","id":116766817,"number":385,"title":"Issues with GET_LOCK and a too long lock name on MySQL 5.7","user":{"login":"dveeden","id":1272980,"avatar_url":"https://avatars.githubusercontent.com/u/1272980?v=3","gravatar_id":"","url":"https://api.github.com/users/dveeden","html_url":"https://github.com/dveeden","followers_url":"https://api.github.com/users/dveeden/followers","following_url":"https://api.github.com/users/dveeden/following{/other_user}","gists_url":"https://api.github.com/users/dveeden/gists{/gist_id}","starred_url":"https://api.github.com/users/dveeden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dveeden/subscriptions","organizations_url":"https://api.github.com/users/dveeden/orgs","repos_url":"https://api.github.com/users/dveeden/repos","events_url":"https://api.github.com/users/dveeden/events{/privacy}","received_events_url":"https://api.github.com/users/dveeden/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-13T13:17:20Z","updated_at":"2015-11-13T14:20:30Z","closed_at":null,"body":"When running the GET_LOCK() SQL statement with a too long lock name via db.Exec on a MySQL 5.7 the statement seems to hang.\r\n\r\nThe maximum name of the name of the lock given to GET_LOCK() in MySQL 5.7 is shorter than the one in MySQL 5.6. So I would expect an error to be returned, but this doesn't happen.\r\n\r\nIt looks like it gets a ErrBadConn and then retries a few times as described on https://www.vividcortex.com/blog/2015/01/19/gos-connection-pool-retries-and-timeouts/\r\nSo it probably takes 10*timeout before it really returns.\r\n\r\nThis is the behaviour of a mysql session:\r\n```\r\nmysql-5.7> SELECT GET_LOCK('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', '5');\r\nERROR 3057 (42000): Incorrect user-level lock name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'.\r\n```\r\n\r\nTestcase:\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"database/sql\"\r\n\t_ \"github.com/go-sql-driver/mysql\"\r\n)\r\n\r\nfunc main () {\r\n\tdb, err := sql.Open(\"mysql\", \"user:host@tcp(127.0.0.1:3306)/mydb\")\r\n\tif err != nil { panic(err.Error()) }\r\n\tres, err := db.Exec(\"SELECT VERSION()\")\r\n\tif err != nil { panic(err.Error()) } else { println(res) }\r\n\tres, err = db.Exec(\"SELECT VERSION()\")\r\n\tif err != nil { panic(err.Error()) } else { println(res) }\r\n\tres, err = db.Exec(\"SELECT GET_LOCK('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', '5')\")\r\n\tif err != nil { panic(err.Error()) } else { println(res) }\r\n\tres, err = db.Exec(\"SELECT VERSION()\")\r\n\tif err != nil { panic(err.Error()) } else { println(res) }\r\n\tres, err = db.Exec(\"SELECT VERSION()\")\r\n\tif err != nil { panic(err.Error()) } else { println(res) }\r\n}\r\n```\r\n\r\nCurrent behavior: The testcase will run the first two `SELECT VERSION()` statements and print res and than hangs.\r\nExpected behavior: Quickly return an error"},"comment":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/comments/156444604","html_url":"https://github.com/go-sql-driver/mysql/issues/385#issuecomment-156444604","issue_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/385","id":156444604,"user":{"login":"dveeden","id":1272980,"avatar_url":"https://avatars.githubusercontent.com/u/1272980?v=3","gravatar_id":"","url":"https://api.github.com/users/dveeden","html_url":"https://github.com/dveeden","followers_url":"https://api.github.com/users/dveeden/followers","following_url":"https://api.github.com/users/dveeden/following{/other_user}","gists_url":"https://api.github.com/users/dveeden/gists{/gist_id}","starred_url":"https://api.github.com/users/dveeden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dveeden/subscriptions","organizations_url":"https://api.github.com/users/dveeden/orgs","repos_url":"https://api.github.com/users/dveeden/repos","events_url":"https://api.github.com/users/dveeden/events{/privacy}","received_events_url":"https://api.github.com/users/dveeden/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T14:20:30Z","updated_at":"2015-11-13T14:20:30Z","body":"readUntilEOF() is doing a mc.readPacket() which waits..\r\n\r\nWireshark shows this:\r\n4 packets are returned after the Request:\r\nPacket 1:  number of fields: 1\r\nPacket 2: Column name (the original query)\r\nPacket 3: EOF marker\r\nPacket 4: Error code and SQL state\r\n\r\nI expect that the go-sql-driver expects the EOF marker to be the last packet?"}}