Tuesday, 2018-04-03

*** harlowja has quit IRC01:50
*** harlowja has joined #ara02:31
*** bcoca has quit IRC02:39
*** harlowja has quit IRC03:55
*** leucos has quit IRC04:55
*** leucos has joined #ara07:26
*** resmo has joined #ara08:10
*** leucos has quit IRC10:25
*** cliles_ has joined #ara10:48
*** cliles has quit IRC10:48
*** tbielawa has joined #ara12:46
*** bcoca has joined #ara13:19
*** bcoca has joined #ara13:19
*** Phinnay has joined #ara13:40
Phinnayhey there13:41
Phinnaygetting a weird error with the ara_write plugin - i have it in a playbook recording info from a set of VM's13:42
Phinnaythe first VM is recorded just fine and any subsequent ones fail with the error:13:42
Phinnay [WARNING]: Failure using method (v2_runner_on_failed) in callback plugin (<ansible.plugins.callback.log_ara.CallbackModule object at 0x7f4deb3e35d0>): (pymysql.err.OperationalError) (2006, "MySQL server has gone away (error(32, 'Broken pipe'))")13:42
Phinnayanother clue is further into the failure message:13:43
Phinnay"msg": "Data not recorded in ARA: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back13:43
Phinnayim not doing anything earth shattering with ara_record, just passing it a key and some json as a value13:46
Phinnayit *seems* like something is not closing or flushing properly when ara goes to move data to SQL13:52
*** resmo has quit IRC13:59
dmsimardPhinnay: hi14:02
Phinnayhullo14:02
dmsimardJust to get some background/context, how are you using it ? In a playbook ? a role ? against a single host ? many ?14:03
Phinnayin a playbook against numerous hosts14:04
Phinnayhttps://imgur.com/a/Nvi4A14:08
Phinnaythe playbook in question14:08
Phinnayhttps://imgur.com/i620yKj14:13
Phinnaysome run output14:13
Phinnayin this case only the VM in green passed the rest of them failed14:13
Phinnayall with the same failure message14:13
dmsimardPhinnay: hey, I'm not forgetting you but I'm on multiple threads right now14:37
Phinnayno worries, i appreciate you looking into this.14:38
dmsimardPhinnay: I can sort of point you in the direction I would look in ?14:38
dmsimardI honestly haven't tested ara_record against multiple hosts in the sense that it's really an action plugin (not an ansible module) and those are only ever executed locally on the control node (where ansible-playbook is run from)14:39
dmsimardIn my usage of ara record, either I would record things in a play scoped to localhost or I would delegate to localhost14:39
dmsimardultimately, we can probably chat about your use case and settle on something that works14:40
Phinnayalright, if im using it in a boneheaded way thats an acceptable answer ;p but having the ability to record data per node in this fashion has value.14:43
Phinnayas long as i can record per host items into ARA in some way it'd be great to explore options14:45
dmsimardyeah, I mean, ultimately it's still some sort of rudimentary key/value store but as long as keys are unique (which I feel like you're doing) it should work14:50
Phinnayright14:52
Phinnaythe key is the node name and the data is a json array containing all the updates needed for the node14:52
Phinnaythere will be duplicate data in the json but key will be unique14:52
dmsimardis that "MySQL server has gone away" error reproducible all the time ?14:55
Phinnayyes, each time i've run a playbook where it writes multiple VM's to ARA it gives that error14:56
Phinnayits random-ish what VM succeeds but its always one of the first few14:56
dmsimardPhinnay: can you try something ? It's totally a stab in the dark but worth trying15:00
Phinnaysure!15:00
dmsimardPhinnay: so there's this patch here that has had some amount of success with MySQL users but it's not merged yet for a mix of good and bad reasons: https://review.openstack.org/#/c/524427/15:02
dmsimardPhinnay: could you install ara from source with that patch ? something like https://ara-community.slack.com/files/U6U5DKJ59/F9WA3RFHB/test_unmerged_patch.sh15:03
dmsimard(not sure if that slack link works publicly? it's a snippet I gave someone the other day)15:03
Phinnayi do not have access to that slack site15:04
dmsimardPhinnay: okay, here: http://paste.openstack.org/show/718303/15:04
Phinnayok i ran each of those lines as root, no errors15:07
Phinnaytry running the playbook now?15:08
dmsimardPhinnay: so ara is installed as a system-wide package ?15:09
Phinnaycorrect15:09
dmsimardok15:10
dmsimardthat patch by itself is feature disabled, you need to add a config15:10
dmsimardsec15:10
dmsimardSpamapS: do you know what settings you're putting for the sql alchemy pool things in ara ?15:10
ara-slack<sethrei> Does ara have to be installed on the same server as the machine you are running ansible on ? I was trying to figure out how to have a separate web/db server from the machine I run ansible on.15:11
dmsimard@sethrei: nope, there's a FAQ that explains exactly that: https://ara.readthedocs.io/en/latest/faq.html#can-ansible-with-ara-run-on-a-different-server-than-the-web-application15:11
ara-slack<sethrei> sweet15:11
dmsimard@sethrei: long story short, your components just need to "agree" on where the database is located and have access to it15:12
ara-slack<sethrei> @dmsimard ahhhhhh ... that means I need to expose the port on my docker container ... gotcha15:13
Phinnayokay give me a second got a phone call15:14
ara-slack<sethrei> @dmsimard does the flask app need be running on both hosts ?15:28
ara-slack<dmsimard> The flask app is the web application server, it only reads from the database15:30
ara-slack<dmsimard> It's not required for the callback or the CLI (as long as each are configured to point to the right database)15:31
ara-slack<sethrei> @dmsimard okay ... I'm just trying to debug. Thanks15:31
ara-slack<sethrei> @dmsimard and a simple `ansible  localhost -m setup ` should work ?15:33
ara-slack<dmsimard> Actually no, adhoc commands aren't recorded by ARA (yet) but it's a planned feature15:33
ara-slack<dmsimard> You can probably tell if your configuration is taken into account by checking if there's a ~/.ara/ansible.sqlite file15:34
ara-slack<dmsimard> If there's a database there, you're probably not using mysql15:34
ara-slack<sethrei> @dmsimard ahhh15:34
ara-slack<sethrei> @dmsimard I'm actually using Postgres ... but good to know adhoc doesn't work yet15:37
ara-slack<dmsimard> Postgre should work fine too15:37
ara-slack<dmsimard> There was a patch for postgre that wasn't merged though, would be nice if you could actually vouch for it (I don't use postgre)15:38
ara-slack<dmsimard> Oh nm that was mysql15:38
ara-slack<sethrei> @dmsimard I'm not able to connect yet ... so don't know15:39
ara-slack<sethrei> @dmsimard and there is no need to set `callback_whitelist` and `stdout_callback` ?15:45
dmsimard@sethrei: nope, don't need to set either of those15:46
ara-slack<sethrei> okay ...15:46
dmsimard@sethrei: you should have at a minimum two config parameters15:46
dmsimardFor where you run Ansible from (the "control" node, can be your laptop or whatever) you need callback_plugins = <path to ara's plugins callbacks directory> under [defaults] in ansible.cfg15:47
dmsimardand then you also need something like "database = postgresql+psycopg2://user:password@dbserver:5432/ara" under the [ara] block15:48
dmsimardthe web application server also needs to know about this database, depending on how you run the webapp this can be done through env variables, ansible.cfg or even SetEnv apache directives (if running with mod_wsgi)15:49
dmsimardThe configuration is loaded in the exact same way as ansible, same order of precedence and everything15:49
Phinnay@dmsimard ok im back - confused as to what I have to do to enable the feature on the patch15:50
dmsimard@sethrei: so typically you'll have $PWD/ansible.cfg, ~/ansible.cfg (I think?), /etc/ansible/ansible.cfg and then environment variables have priority over any of those config15:50
Phinnaymysql is installed on the same PC as ARA/Ansible there is nothing remote15:50
dmsimardPhinnay: yeah, I was asking SpamapS if he could share his configuration for those sqlalchemy pool settings15:51
ara-slack<dmsimard> @harlowja ^ if you're around15:51
ara-slack<harlowja> File uploaded https://ara-community.slack.com/files/U6V9WRRTM/FA0ANPV0T/-.txt / https://slack-files.com/T6VAB05L7-FA0ANPV0T-6ad6ce43fb - our template for ansible.cfg.j215:52
ara-slack<dmsimard> @harlowja no cows? you're no fun15:53
ara-slack<harlowja> lol15:53
Phinnaylol what is the cows thing about15:53
dmsimardPhinnay: by default ansible gives the results with cowsay :)15:54
dmsimardhttps://michaelheap.com/cowsay-and-ansible/15:54
PhinnayOH haha15:54
dmsimardPhinnay: do you configure ansible/ara with an ansible.cfg file ?15:54
Phinnayyes i do15:54
dmsimardPhinnay: ok, try adding this to your [ara] block: http://paste.openstack.org/raw/718309/15:54
dmsimardneed to afk for lunch, I'll be back later.. let me know if that seems to improve things for you ?15:55
Phinnaysure thing, im rerunning the playbook now15:56
Phinnayok that had the most success...16:03
Phinnayhttps://imgur.com/hTNa6sD16:03
Phinnaybut weird error:16:04
Phinnayu"Duplicate entry 'dcfffd09-0112-440b-bcd6-9a44e27c1e2e-Common-PRD-VM1' for key 'playbook_id'") [SQL: u'INSERT INTO hosts (id, playbook_id, name) VALUES (%(id)s, %(playbook_id)s, %(name)s)'] [parameters: {'playbook_id': u'dcfffd09-0112-440b-bcd6-9a44e27c1e2e', 'id': '473e8ff2-7773-4b05-a275-c8bbc9daa24a', 'name': u'Common-PRD-VM1'}] (Background on this error at: http://sqlalche.me/e/gkpj)16:04
Phinnaynothing in the playbook would duplicate that...16:04
SpamapSdmsimard: I'll looks16:04
SpamapSlook even16:04
SpamapSugh.. slack<->irc bridges are so.. weird.16:05
dmsimardSpamapS: harlowja gave me what I was looking for16:11
dmsimardPhinnay: that error is foreign to me16:16
Phinnaysame!16:16
Phinnayno idea what would duplicate or why16:16
dmsimardPhinnay: tl;dr, there can only be one host named "something" for a playbook. Do you run multiple plays ? Default ansible strategy (i.e, not free or serial) ?16:17
Phinnayi understand that, there are no duplicate host names16:21
Phinnaywhat is odd though is it's trying to insert "dcfffd09-0112-440b-bcd6-9a44e27c1e2e-Common-PRD-VM1" into a column that does not contain data that looks like that16:22
*** tbielawa is now known as tbielawa|lunch16:23
dmsimardthat's likely the name of the key16:23
dmsimard(the foreign key)16:23
dmsimardthere's a foreign key from hosts.id (playbook_id) to playbooks.id16:24
dmsimardPhinnay: does that reproduce every time ?16:24
ara-slack<sethrei> @dmsimard thanks for your help, I fixed my docker container and it works.16:25
dmsimard@sethrei: yay \o/16:26
ara-slack<sethrei> @dmsimard this will help me with all my 2.5 testing16:28
ara-slack<dmsimard> I haven't had the chance to try 2.5 all that much since it's come out, let me know if you notice anything weird in regards to ara :slightly_smiling_face:16:29
ara-slack<dmsimard> I know there's some unit test regressions but it seems to be a unit test bug rather than an ara (or ansible) bug.16:30
Phinnayi ran the playbook again and got different SQL errors16:30
ara-slack<sethrei> cool16:30
Phinnayhttps://imgur.com/RJAiPk516:30
dmsimardPhinnay: different? :/16:30
Phinnayits the worst when the error changes o.x16:32
dmsimardPhinnay: Very weird. Do you have the ability to easily start the database from scratch ? Just in case there's some weird inconsistency with the database from the previous failed transactions...16:33
Phinnayran the playbook 4x now and it hasnt bawked at duplicate keys in playbook_id, maybe the random ID generator got reset when the patch got applied?16:33
dmsimardOdd timing because I spent a good part of the weekend standing up better automated integration testing with mysql/postgresql that'll run in the CI whenever we send a patch16:34
dmsimardPhinnay: what version of ara was installed ? latest I suppose ?16:34
Phinnaybut the next 3x playbook runs have been consistently erroring the same as shown in https://imgur.com/RJAiPk516:34
dmsimardPhinnay: can you run with -vvv ? that should expose the actual stack traces16:35
Phinnaysure16:35
Phinnayand yeah, i can blow away the DB if needed16:35
dmsimardlet's try -vvv first16:36
Phinnaythe ARA version on the website shows ARA 0.14.7.dev416:36
dmsimardyeah but what version was installed originally ?16:37
dmsimardif you didn't specify a version when installing it, it was the latest16:37
Phinnayyes, i did not specify a version16:38
dmsimardok16:38
*** sshnaidm is now known as sshnaidm|bbl16:39
Phinnayhttps://pastebin.com/2GxCvdsc16:45
Phinnayshowing the exception16:46
Phinnayi also see " "msg": "Data not recorded in ARA: (pymysql.err.OperationalError) (2006, \"MySQL server has gone away (error(32, 'Broken pipe'))\") [SQL: u'SELECT data.id AS data_id, data.playbook_id AS data_p$ }" but those follow after the one shown on pastebin16:47
dmsimardPhinnay: is that trace related to the first error we're seeing ? the one about the object not returning rows ?16:49
dmsimardalso -- I'm curious if you'd run into any of those issues with the default sqlite backend16:52
dmsimardit would help isolate where the problem could be16:52
Phinnayhttps://jpst.it/1dczc16:58
Phinnayis the full output of ansible playbook -vvv > log.txt16:58
Phinnayi have not tried the default SQLlite backend, can give that a go16:59
dmsimardPhinnay: I'm mostly curious if we're dealing with a mysql specific issue or an ara_record specific issue (or something else entirely)17:01
Phinnayright17:02
Phinnayis there a process to switch back to sqllite or just comment out the database= line in ansible.cfg and restart apache17:06
Phinnaydoesnt look like it :/ error cant find the sqlite file17:28
*** tbielawa|lunch is now known as tbielawa17:39
Phinnayok in the mean time, attached a clean mySQL db and ran the playbook again - same errors17:42
dmsimardOk, I don't have a solution for you right now until I have the time to understand what's going on17:43
dmsimardUsing sqlite would be helpful to narrow down where to look17:44
Phinnayno problem, do you know how to switch back to sqllite? not sure how to generate the db17:44
dmsimardJust commenting out the database config should automatically create ~/.ara/ansible.sqlite17:45
dmsimardUnless you have a dir config17:45
dmsimardBasically dir defaults to ~/.ara and the database to $dir/ansible.sqlite17:46
Phinnayalrighty17:46
Phinnayran with no errors on sqlite17:51
Phinnayall records populated as expected17:51
Phinnay:D17:51
dmsimardhmm18:03
*** tbielawa has quit IRC18:47
*** jlozadad[m] has quit IRC18:47
*** DrWaluigi has quit IRC18:51
*** DrWaluigi has joined #ara18:52
*** tbielawa has joined #ara18:53
*** jlozadad[m] has joined #ara18:54
*** harlowja has joined #ara19:23
harlowjaPhinnay https://gist.github.com/harlowja/9c8dcfeb4697b11781126db1fab19a4c19:24
harlowjapretty sure u need to use this patch and lower SQLALCHEMY_POOL_TIMEOUT19:24
Phinnayhrmm, ill try it, give me a bit19:24
harlowjathough u may then hit https://imgur.com/a/1ocsj and memory gets absorbed19:25
* harlowja trying to see what may affect that 19:25
dmsimardharlowja: yeah actually I already had him try that patch19:27
ara-slack<harlowja> kk19:27
harlowjasetting SQLALCHEMY_POOL_TIMEOUT  below when your mysql server will drop the connection is helpful :)19:27
harlowjathough i may try mysql-python soon19:28
*** paulfantom has quit IRC19:33
*** paulfantom has joined #ara19:33
Phinnay@harlowja my mysql timeout is set to 120seconds19:38
Phinnaypool_timeout is set to 60seconds19:39
*** tbielawa has quit IRC20:14
harlowjakk20:43
*** sshnaidm|bbl is now known as sshnaidm21:09
*** bcoca has quit IRC23:00

Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!