SemanticMediaWiki / SemanticResultFormats

Provides additional visualizations (result formats) for Semantic MediaWiki
https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Result_Formats
Other
45 stars 75 forks source link

Logspam: Premature access to service container #794

Closed octfx closed 7 months ago

octfx commented 11 months ago

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 commented 11 months ago

@Seb35

alistair3149 commented 9 months ago

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 commented 9 months ago

I can also confirm this.

Sophivorus commented 9 months ago

Me too in MW 1.39.6

D-Groenewegen commented 7 months ago

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 commented 7 months ago

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

D-Groenewegen commented 7 months ago

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 commented 7 months ago

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

andrecastro0o commented 6 months ago

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