{"action":"created","issue":{"url":"https://api.github.com/repos/mscdex/node-mariasql/issues/114","labels_url":"https://api.github.com/repos/mscdex/node-mariasql/issues/114/labels{/name}","comments_url":"https://api.github.com/repos/mscdex/node-mariasql/issues/114/comments","events_url":"https://api.github.com/repos/mscdex/node-mariasql/issues/114/events","html_url":"https://github.com/mscdex/node-mariasql/issues/114","id":111936215,"number":114,"title":"Streaming doesn't seem to work properly with explicitly created connections","user":{"login":"blah238","id":538730,"avatar_url":"https://avatars.githubusercontent.com/u/538730?v=3","gravatar_id":"","url":"https://api.github.com/users/blah238","html_url":"https://github.com/blah238","followers_url":"https://api.github.com/users/blah238/followers","following_url":"https://api.github.com/users/blah238/following{/other_user}","gists_url":"https://api.github.com/users/blah238/gists{/gist_id}","starred_url":"https://api.github.com/users/blah238/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blah238/subscriptions","organizations_url":"https://api.github.com/users/blah238/orgs","repos_url":"https://api.github.com/users/blah238/repos","events_url":"https://api.github.com/users/blah238/events{/privacy}","received_events_url":"https://api.github.com/users/blah238/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-17T01:16:47Z","updated_at":"2015-10-20T12:53:29Z","closed_at":null,"body":"It looks like the query's `result` event never gets emitted if `connect()` is used. Normal (buffered) queries work fine with `connect()`, and streaming works fine without `connect()`. \r\n\r\nI'm using `mariasql@0.2.1` and Node 4.2.1. Environment is an Ubuntu Trusty 64-bit VM (VirtualBox/Vagrant) on a Windows 7 64-bit host. Database is MySQL 5.6.\r\n\r\nNote that streaming with explicitly created connections worked in previous versions (0.1.x).\r\n\r\nThis works fine:\r\n\r\n```js\r\n// working.js\r\n\r\nvar Client = require('mariasql');\r\n\r\nvar c = new Client({\r\n  host: '127.0.0.1',\r\n  user: 'root',\r\n  password: '',\r\n  db: 'maria_test'\r\n});\r\n\r\nvar query = c.query('SELECT * FROM users');\r\n\r\nquery.on('result', function (res) {\r\n  console.log('stream begin');\r\n  res.on('data', function (data) {\r\n    console.log(data.id)\r\n  });\r\n}).on('end', function() {\r\n  console.log('stream end');\r\n});\r\n\r\nc.on('end', function () {\r\n  console.log('client end');\r\n});\r\n\r\nc.end();\r\n```\r\nOutput:\r\n```\r\nvagrant@vagrant-ubuntu-trusty-64:~/maria-test$ node working.js\r\nstream begin\r\n1\r\n2\r\n3\r\nstream end\r\nclient end\r\nvagrant@vagrant-ubuntu-trusty-64:~/maria-test$\r\n```\r\n\r\nHowever, this fails (`result` is never emitted):\r\n\r\n```js\r\n// failing.js\r\n\r\nvar Client = require('mariasql');\r\n\r\nvar c = new Client();\r\n\r\nc.connect({\r\n  host: '127.0.0.1',\r\n  user: 'root',\r\n  password: '',\r\n  db: 'maria_test'\r\n});\r\n\r\nc.on('ready', function () {\r\n  console.log('ready');\r\n\r\n  var query = c.query('SELECT * FROM users');\r\n\r\n  query.on('result', function (res) {\r\n    console.log('stream begin');\r\n    res.on('data', function (data) {\r\n      console.log(data.id)\r\n    });\r\n  }).on('end', function() {\r\n    console.log('stream end');\r\n  });\r\n\r\n  c.end();\r\n});\r\n\r\nc.on('end', function () {\r\n  console.log('client end');\r\n});\r\n```\r\n\r\nOutput:\r\n```\r\nvagrant@vagrant-ubuntu-trusty-64:~/maria-test$ node failing.js\r\nready\r\nclient end\r\nvagrant@vagrant-ubuntu-trusty-64:~/maria-test$\r\n```\r\n\r\nIs this a bug or am I doing something wrong?"},"comment":{"url":"https://api.github.com/repos/mscdex/node-mariasql/issues/comments/149557055","html_url":"https://github.com/mscdex/node-mariasql/issues/114#issuecomment-149557055","issue_url":"https://api.github.com/repos/mscdex/node-mariasql/issues/114","id":149557055,"user":{"login":"Nibbler999","id":935710,"avatar_url":"https://avatars.githubusercontent.com/u/935710?v=3","gravatar_id":"","url":"https://api.github.com/users/Nibbler999","html_url":"https://github.com/Nibbler999","followers_url":"https://api.github.com/users/Nibbler999/followers","following_url":"https://api.github.com/users/Nibbler999/following{/other_user}","gists_url":"https://api.github.com/users/Nibbler999/gists{/gist_id}","starred_url":"https://api.github.com/users/Nibbler999/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nibbler999/subscriptions","organizations_url":"https://api.github.com/users/Nibbler999/orgs","repos_url":"https://api.github.com/users/Nibbler999/repos","events_url":"https://api.github.com/users/Nibbler999/events{/privacy}","received_events_url":"https://api.github.com/users/Nibbler999/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T12:53:29Z","updated_at":"2015-10-20T12:53:29Z","body":"Only seems to be reproducible on single core machines. I expect @blah238 only has a single core in the VM. #114 fixes it."}}