Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-145927

Possible race condition in LanguageResources

Details

    Description

      Each time there's no key on _languageMaps we invoke _loadLocale. This two step process in suitable for a race condition since it isn't atomic.

       

      Besides, the LanguageUtil.fromLanguageId isn't consistent, because when called without validation the languageId tested is added to the locales map. This causes a different behavior depending on the execution order:

       

      Assume a hook is created with Language_en.properties as language file and en_US defined as an available locale, then

      1. If en hasn't been checked as super locale and added to the locales map en will not be returned as a valid locale from LanguageUtil.fromLanguageId and the ResourceBundle for Language_en.properties will not be registered
      2. If en has been checked as super locale and added to the locales map then en will be returned as valid locale and the ResourceBundle for Language_en.properties will be registered.

      A possible way to reproduce it is (it may take several retries/restarts to reproduce the issue):

      1. Deploy a language hook created as war following steps like the ones listed in https://help.liferay.com/hc/es/articles/360018181091-Overriding-Language-Properties-Using-a-Hook using a file like Language_en.properties
      2. Restart the portal.
      3. Check if key overridden has been applied.

      Attachments

        Activity

          People

            support-lep@liferay.com SE Support
            mariano.alvaro Mariano Álvaro
            Rafaela Nascimento Rafaela Nascimento
            Mariano Álvaro Mariano Álvaro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              23 weeks, 5 days ago

              Packages

                Version Package
                7.3.10 DXP U19
                7.3.X
                7.4.3.37 CE GA37
                7.4.3.38 CE GA38
                7.4.3.39 CE GA39
                7.4.3.40 CE GA40
                Master