Problem/Motivation

Hi, thanks for this amazing module. It's really helpful :-)

On a multi-language site, there are errors popping up in watchdog looking for updated translations which are 404ing.

Example (Korean):
http://ftp.drupal.org/files/translations/8.x/twig_tweak/twig_tweak-8.x-1...

This is the only contrib module I have installed that is getting this error, and the others definitely don't have any translations. So, there's something going on with this module that is actively looking to find non-existent translations for all languages active on the site.

Steps to reproduce

Proposed resolution

TBA See #31

Remaining tasks

Issue Summary update to explain the solution chosen
Respond to #19
Add a test

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-2879998

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sgp913 created an issue. See original summary.

Chi’s picture

Maybe it's because the module has no translatable strings.

sgp913’s picture

I understand that. That's why I made this bug report since for some reason it wants to update all the languages and is throwing errors.

Chi’s picture

Title: Translation file not found: » Translation file not found
Project: Twig Tweak » Drupal core
Version: 8.x-1.7 » 8.4.x-dev
Component: Code » locale.module

This module has nothing to do with language updates.

Moving to Core issue queue.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Sutharsan’s picture

I confirm that this error occurs when there are no translation for a module available. There are (currently) no translations for Twig Tweaks in Korean. This will typically happen with languages that only have a small amount of translations.

Localization Update module has a facility to exclude modules from being translated. Perhaps this should be made available for Drupal 8 too.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ckaotik’s picture

The problem we have with this is that it spams up our watchdog for each custom and contrib module without translations, because it prints the error message (notice) on every cron run, regardless of update check frequency.

I found this little gem in the locale_translation_batch_status_check function that runs before the update files are downloaded:

// @todo What to do with when the file is not found (404)? To prevent
//   re-checking within the TTL (1day, 1week) we can set a last_checked
//   timestamp or cache the result.

This causes a LOT of noise and makes monitoring the site's health unnecessarily difficult.

Ben Buske’s picture

Here is a patch that adds an option to completly prevent the notice in logs. While it is not the optimal version where the notice is omitted for some period of time, it is a solution to the problem. To know what files couldn't be loaded you can enable the option and run the cron.

Ben Buske’s picture

Status: Active » Needs review

sorry forgot to change status

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Anybody’s picture

Thank you very much, I think this is a good option and the current situation is messing up logs. RTBC +1! Let's please have some more feedback.

Anybody’s picture

Status: Needs review » Reviewed & tested by the community

I'll now RTBC this because it is a working solution and better than the current situation. If someone from the core developers has a different way to go, please reset the status. Otherwise let's get this forward. It's spamming our logs...

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs review

This seems to be a very specific feature for a very specific problem you are having and looks like a random option on the UI. Are other logs of the module not so noisy?

Why is the module checking the nonexistent file on all crons even if the frequency of checking is not set up to happen that often? The solution proposed here sounds like would mask that larger question that may result in other wastes of resources.

Gábor Hojtsy’s picture

Title: Translation file not found » Localization update feature logs 404 errors too agressively

Also retitling for accuracy about the problem.

Ben Buske’s picture

Are other logs of the module not so noisy?

Other log messages of this module rarely ever show up. In fact the only other log that is somewhat similar noisy is cron with the message "Cron run completed.". And for X custom modules or untranslated modules, you get X-times more messages. Sscores of pages we host have over 90% of the log messages only this message.
In the module is this comment:

File not found occurs when a translation file is not yet available at the translation server. But also if a custom module or custom theme does not define the location of a translation file. By default the file is checked at the translation server, but it will not be found there.

As I understand it, it is not realy seen as an error which makes it even more unnecessary of a flood of logs.

This seems to be a very specific feature for a very specific problem you are having and looks like a random option on the UI.

You are right, except I don't think only a few people having this problem. It is managable to ignore this, but the more custom modules are used the noisier the module. Unfortunally I didn't found a better place for this.

Why is the module checking the nonexistent file on all crons even if the frequency of checking is not set up to happen that often?

