Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logspam: Premature access to service container #794

Closed
octfx opened this issue Nov 5, 2023 · 9 comments
Closed

Logspam: Premature access to service container #794

octfx opened this issue Nov 5, 2023 · 9 comments

Comments

@octfx
Copy link

octfx commented Nov 5, 2023

I'm seeing the following log spam with MW 1.39.5

Premature access to service container [Called from SemanticResultFormats::registerHooks in /var/www/html/extensions/SemanticResultFormats/SemanticResultFormats.php at line 56] in /var/www/html/includes/debug/MWDebug.php on line 381

This seems to be introduced by #792

@JeroenDeDauw
Copy link
Member

@Seb35

@alistair3149
Copy link
Contributor

alistair3149 commented Dec 15, 2023

We got the same log spam as well with MW 1.39.5:
image

Seems to be related to: https://phabricator.wikimedia.org/T273261 and https://phabricator.wikimedia.org/rMW47bb958f039c8f1b155c1699d31b4f882d8ba310

Would it be possible to register the hooks in onExtensionFunction or on extension.json instead? That should avoid the premature access from the log that is introduced since MW 1.37.

@krabina
Copy link
Contributor

krabina commented Dec 19, 2023

I can also confirm this.

@Sophivorus
Copy link
Contributor

Sophivorus commented Dec 22, 2023

Me too in MW 1.39.6

@D-Groenewegen
Copy link
Contributor

Thanks @Sophivorus for the fix.

I would just like to add that the issue has a potentially greater impact than simply overwhelming the logs. In my case, it also threw a SyntaxError in the browser's console (relating to a stray angle bracket) and disabled certain Bootstrap components such as dropdowns that come with the Chameleon skin. An unfortunate side-effect but one can be remedied using Sophivorus's fix.

@kghbln
Copy link
Member

kghbln commented Feb 28, 2024

I assume this issue is done. The related commit should be in 4.1.3. Please reopen if there is still an issue.

@kghbln kghbln closed this as completed Feb 28, 2024
@D-Groenewegen
Copy link
Contributor

The commit actually post-dates the latest release (v4.2.0), which should probably be avoided. Anyway, the important thing now is that it's part of master.

@kghbln
Copy link
Member

kghbln commented Feb 28, 2024

Ah, this is SRF. Indeed, it has not been released yet.

@andrecastro0o
Copy link

Hei @kghbln , I am still seeing the following log msgs in a new MW+SMW installation.

They are gone when a deactivate SRF extension.

Deprecated: Premature access to service container [Called from SemanticResultFormats::registerHooks in /var/www/html/wiki/extensions/SemanticResultFormats/SemanticResultFormats.php at line 56] in /var/www/html/wiki/includes/debug/MWDebug.php on line 386
Deprecated: Premature access to service 'HookContainer' [Called from MediaWiki\MediaWikiServices::getInstance in /var/www/html/wiki/includes/MediaWikiServices.php at line 339] in /var/www/html/wiki/includes/debug/MWDebug.php on line 386
Deprecated: Premature access to service 'BootstrapConfig' [Called from Wikimedia\Services\ServiceContainer::{closure} in /var/www/html/wiki/includes/ServiceWiring.php at line 844] in /var/www/html/wiki/includes/debug/MWDebug.php on line 386
Deprecated: Premature access to service 'ObjectFactory' [Called from Wikimedia\Services\ServiceContainer::{closure} in /var/www/html/wiki/includes/ServiceWiring.php at line 860] in /var/www/html/wiki/includes/debug/MWDebug.php on line 386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants