chenejac / VIVOTestMigrationJIRA

0 stars 0 forks source link

VIVO-1924: @en i18n properties are not loaded during first site startup. #1814

Closed chenejac closed 3 years ago

chenejac commented 3 years ago

Benjamin Gross (Migrated from VIVO-1924) said:

When starting VIVO for the very first time, i18n strings in English are not loaded. The 'theme' strings are loaded, but the top level all.properties are not. If the i18n cache is disabled, then the strings immediately appear. I think the issue was introduced somewhere in this commit: https://github.com/vivo-project/Vitro/commit/80140a8ab0c82334a16d42708a4f22f0e2afc323

!Screen Shot 2020-09-02 at 11.54.53 AM.png|thumbnail!

[~accountid:60785ded115da6006f540529] [~accountid:557058:abe52938-e5a4-4b11-be6c-c0d83a4b2577] [~accountid:557058:3f53c733-6ac2-4e92-9f12-e34e297283a3]

chenejac commented 3 years ago

Andrew Woods said:

[~accountid:5bb229e412ef2d4bf3a2233d]: can you share the log error?

chenejac commented 3 years ago

Andrew Woods said:

This change may be related: https://github.com/vivo-project/Vitro/commit/80140a8ab0c82334a16d42708a4f22f0e2afc323#diff-a0d7c3f30c6ac4f372a2c26365e281deR204

chenejac commented 3 years ago

Benjamin Gross said:

I get the standard missing string errors. E.g.

2020-09-02 15:16:02,528 WARN  [I18nBundle] Text bundle 'all' has no text for 'research_capitalized'
2020-09-02 15:16:02,530 WARN  [I18nBundle] Text bundle 'all' has no text for 'no_research_content_found'
2020-09-02 15:16:02,531 WARN  [I18nBundle] Text bundle 'all' has no text for 'faculty_capitalized'
2020-09-02 15:16:02,531 WARN  [I18nBundle] Text bundle 'all' has no text for 'loading_faculty'
2020-09-02 15:16:02,531 WARN  [I18nBundle] Text bundle 'all' has no text for 'departments'
2020-09-02 15:16:02,532 WARN  [I18nBundle] Text bundle 'all' has no text for 'geographic_focus'
2020-09-02 15:16:02,532 WARN  [I18nBundle] Text bundle 'all' has no text for 'loading_map_information'
2020-09-02 15:16:02,619 WARN  [I18nBundle] Text bundle 'all' has no text for 'researcher'
2020-09-02 15:16:02,621 WARN  [I18nBundle] Text bundle 'all' has no text for 'in'
2020-09-02 15:16:02,621 WARN  [I18nBundle] Text bundle 'all' has no text for 'view_all'
2020-09-02 15:16:05,291 INFO  [IndexHistory] STOP_URIS, 9/2/20, 3:16 PM, [excluded=1038, deleted=0, updated=394, remaining=0, total=1432]
2020-09-02 15:16:05,809 INFO  [IndexHistory] STOP_REBUILD, 9/2/20, 3:16 PM, [documentsBefore=394, documentsAfter=394]
2020-09-02 15:22:55,184 WARN  [I18nBundle] Text bundle 'all' has no text for 'research_capitalized'
2020-09-02 15:22:55,190 WARN  [I18nBundle] Text bundle 'all' has no text for 'no_research_content_found'
2020-09-02 15:22:55,191 WARN  [I18nBundle] Text bundle 'all' has no text for 'faculty_capitalized'
2020-09-02 15:22:55,191 WARN  [I18nBundle] Text bundle 'all' has no text for 'loading_faculty'
2020-09-02 15:22:55,191 WARN  [I18nBundle] Text bundle 'all' has no text for 'departments'
2020-09-02 15:22:55,191 WARN  [I18nBundle] Text bundle 'all' has no text for 'geographic_focus'
2020-09-02 15:22:55,191 WARN  [I18nBundle] Text bundle 'all' has no text for 'loading_map_information'
2020-09-02 15:22:55,255 WARN  [I18nBundle] Text bundle 'all' has no text for 'researcher'
2020-09-02 15:22:55,255 WARN  [I18nBundle] Text bundle 'all' has no text for 'in'
2020-09-02 15:22:55,256 WARN  [I18nBundle] Text bundle 'all' has no text for 'view_all'
2020-09-02 15:23:02,495 WARN  [I18nBundle] Text bundle 'all' has no text for 'research_capitalized'
2020-09-02 15:23:02,495 WARN  [I18nBundle] Text bundle 'all' has no text for 'no_research_content_found'
2020-09-02 15:23:02,495 WARN  [I18nBundle] Text bundle 'all' has no text for 'faculty_capitalized'
2020-09-02 15:23:02,495 WARN  [I18nBundle] Text bundle 'all' has no text for 'loading_faculty'
2020-09-02 15:23:02,496 WARN  [I18nBundle] Text bundle 'all' has no text for 'departments'
2020-09-02 15:23:02,496 WARN  [I18nBundle] Text bundle 'all' has no text for 'geographic_focus'
2020-09-02 15:23:02,496 WARN  [I18nBundle] Text bundle 'all' has no text for 'loading_map_information'
2020-09-02 15:23:02,499 WARN  [I18nBundle] Text bundle 'all' has no text for 'researcher'
2020-09-02 15:23:02,500 WARN  [I18nBundle] Text bundle 'all' has no text for 'in'
2020-09-02 15:23:02,500 WARN  [I18nBundle] Text bundle 'all' has no text for 'view_all'
2020-09-02 15:23:05,484 WARN  [I18nBundle] Text bundle 'all' has no text for 'internal_class'