Currently it only saves the time of the last check if no error ocurred. As the module says:

// @todo What to do with when the file is not found (404)? To prevent
//   re-checking within the TTL (1day, 1week) we can set a last_checked
//   timestamp or cache the result.

I'll look into using the set time limit on 404 errors, also to cut down on request while cron run.
And maybe an option to aggregate the messages into a single message, stating what modules got a 404-error.

Do you think that would be a more fitting solution?

Ben Buske’s picture

I think it's worth metioning that, if you have 10 custom modules and the crun runs every 10 minutes (and we have also systems where it runs every 5) this alone produces 1,440 log messages per day.

Anybody’s picture

Any progress on this? I'd like to confirm my +1 on RTBC...

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Looks like there are various possibilities that themselves would cut down on logging noise without adding a one-off configuration option, eg. don't even try to find translation files for custom modules (if we can identify custom modules vs. contrib modules) or update the checking date even if the file was not found, so it is not checked too often.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

jungle’s picture

Title: Localization update feature logs 404 errors too agressively » Localization update feature logs 404 errors too aggressively

Typo in title

jungle’s picture

Adding tags

ckaotik’s picture

I've added a patch that addresses the "What to do with when the file is not found (404)?" comment and prevents repeated checking of translations until the update timer expires. I don't think this is really the final solution we're looking for, but it helps reduce the log noise.

And maybe an option to aggregate the messages into a single message, stating what modules got a 404-error.

I quite like this suggestion by @ben-buske in #16, a single message per cron run would help a lot and keep the information visible. Something listing projects that completely failed with 404 and projects for which only some languages failed, e.g. "Translation file not found for myproject, myotherproject, someproject (de, fr).".
A starting point might be to set $failure = TRUE; in case of 404 as well, and somehow collectively handle that in Drupal\locale\Plugin\QueueWorker\LocaleTranslation.

Edit: You should be able to use both #9 (offers configuration to suppress messages) and #25 (prevents requesting files every cron, regardless of TTL) together.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

prudloff’s picture

Besides log messages, this also makes the cron longer because of the frequent HTTP requests, so caching the 404 helps with that as well.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Anybody’s picture

Status: Needs review » Reviewed & tested by the community

As logs are still being filled up with this, I'd vote for a commit of #25 by ckaotik to mitigate the problem. I personally like #9, but that's not my choice. So after using #25 and #9 for over two years now, I'll mark #25 RTBC and hope we can proceed to discuss #9 to get this whole issue solved soon.

Thanks a lot, all!

quietone’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

This needs an Issue Summary update to outline the various solutions discussed, and patches made for (#9), and why #25 what chosen. In #19 @Gábor Hojtsy mentions other changes that could be made - should followups be made to discuss those options?

The 8.9.x patch is being tested every two days - that needs to be changed to 9.4.x

This is also tagged for tests but there are none in the latest patch.

Therefor setting to NW.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

Moving to PNMI based on #31

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Needs work

I don't understand why this is postponed based on my comment in #31. In that comment I think I outlined the work that needs to be done here next. I am setting back to needs works.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

heddn’s picture

I like where this is going. But why are we so worried about removing these noisy log messages? I've got a 40+ language website that we have a full install profile test suite setup. For me, the issue is deeper. Because we do a foreach on each module in each language, testing and installing the site from configuration takes a _really_ long time. In addition to logging to drush or watchdog, it would be nice to use async guzzle and call each of the URLs in a shorter time frame. It would speed up downloads. I think we'd need to concern ourselves with some type of poor mans throttle so we don't send off 1000 URL requests, or even 100. That higher volume of traffic might cause performance issues on the localization servers.

Anybody’s picture

Sadly this needs another reroll for Drupal 10.2. Doesn't apply anymore.

sudishth made their first commit to this issue’s fork.

sudishth’s picture

Status: Needs work » Needs review

Created MR for 11.x

smustgrave’s picture

Status: Needs review » Needs work

#31 mentions an issue summary update which is still needed.

Also test coverage.