? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
23 Sep 2019

When an element is indexed, Finder then executes an optimisation step. In that step it removes all empty taxonomies and since the current code simply looks for direct mappings between indexed items and taxonomies and not also between items and childs of taxonomies, it is deleting empty taxonomies like sample-data-articles, which results in failures afterwards.

This code here should in theory fix that, but unfortunately I get a strange error, where $this in DatabaseDriver all of a sudden is null. Please test anyway.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar Hackwar Hackwar - open - 23 Sep 2019
avatar Hackwar Hackwar - change - 23 Sep 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Sep 2019
Category Administration com_finder
avatar alikon
alikon - comment - 23 Sep 2019

test was made on postgresql
i've applyied the patch on a fresh install and then i've runned the Testing Sample Data module/plugin
2019-09-23 18:46:13.954 CEST [4912] postgres@joomla ERROR: invalid input syntax for integer: "" at character 57 2019-09-23 18:46:13.954 CEST [4912] postgres@joomla STATEMENT: SELECT * FROM "my4_finder_taxonomy" WHERE "parent_id" = '' AND "title" = 'Scenery' AND "language" = ''

hoping it helps to discover the root of the bug

Screenshot from 2019-09-23 18-51-19

avatar wilsonge wilsonge - change - 23 Sep 2019
Labels Added: ?
avatar Hackwar
Hackwar - comment - 24 Sep 2019

@alikon Thank you for this, I will definitely fix that, however that bug is unrelated to this PR/bug. Could you open a new issue for that and mention me there?

avatar Hackwar
Hackwar - comment - 24 Sep 2019

Seems as if this currently fixes the bug, but the number of articles results in a maxexecution time. Maybe someone could split up the article step further?

avatar infograf768
infograf768 - comment - 24 Sep 2019

I still get an error after this patch on current 4.0-dev, but this time the error is readable

avatar N6REJ
N6REJ - comment - 24 Sep 2019

Seems as if this currently fixes the bug, but the number of articles results in a maxexecution time. Maybe someone could split up the article step further?

with only 60 articles?... wow

avatar N6REJ N6REJ - test_item - 24 Sep 2019 - Tested unsuccessfully
avatar N6REJ
N6REJ - comment - 24 Sep 2019

I have tested this item ? unsuccessfully on 4bc43b8


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26392.
pre:

image

post:
image

avatar wilsonge wilsonge - change - 28 Sep 2019
Title
Fixing removeOrphanNodes() in Finder Taxonomy
[4.0] Fixing removeOrphanNodes() in Finder Taxonomy
avatar wilsonge wilsonge - edited - 28 Sep 2019
avatar wilsonge
wilsonge - comment - 28 Sep 2019

I'm with @N6REJ - I had no issues with execution times etc. But it doesn't give any change in the error message I'm receiving either - still the same _getNode issue (interestly mine is reliably with an id of 14 rather than his 313) :( My taxonomy table doesn't seem any different either - so I can only really conclude that this PR hasn't had any effect on the issue

avatar wilsonge
wilsonge - comment - 19 Oct 2019

@Hackwar what's your plans here? Given this has been tested to not work as it stands even when the query does run

avatar Hackwar
Hackwar - comment - 19 Oct 2019

I will investigate this in the coming week and provide a fix. To be honest, I'm a little bit stumped because this is the fix that my customer got and it works there. I will have to search what I missed there. The source of the problem however is right.

avatar wilsonge
wilsonge - comment - 19 Oct 2019

Thanks :) I can completely believe this is a decent part of the fix :)

avatar joomla-cms-bot joomla-cms-bot - change - 21 Oct 2019
Category Administration com_finder Administration com_finder Front End Plugins
avatar Hackwar
Hackwar - comment - 21 Oct 2019

So I found the issue, but I'm unsure how to fix it... First of all, there was a stupid little coding error, which I fixed above. But here comes the big issue:

The indexer calls the Taxonomy class to store taxonomy entries. In the store method, the code caches the used taxonomies to quickly retrieve the IDs. So now the model fires "onContentAfterSave" and the indexer runs, deletes the previous entry and indexes the new data. So far so "good". (Not exactly, but that is how it works right now...)

At some point we added onContentStateChange in a way, that it is executed when the testing sampledata plugin adds its articles. In that event, finder deletes the previous entry and reindexes it, to just then fire onContentAfterSave, deleting the entry again and doing all that indexing AGAIN, but now, since the taxonomies are identical, it runs into the issue of the cache. The previous delete also removed the then empty taxonomies, but they are still cached and thus the next indexing returns the wrong IDs and we have this nice issue here...

This also brings up the issue, that the filters, which you can create, are not going to work when the taxonomies are recreated due to such an edit. So we have to fix that one, too.

And while I'm writing all of this, I've come up with a solution. ;-) First of all, the removal of the empty taxonomies is delayed until after the reindexing is done and then the article model is recreated every time in the testing sampledata plugin to prevent it from thinking it changed state. (I did not check why that is in the model. Maybe there is a bug? Maybe we need a reset() method for the model to prevent situations like this?)

