{"action":"created","issue":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/3229","repository_url":"https://api.github.com/repos/Codeception/Codeception","labels_url":"https://api.github.com/repos/Codeception/Codeception/issues/3229/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/3229/comments","events_url":"https://api.github.com/repos/Codeception/Codeception/issues/3229/events","html_url":"https://github.com/Codeception/Codeception/issues/3229","id":160672760,"number":3229,"title":"Db module's cleanup operation hangs indefinitely \"Waiting for table metadata lock\" (MySQL)","user":{"login":"motin","id":793037,"avatar_url":"https://avatars.githubusercontent.com/u/793037?v=3","gravatar_id":"","url":"https://api.github.com/users/motin","html_url":"https://github.com/motin","followers_url":"https://api.github.com/users/motin/followers","following_url":"https://api.github.com/users/motin/following{/other_user}","gists_url":"https://api.github.com/users/motin/gists{/gist_id}","starred_url":"https://api.github.com/users/motin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motin/subscriptions","organizations_url":"https://api.github.com/users/motin/orgs","repos_url":"https://api.github.com/users/motin/repos","events_url":"https://api.github.com/users/motin/events{/privacy}","received_events_url":"https://api.github.com/users/motin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-16T14:16:18Z","updated_at":"2016-06-17T00:29:03Z","closed_at":"2016-06-17T00:29:03Z","body":"Using codeception 2.2.1\r\n\r\nAfter the first test, codeception hangs indefinitely on:\r\n\r\n```\r\nScenario --\r\n```\r\n\r\nMySQL shows that a query `drop table foo` is active with PROCESSLIST_STATE set to \"Waiting for table metadata lock\"\r\n\r\nThe foo table is about the tenth table being dropped. \r\n\r\n```\r\n------------\r\nTRANSACTIONS\r\n------------\r\nTrx id counter 3157747\r\nPurge done for trx's n:o < 3157617 undo n:o < 0 state: running but idle\r\nHistory list length 330\r\nLIST OF TRANSACTIONS FOR EACH SESSION:\r\n---TRANSACTION 3157515, not started\r\nMySQL thread id 3195, OS thread handle 0x7fcca75b9700, query id 1722662 172.17.0.22 6101e6448f1b5d4a Waiting for table metadata lock\r\ndrop table `foo`\r\n---TRANSACTION 3138876, not started\r\nMySQL thread id 3012, OS thread handle 0x7fcca767c700, query id 1722665 192.168.99.1 root init\r\nSHOW ENGINE INNODB STATUS\r\n---TRANSACTION 0, not started\r\nMySQL thread id 3011, OS thread handle 0x7fcca763b700, query id 1718616 192.168.99.1 root cleaning up\r\n---TRANSACTION 3157614, ACTIVE 4 sec\r\nMySQL thread id 3199, OS thread handle 0x7fcca75fa700, query id 1722637 172.17.0.22 6101e6448f1b5d4a cleaning up\r\nTrx read view will not see trx with id >= 3157615, sees < 3157615\r\n```\r\n\r\nKilling the query is the only way to interrupt codeception and get back to the shell:\r\n\r\n```\r\nScenario --\r\n\r\n  [Codeception\\Exception\\ModuleException]\r\n  Db: SQLSTATE[70100]: \\Unknown error>>: 1317 Query execution was interrupted\r\n\r\n\r\nException trace:\r\n () at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Module/Db.php:270\r\n Codeception\\Module\\Db->cleanup() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Module/Db.php:226\r\n Codeception\\Module\\Db->_before() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php:58\r\n Codeception\\Subscriber\\Module->before() at n/a:n/a\r\n call_user_func() at /app/dna/vendor/symfony/event-dispatcher/EventDispatcher.php:184\r\n Symfony\\Component\\EventDispatcher\\EventDispatcher->doDispatch() at /app/dna/vendor/symfony/event-dispatcher/EventDispatcher.php:46\r\n Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/PHPUnit/Listener.php:124\r\n Codeception\\PHPUnit\\Listener->fire() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/PHPUnit/Listener.php:95\r\n Codeception\\PHPUnit\\Listener->startTest() at /app/vendor/neam/yii-dna-test-framework/vendor/phpunit/phpunit/src/Framework/TestResult.php:388\r\n PHPUnit_Framework_TestResult->startTest() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Test/Test.php:68\r\n Codeception\\Test\\Test->run() at /app/vendor/neam/yii-dna-test-framework/vendor/phpunit/phpunit/src/Framework/TestSuite.php:753\r\n PHPUnit_Framework_TestSuite->run() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/PHPUnit/Runner.php:98\r\n Codeception\\PHPUnit\\Runner->doEnhancedRun() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/SuiteManager.php:152\r\n Codeception\\SuiteManager->run() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Codecept.php:209\r\n Codeception\\Codecept->runSuite() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Codecept.php:178\r\n Codeception\\Codecept->run() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Command/Run.php:329\r\n Codeception\\Command\\Run->runSuites() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Command/Run.php:256\r\n Codeception\\Command\\Run->execute() at /app/vendor/neam/yii-dna-test-framework/vendor/symfony/console/Command/Command.php:256\r\n Symfony\\Component\\Console\\Command\\Command->run() at /app/vendor/neam/yii-dna-test-framework/vendor/symfony/console/Application.php:815\r\n Symfony\\Component\\Console\\Application->doRunCommand() at /app/vendor/neam/yii-dna-test-framework/vendor/symfony/console/Application.php:186\r\n Symfony\\Component\\Console\\Application->doRun() at /app/vendor/neam/yii-dna-test-framework/vendor/symfony/console/Application.php:117\r\n Symfony\\Component\\Console\\Application->run() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/src/Codeception/Application.php:103\r\n Codeception\\Application->run() at /app/vendor/neam/yii-dna-test-framework/vendor/codeception/codeception/codecept:33\r\n```\r\n\r\nGlobal codeception.yml:\r\n\r\n```\r\npaths:\r\n    tests: ./codeception\r\n    log: ./codeception/_log\r\n    data: ./codeception/_data\r\n    helpers: ./codeception/_helpers\r\nsettings:\r\n    bootstrap: _bootstrap.php\r\n    suite_class: \\PHPUnit_Framework_TestSuite\r\n    colors: true\r\n    memory_limit: 1024M\r\n    log: true\r\nmodules:\r\n    config:\r\n        Db:\r\n            dsn: 'mysql:host=localdb;port=3306;dbname=db_test'\r\n            user: '...'\r\n            password: '...'\r\n            dump: ./codeception/_data/dump.sql\r\n            populate: true\r\n            cleanup: true\r\n            reconnect: true\r\n        MailCatcher:\r\n            url: 'http://mailcatcher'\r\n            port: '25'\r\n```\r\n\r\nTest suit yml:\r\n\r\n```\r\nclass_name: CodeGuy\r\nmodules:\r\n    enabled: [Db, CodeHelper, Asserts]\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/comments/226651560","html_url":"https://github.com/Codeception/Codeception/issues/3229#issuecomment-226651560","issue_url":"https://api.github.com/repos/Codeception/Codeception/issues/3229","id":226651560,"user":{"login":"DavertMik","id":220264,"avatar_url":"https://avatars.githubusercontent.com/u/220264?v=3","gravatar_id":"","url":"https://api.github.com/users/DavertMik","html_url":"https://github.com/DavertMik","followers_url":"https://api.github.com/users/DavertMik/followers","following_url":"https://api.github.com/users/DavertMik/following{/other_user}","gists_url":"https://api.github.com/users/DavertMik/gists{/gist_id}","starred_url":"https://api.github.com/users/DavertMik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavertMik/subscriptions","organizations_url":"https://api.github.com/users/DavertMik/orgs","repos_url":"https://api.github.com/users/DavertMik/repos","events_url":"https://api.github.com/users/DavertMik/events{/privacy}","received_events_url":"https://api.github.com/users/DavertMik/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T00:29:03Z","updated_at":"2016-06-17T00:29:03Z","body":"Sorry I'd like to help more but Db module is really basic and can't handle such MySQL edge cases. If you know how to solve this issue: please send PR and we will accept it."}}
{"actor":{"display_login":"DavertMik"}}