No other errors I can see.

chenejac commented 3 years ago

Brian Lowe said:

For what it's worth, here are the differences in the log between initial startup and after the i18n cache is disabled.  Note that the second time, i18n\vivo_all_en_US.properties is located and loaded.  The first time, these lines are absent.

At startup:

2021-01-25 18:58:22,571 DEBUG [I18n] Creating bundle for 'all', en_US, 'java.properties', false^M 2021-01-25 18:58:22,571 DEBUG [I18n] Paths are '/themes/wilma/i18n/' and '/i18n/'^M 2021-01-25 18:58:22,581 DEBUG [VitroResourceBundle] Located file '/i18n/\all_en_US.properties' at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\all_en_US.properties'^M 2021-01-25 18:58:22,581 DEBUG [VitroResourceBundle] Located file '/themes/wilma/i18n/\all_en_US.properties' at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\themes\wilma\i18n\all_en_US.properties'^M 2021-01-25 18:58:22,581 DEBUG [VitroResourceBundle] Loading bundle 'all_en_US' defaults from 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\all_en_US.properties'^M 2021-01-25 18:58:22,581 DEBUG [VitroResourceBundle] No file at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\vitro_all_en_US.properties'^M 2021-01-25 18:58:22,581 DEBUG [VitroResourceBundle] Loading bundle 'all_en_US' defaults from 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\themes\wilma\i18n\all_en_US.properties'^M 2021-01-25 18:58:22,581 DEBUG [VitroResourceBundle] No file at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\local\i18n\all_en_US.properties'^M

After clearing cache:

2021-01-25 19:03:20,894 DEBUG [I18n] Creating bundle for 'all', en_US, 'java.properties', false^M 2021-01-25 19:03:20,894 DEBUG [I18n] Paths are '/themes/wilma/i18n/' and '/i18n/'^M 2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] Located file '/i18n/\all_en_US.properties' at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\all_en_US.properties'^M 2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] Located file '/themes/wilma/i18n/\all_en_US.properties' at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\themes\wilma\i18n\all_en_US.properties'^M 2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] Loading bundle 'all_en_US' defaults from 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\all_en_US.properties'^M 2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] No file at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\vitro_all_en_US.properties'^M 2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] Located file '/i18n/\vivo_all_en_US.properties' at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\vivo_all_en_US.properties'^M *2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] Loading bundle 'all_en_US' defaults from 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\i18n\vivo_all_en_US.properties'*^M 2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] Loading bundle 'all_en_US' defaults from 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\themes\wilma\i18n\all_en_US.properties*'*^M 2021-01-25 19:03:20,894 DEBUG [VitroResourceBundle] No file at 'C:\Users\Brian Lowe\Documents\var\local\tomcat\webapps\vivo111\local\i18n\all_en_US.properties'^

 

chenejac commented 3 years ago

Brian Lowe said:

Bug goes away if the line for org.vivoweb.webapp.startup.i18nSetup in VIVO/webapp/src/main/webapp/WEB-INF/resources/startup_listeners.txt is moved to the top instead of being at the bottom where it is now.  i18nSetup doesn't depend on any other listeners, so there's no reason for it not to be first.  There should probably be a comment added to the i18nSetup file to reflect this.

 

My current theory on why this bug is not consistently reproducible is that there is likely a race condition between VClassGroupCache and i18nSetup where the bug is triggered if the asynchronous VClassGroupCache rebuild tries to use a WebappDaoFactory before the i18nSetup listener runs.  If i18nSetup runs first, the i18n cache gets populated with a resource bundle that properly includes the vivo properties.

chenejac commented 3 years ago

Dominik Feldschnieders said:

PR

I rearranged the startup-listeners like Brian suggested and Matthias tested the solution for me (on my system the bug did not appear).  So hopefully the problem is solved for everyone. 

chenejac commented 3 years ago

Brian Lowe said:

Resolved in commit https://github.com/vivo-project/VIVO/commit/e3f7c62b273761bfd9b51734049fa906a1af96c0