Looking at the other sampledata plugins, we need to refactor those to work similarly to the testing plugin, since those partially just insert directly into the DB.

avatar Hackwar
Hackwar - comment - 6 Nov 2019

Could those who tested thios prior, test this again?

avatar richard67
richard67 - comment - 6 Nov 2019

Testing instructions would be helpful.

avatar Hackwar
Hackwar - comment - 6 Nov 2019
  • Install a current 4.0 and install the testing sampledata.
  • Notice that it errors out
  • Apply this patch, reinstall the installation
  • Notice that it does not fail anymore.
avatar richard67
richard67 - comment - 6 Nov 2019

Normally we have testing instructions in the PR's description and not in some comment.

avatar richard67
richard67 - comment - 6 Nov 2019

Important hint for testers: In addition to this PR, PR #27008 has to be applied, too, to make testing sample data installation work.

avatar richard67 richard67 - test_item - 6 Nov 2019 - Tested successfully
avatar richard67
richard67 - comment - 6 Nov 2019

I have tested this item successfully on 5467182

Important note for other testers: It needs PR #27008 to be applied, too, in addition to this PR here.

Test as follows:

  1. On a clean 4.0-dev installation without any sample data apply PR #27008 but not this PR here.

  2. Install testing sample data.

Result: Testing sample data installation fails at step 4 with an error similar to the one shown in this comment: #26392 (comment).

  1. Again on a clean 4.0-dev installation without any sample data apply PR #27008 and this PR here.

  2. Install testing sample data.

Result: Testing sample data installation finishs with success.

@Hackwar Please add my instructions to a section "Testing Instructions" in the description of this PR so other testers easily find it. Otherwise we might get bad tests, e.g. because people don't apply PR #27008 , too.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26392.

avatar richard67
richard67 - comment - 6 Nov 2019

@alikon @N6REJ If you want to test this PR, please use the testing instructions I gave in my test result here: #26392 (comment). Reason is that it needs PR #27008 to be applied, too, in addition to this one, and so it also needs to test that PR #27008 alone does not solve the issue with testing sample data and that it needs this PR here, too.

avatar Quy
Quy - comment - 6 Nov 2019

Also installed #27008. In the PHP error log:

PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\joomla-cms-4.0-dev\libraries\vendor\joomla\database\src\Mysqli\MysqliStatement.php on line 443

26392

avatar richard67
richard67 - comment - 6 Nov 2019

@Quy Strange, my max_execution_time is also 30 seconds and I did not have this problem. I had a clean installation of current 4.0-dev without any other sample data or additional stuff.

Update: Have you tested with a multilingual site? Mine was not. Maybe that's the difference? Or what else could it be? Windows/Linux? Mine is Linux.

avatar Quy
Quy - comment - 6 Nov 2019

Local clean install with no other sample data on Windows 10 using XAMPP. No multilingual site.

avatar richard67
richard67 - comment - 6 Nov 2019

I guess we both have MySQL 5.7? Or do you already use 8? If 5.7, then the only difference is the OS, it seems. Or maybe it is a random thing and it happens to me, too, when I test again? I will check tomorrow.

avatar Quy
Quy - comment - 6 Nov 2019

10.4.6-MariaDB

avatar richard67
richard67 - comment - 6 Nov 2019

Then it would be interesting to know if someone else with same MariaDB version has the problem, too.

avatar richard67
richard67 - comment - 7 Nov 2019

Hint for other testers: PR #27008 is merged now, and this PR has been updated by last changes in 4.0-dev, so there is no need anymore to apply PR #27008 for testing.

avatar wilsonge
wilsonge - comment - 7 Nov 2019

So I'm running 10.3.16-MariaDB and this patch worked for me BUT that step that you timed out on took 18 seconds on my mid-range MacBook. I can totally believe on some setups it's going to exceed 30. We'll need to spend some time figuring out exactly what's taking so long. However I think this fixes the actual error on sample data install so I'm merging this for now. @Quy could you raise an issue for this please so we can investigate the reason it's taking so long on that step to create all the articles. Thanks!

avatar wilsonge wilsonge - change - 7 Nov 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-11-07 18:28:26
Closed_By wilsonge
avatar wilsonge wilsonge - close - 7 Nov 2019
avatar wilsonge wilsonge - merge - 7 Nov 2019
avatar alikon
alikon - comment - 7 Nov 2019

if batch inserting few articles on smart search like the sample plugin do, took 18 seconds ... then something is really bad/wrong

avatar wilsonge
wilsonge - comment - 7 Nov 2019

There's 68 articles in the test data set plus all the associated permission to calculate and insert into the asset table. I mean it's going to take a while. But yeah 18 seconds seems too long.

Either way it's something to be looked at - but at least with this we can now install sample data again :)

Add a Comment

Login with GitHub to post a comment