IRC logs for #farmOS, 2019-10-15 (GMT)

2019-10-14
2019-10-16
TimeNickMessage
[20:42:47]* FijiDave has quit (Ping timeout: 276 seconds)
[20:43:00]* FijiDave has joined #farmos
[21:37:25]* JustTB has quit (Quit: Leaving.)
[21:38:34]* JustTB has joined #farmos
[23:21:10]* FijiDave_ has joined #farmos
[23:23:59]* FijiDave has quit (Ping timeout: 276 seconds)
[01:18:19]* JustTB has quit (Quit: Leaving.)
[02:38:53]* JustTB has joined #farmos
[05:05:38]* JustTB has quit (Read error: Connection reset by peer)
[14:32:30]* FijiDave has joined #farmos
[14:32:30]* FijiDave_ has quit (Read error: Connection reset by peer)
[14:51:29]<skipper_is[m]>Oh man, Drush has somehow uninstalled/disabled itself...
[14:54:40]<mstenta[m]>skipper_is: Huh. You're using the farmOS "dev" Docker image?
[15:01:37]<skipper_is[m]>Git clone from github
[15:01:39]<skipper_is[m]>and then drush make
[15:02:20]<skipper_is[m]>Also, the new animal weights, what is the best way of logging weights? Is there a quick form?
[15:04:45]<mstenta[m]>Yea! (sort of)
[15:04:50]<mstenta[m]>not exactly a "Quick Form" but it is a "quick" "form" ;-)
[15:05:07]<mstenta[m]>Go to Assets > Animals, select one or more, and click the "Weight" button that appears at the bottom
[15:05:49]<skipper_is[m]>Oh yea, look at that
[15:05:51]<mstenta[m]>You can also import observation logs that reference the animal with a "weight" measure
[15:06:09]<mstenta[m]>Just make sure they are observation logs...
[15:06:30]<mstenta[m]>I'm currently helping someone who imported them all as activities... it's a bit hairy converting log types after they are created
[15:06:44]<skipper_is[m]>Hmm, the drop downs for logs and assets appear to only be visible when on the asset or log page..
[15:06:51]<skipper_is[m]>Has that always been like that?
[15:06:54]<mstenta[m]>So what happens when you try to use the `drush` command
[15:06:59]<mstenta[m]>Hmm not sure
[15:07:11]<skipper_is[m]>Says it can't find drush
[15:07:35]<mstenta[m]>> Hmm, the drop downs for logs and assets appear to only be visible when on the asset or log page..
[15:07:36]<mstenta[m]>What page are you on when that happens?
[15:07:59]<mstenta[m]>> Says it can't find drush
[15:08:00]<mstenta[m]>Well that is strange, huh
[15:08:11]<mstenta[m]>How did you install Drush?
[15:08:12]<skipper_is[m]>ACTION uploaded an image: image.png (13KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/cGJoDZDDtGWRzbCU... >
[15:08:21]<skipper_is[m]>This is the dashboard
[15:08:48]<skipper_is[m]>This is from logs:
[15:08:48]<mstenta[m]>By following the install instructions on www.drush.org?
[15:08:52]<skipper_is[m]>ACTION uploaded an image: image.png (12KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/kbsoLOKwMyNLCUey... >
[15:08:54]<skipper_is[m]>And this is from assets
[15:09:01]<skipper_is[m]>ACTION uploaded an image: image.png (9KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/cKTfLvUDKzpkBLfZ... >
[15:09:22]<mstenta[m]>Hm. I've seen that happen sometimes - I think it means something got messed up with the menu cache - not 100% sure
[15:09:39]<skipper_is[m]>I'll CC
[15:09:44]<mstenta[m]>If you can get Drush working, you can try `drush cc menu` to see if it fixes it
[15:10:02]<mstenta[m]>Or try going to /admin/modules and submitting the form
[15:10:05]<mstenta[m]>I know that resets the menu cache
[15:10:13]<mstenta[m]>I'm not sure if clearing the general caches will do it
[15:10:44]<mstenta[m]>I've only ever had that happen on my local dev instance when I was messing with menu items in modules...
[15:11:31]<skipper_is[m]>Performance clear all worked
[15:12:02]<skipper_is[m]>Though it through a new error: PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "grazing" LINE 1: ...ERE entity_type = 'farm_plan_type' AND entity_id = 'grazing' ^: DELETE FROM {farm_quick_entity} WHERE entity_type = :entity_type AND entity_id = :entity_id; Array ( [:entity_type] => farm_plan_type [:entity_id] => grazing ) in farm_quick_entity_delete() (line 252 
[15:12:02]<skipper_is[m]>/var/www/html/farmOS/profiles/farm/modules/farm/farm_quick/farm_quick.module).
[15:12:27]<mstenta[m]>uh oh
[15:12:47]<skipper_is[m]>Always finding the odd errors
[15:12:47]<mstenta[m]>what's that all about
[15:13:31]<skipper_is[m]>Beats me
[15:13:32]<mstenta[m]>what exactly caused that?
[15:13:32]<skipper_is[m]>Maybe because I disabled the grazing module
[15:13:39]<mstenta[m]>/admin/modules?
[15:13:51]<mstenta[m]>or /admin/config/development/performance?
[15:14:05]<mstenta[m]>it looks like `farm_quick_entity_delete()` was called
[15:14:11]<mstenta[m]>which indicates that entities were being deleted
[15:14:28]<skipper_is[m]>Weird... It was just clearing CC
[15:14:33]<skipper_is[m]>Oh bold
[15:14:33]<mstenta[m]>:-/
[15:14:53]<mstenta[m]>Can you look in /admin/reports/dblog?
[15:15:02]<skipper_is[m]>/admin/config/development/performance
[15:15:03]<skipper_is[m]> called it
[15:16:00]<mstenta[m]>`farm_quick_entity_delete()` is part of the quick form module - it runs whenever an entity is deleted so that it can clean up any references to entities in {farm_quick_entity} table, which just keeps track of entities that were created by quick forms
[15:16:21]<mstenta[m]>for some reason, it tried deleting entities with an ID of `grazing`???
[15:16:27]<mstenta[m]>that doesn't make any sense
[15:16:49]<skipper_is[m]>Very odd... Maybe it is trying to tidy up anything left from when grazing was enabled
[15:18:01]<skipper_is[m]>So re-enabling and disabling grazing led to the same error being called (but from admin/modules)
[15:18:01]<mstenta[m]>oh...
[15:18:10]<mstenta[m]>this is the same postgres issue maybe
[15:18:21]<mstenta[m]>or related
[15:19:10]<skipper_is[m]>Oh postgres, you make my life miserable
[15:19:23]<skipper_is[m]>If there was a simple way to switch everything to mysql I sould...
[15:19:29]<skipper_is[m]>* would even
[15:19:50]<mstenta[m]>ok i think i understand what's happening
[15:19:59]<mstenta[m]>and actually it also reveals a small bug in the quick form module
[15:20:25]<mstenta[m]>Drupal is trying to clean up the old "grazing" plan type
[15:20:30]<skipper_is[m]>Yea
[15:21:11]<mstenta[m]>and yea it's related to the postgres issue... hard to explain easily, but i think i understand it
[15:21:24]<mstenta[m]>i think we can fix this manually for you
[15:21:30]<mstenta[m]>one sec...
[15:21:30]<skipper_is[m]>Failed: PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column "vidcount" does not exist LINE 5: HAVING (vidcount >= '2') ^: SELECT t.field_farm_animal_tag_revision_id AS field_farm_animal_tag_revision_id, COUNT(t.field_farm_animal_tag_revision_id) AS vidcount FROM {field_revision_field_farm_animal_tag} t GROUP BY t.field_farm_animal_tag_revision_id HAVING (vidcount >= :db_condition_placeholder_0) LIMIT 10
[15:21:30]<skipper_is[m]>OFFSET 0; Array ( [:db_condition_placeholder_0] => 2 ) in field_collection_update_7009() (line 424 of /var/www/html/farmOS/profiles/farm/modules/contrib/field_collection/field_collection.install).
[15:21:31]<skipper_is[m]>Another one just flagged up, wow I really set the cat amongst the pigeons...
[15:22:15]<mstenta[m]>ok i don't know what that is... `vidcount`?
[15:22:20]<mstenta[m]>are you running update.php?
[15:22:47]<skipper_is[m]>Yea, ran update.php, it was on field_collection module
[15:23:05]<mstenta[m]>did you manually update field_collection?
[15:23:12]<mstenta[m]>i haven't released an update to that in farmOS yet
[15:23:31]<skipper_is[m]>I got the latest dev release from drupal
[15:23:33]<mstenta[m]>this isn't your production database, right skipper_is ? ;-)
[15:23:38]<skipper_is[m]>And overwrote everything bar sites
[15:23:50]<skipper_is[m]>Yup, but I did run a backup
[15:24:02]<mstenta[m]>oh dev release of farmOS?
[15:24:08]<skipper_is[m]>yea
[15:24:08]<mstenta[m]>hehe ok good :-)
[15:24:23]<skipper_is[m]>Though I've not yet tested whether it will restore nicely..
[15:24:41]<skipper_is[m]>2.3gb.... I hope it has everything..
[15:25:00]<skipper_is[m]>The previous one is only 25mb..
[15:25:05]<skipper_is[m]>No idea what happened there
[15:26:03]<mstenta[m]>ok... so there's a bunch of different things going on here.... i can only help with one at a time
[15:26:19]<mstenta[m]>and only for the next half hour at most
[15:26:24]<skipper_is[m]>Yea, ignore the update one for now
[15:28:00]<mstenta[m]>That field_collection one may be a postgres issue as well... I'm not sure
[15:28:26]<mstenta[m]>(fwiw I want to drop our dependency on field_collection)
[15:29:03]<mstenta[m]>The backup you have... is that from right before you updated to the dev release?
[15:29:51]<skipper_is[m]>I've been using dev release since always, but I just updated to the latest one this evening (just after I made the backup)
[15:30:38]<mstenta[m]>ok
[15:30:39]<mstenta[m]>well... ok... so...
[15:30:39]<mstenta[m]>if you enable the grazing module again, i think that error will go away
[15:31:23]<mstenta[m]>i'm going to push a small commit...
[15:31:56]<skipper_is[m]>When I do clear cc it does
[15:33:03]<mstenta[m]>with the grazing module enabled?
[15:33:29]<skipper_is[m]>Yea, no immediate errors with grazing enabled, clear caches completed sucesfully
[15:33:46]<mstenta[m]>ok cool
[15:34:23]<mstenta[m]>so this commit i'm going to push should resolve that error specifically, which should also allow Drupal to clean up the grazing module properly
[15:34:35]<skipper_is[m]>Ah awesome
[15:34:45]<mstenta[m]>one sec...
[15:36:26]<mstenta[m]>https://github.com/farmOS/farmOS/commit/79f0a84d910309528c55158c5120e0e5...
[15:36:37]<mstenta[m]>It's super simple - you can just make the change manually if that's easiest
[15:36:52]<skipper_is[m]>Yea, I'll do that now, nice one!
[15:37:03]<mstenta[m]>It makes me wonder if similar bugs exist though... so I'm checking the codebase...
[15:38:16]<mstenta[m]>Found one more potential instance of it... but it shouldn't affect you
[15:39:19]<mstenta[m]>Cool - yea I think those are the only two
[15:39:59]<skipper_is[m]>Disabling it didn't throw an error!
[15:40:08]<mstenta[m]>To summarize: there were too `hook_entity_delete()` functions in farmOS that were assuming entity IDs are always numeric... but that's not a correct assumption. when entity *types* are deleted, they are deleted by their machine name
[15:40:13]<skipper_is[m]>And... I think everything remains intact...
[15:40:18]<mstenta[m]> * To summarize: there were two `hook_entity_delete()` functions in farmOS that were assuming entity IDs are always numeric... but that's not a correct assumption. when entity _types_ are deleted, they are deleted by their machine name
[15:40:55]<mstenta[m]>Cool! Good find skipper_is !
[15:40:55]<skipper_is[m]>Aah
[15:40:59]<mstenta[m]>Your track record as expert bug finder continues!
[15:41:09]<mstenta[m]>haha
[15:42:18]* farmBOT has joined #farmos
[15:42:32]<mstenta[m]>there it is :-)
[15:42:35]<mstenta[m]>just a bit delayed on Riot's part
[15:42:37]<skipper_is[m]>Oh..
[15:42:37]<skipper_is[m]>Sorry bot
[15:42:49]<mstenta[m]>to recap (for the log): so i'm not sure if it's actually because you are using postgres that that happened actually... BUT if you hadn't discovered that other postgres issue earlier, I wouldn't have thought of the solution to this!
[15:43:02]<mstenta[m]>so related in that sense :-)
[15:43:06]<skipper_is[m]>:)
[15:43:23]<mstenta[m]>now all that said... i do worry for you skipper_is
[15:43:24]<skipper_is[m]>I will continue to poke holes in postgres
[15:43:35]<mstenta[m]>i want farmOS to support postgres, but i also really don't want you to lose data!
[15:43:47]<skipper_is[m]>Ah backups
[15:43:59]<mstenta[m]>yes! pleeeeeaaassse!
[15:44:00]<mstenta[m]>haha
[15:44:09]<skipper_is[m]>Im doing pg_dump farmos (mydb) -f farmos-15-10-19.sql ... I think that's right
[15:44:12]<mstenta[m]>make sure your backup procedure is good
[15:44:13]<skipper_is[m]>It just dumps.. everything
[15:44:25]<skipper_is[m]>Takes a good 5 minutes to do
[15:44:35]<mstenta[m]>ok cool - you're on your own with that - i don't use postgres myself, i just know `mysqldump`
[15:44:50]<mstenta[m]>advice: set up a local dev copy of farmOS and test the import on that
[15:44:56]<skipper_is[m]>Yea..
[15:45:02]<skipper_is[m]>Good shout
[15:45:25]<mstenta[m]>also remember: database export is only one piece of the backup
[15:45:40]<mstenta[m]>file uploads are stored in `sites/*/files` and `sites/*/private` generally
[15:45:49]<skipper_is[m]>Ah that is a much easier backup though
[15:45:54]<mstenta[m]>yea
[15:46:26]<mstenta[m]>my strategy is generally two fold: create a db dump into `sites/*/private` and then `rsync` backup the whole `sites/*` directory
[15:46:37]<mstenta[m]>so then you have a db snapshot and the files
[15:47:15]<skipper_is[m]>is sites/*/private protected then? I'm assuming so from the private side of the name
[15:47:16]<mstenta[m]>just make sure Drupal is managing the `private` directory, so it has the proper `.htaccess` file to prevent public reading it
[15:47:24]<mstenta[m]>yea ^
[15:47:47]<mstenta[m]>it's even safer to store db dumps outside of the webroot, of course
[15:48:32]<skipper_is[m]>mine are in home/me/farmOSBackups
[15:48:33]<mstenta[m]>go to `/admin/config/media/file-system` to make sure your private dir is configured
[15:48:39]<mstenta[m]>that works
[15:50:40]<mstenta[m]>skipper_is: question...
[15:50:54]<mstenta[m]>do you still have the patch from https://www.drupal.org/project/entity/issues/3076175 applied?
[15:51:18]<skipper_is[m]>Depends, was it merged with the main distribution?
[15:51:29]<mstenta[m]>no
[15:51:34]<mstenta[m]>ok so the update to dev probably removed it
[15:51:36]<skipper_is[m]>Then I do not
[15:51:48]<mstenta[m]>so actually... that patch probably also would have fixed the error
[15:52:04]<mstenta[m]>because it changes the way entity types are deleted, ensuring that it always uses their numeric ID
[15:52:31]<skipper_is[m]>Aah
[15:52:34]<mstenta[m]>but still good to fix it in farmOS's `hook_entity_delete()` functions too
[15:52:54]<mstenta[m]>so now it will be extra fixed :-)
[15:54:51]<skipper_is[m]>I'll repatch
[15:55:46]<mstenta[m]>probably a good idea
[15:55:58]<mstenta[m]>i do plan on merging that into farmOS
[15:57:15]<skipper_is[m]>It is profiles/farm/modules/contrib/entity/?
[16:04:47]<skipper_is[m]>Will keep the patched files on my pc to copy across if there is an update
[16:10:50]<mstenta[m]>yep that's it
[16:13:02]<skipper_is[m]>Set up a file backup now as well, monthly... probably enough
[16:13:53]<skipper_is[m]>I am still slightly shocked at my db size though...
[16:14:30]<mstenta[m]>yea i don't know what that's all about
[16:14:53]<skipper_is[m]>I'm going to try some other approaches.. see whether I can shrink that...
[16:15:15]<mstenta[m]>i wonder if postgres does something different?
[16:15:17]<skipper_is[m]>Because my entire farmOS install + September drone map at 2cm resolution of the farm is smaller than that
[16:15:38]<skipper_is[m]>Just bloats the backup..
[16:15:50]<mstenta[m]>hmm yea...
[16:16:06]<mstenta[m]>and i would assume the drone map is not stored in the db, right?
[16:16:41]<mstenta[m]>(side note: "2 cm resolution"!!!!!)
[16:18:14]<skipper_is[m]>I would sincerely hope not
[16:18:24]<skipper_is[m]>I was bored, and it is only like 12ha
[16:19:47]<mstenta[m]>you would have to go out of your way to store images in the db
[16:20:10]<mstenta[m]>uploaded files in farmOS are stored in `sites` folder, and referenced in the db
[16:39:04]<skipper_is[m]>Insane... Cannot get the file format down below 2gb...
[16:40:57]<mstenta[m]>i wonder if there's some kind of garbage collection that needs to be run?
[16:41:41]<skipper_is[m]>Yea, maybe...
[16:43:55]<skipper_is[m]>On the db stats, it says it is 350mb
[16:47:31]<mstenta[m]>Even that seems a little big - but much more reasonable
[16:50:49]<skipper_is[m]>cache_.... tables... What is in them?
[16:50:54]<skipper_is[m]>Shouldn't they be cleared out when I do cc?
[16:51:03]* FijiDave has quit (Read error: No route to host)
[16:52:05]* FijiDave has joined #farmos
[16:53:20]<mstenta[m]>some are... but not all
[16:53:50]<mstenta[m]>you could consider `TRUNCATE`ing them before you backup
[16:54:58]<skipper_is[m]>cache form has 12k rows..
[16:56:18]<mstenta[m]>yea that's a big one
[16:56:23]<mstenta[m]>you can wipe it out
[16:56:35]<mstenta[m]>all the tables that start with `cache_` are not needed in a backup
[16:56:59]<skipper_is[m]>But not enough to make 2gb of difference...
[16:57:18]<skipper_is[m]>I get that each row needs an "INSERT INTO..." but still...
[16:58:04]<skipper_is[m]>Holy....
[16:58:10]<skipper_is[m]>So I truncated cache_forms
[16:58:14]<skipper_is[m]>12mb
[17:11:41]<mstenta[m]>Total?? Haha
[17:11:49]<mstenta[m]>I guess that makes some sense
[17:12:07]<mstenta[m]>The form cache can be pretty big
[17:12:10]<skipper_is[m]>That is insane!
[17:12:10]<mstenta[m]>Oh... Do you have Cron configured to run regularly?
[17:12:21]<mstenta[m]>That is responsible for clearing those
[17:12:38]<skipper_is[m]>I do not
[17:12:45]<skipper_is[m]>I thought I did actually
[17:13:09]<skipper_is[m]>Cron maintenance tasksLast run 2 hours 27 min ago
[17:14:01]<mstenta[m]>Oh huh
[17:14:15]<mstenta[m]>Maybe Google that
[17:14:24]<skipper_is[m]>Goes every 3h, I assume that is default
[17:14:35]<mstenta[m]>Specifically the cache form issue
[17:14:36]<mstenta[m]>For drupal generally
[17:15:19]<skipper_is[m]>I'm going to do a python script to sync all the backups up, and I'll just add truncate to that...
[17:15:50]<skipper_is[m]>if "cache_" in tablename: truncate
[17:19:41]<skipper_is[m]>Right then, I'm going to bed...Thank you for your help today!
[17:20:11]<mstenta[m]>Sounds good
[17:20:17]<mstenta[m]>Sure thing!
[18:24:05]* FijiDave has quit (Ping timeout: 276 seconds)
[18:36:35]* FijiDave has joined #farmos
[18:39:26]* FijiDave has quit (Client Quit)