simplesamlphp / simplesamlphp-module-statistics

The SimpleSAMLphp statistics module
GNU Lesser General Public License v2.1
2 stars 0 forks source link

Unhandled Exception on Statistics v1.2.0 with SimpleSAMLphp v2.1.2 #15

Open malavolti opened 6 months ago

malavolti commented 6 months ago

I get this Unhandled Exception with the 'statistics' module on the new version of SimpleSAMLphp v2.1.2 when I open the Statistics web page:

Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] SimpleSAML\Error\Error: UNHANDLEDEXCEPTION
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] Backtrace:
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 2 /var/simplesamlphp-212/vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Error/ExceptionHandler.php:35 (SimpleSAML\Error\ExceptionHandler::customExceptionHandler)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 1 /var/simplesamlphp-212/vendor/symfony/error-handler/ErrorHandler.php:531 (Symfony\Component\ErrorHandler\ErrorHandler::handleException)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 0 [builtin] (N/A)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] Caused by: TypeError: SimpleSAML\Module\statistics\Statistics\Rulesets\BaseRule::resolveFileSlot(): Return value must be of type int, string returned
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] Backtrace:
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 7 /var/simplesamlphp-212/vendor/simplesamlphp/simplesamlphp/modules/statistics/src/Statistics/Rulesets/BaseRule.php:137 (SimpleSAML\Module\statistics\Statistics\Rulesets\BaseRule::resolveFileSlot)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 6 /var/simplesamlphp-212/vendor/simplesamlphp/simplesamlphp/modules/statistics/src/Statistics/Rulesets/BaseRule.php:176 (SimpleSAML\Module\statistics\Statistics\Rulesets\BaseRule::getDataSet)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 5 /var/simplesamlphp-212/vendor/simplesamlphp/simplesamlphp/modules/statistics/src/Controller/Statistics.php:137 (SimpleSAML\Module\statistics\Controller\Statistics::main)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 4 /var/simplesamlphp-212/vendor/symfony/http-kernel/HttpKernel.php:181 (Symfony\Component\HttpKernel\HttpKernel::handleRaw)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 3 /var/simplesamlphp-212/vendor/symfony/http-kernel/HttpKernel.php:76 (Symfony\Component\HttpKernel\HttpKernel::handle)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 2 /var/simplesamlphp-212/vendor/symfony/http-kernel/Kernel.php:197 (Symfony\Component\HttpKernel\Kernel::handle)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 1 /var/simplesamlphp-212/vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Module.php:234 (SimpleSAML\Module::process)
Feb  7 10:53:15 ssp-idp simplesamlphp[27612]: 3 [9e533df498] 0 /var/simplesamlphp-212/vendor/simplesamlphp/simplesamlphp/public/module.php:17 (N/A)

On SSP v1.19.8 and SSP v2.0.0 works well.

tvdijen commented 6 months ago

Can you try with module v1.2.1?

malavolti commented 6 months ago

With the v1.2.1 I got this:

SimpleSAML\Error\Error: UNHANDLEDEXCEPTION
Backtrace:
2 src/SimpleSAML/Error/ExceptionHandler.php:35 (SimpleSAML\Error\ExceptionHandler::customExceptionHandler)
1 /var/simplesamlphp-212/vendor/symfony/error-handler/ErrorHandler.php:531 (Symfony\Component\ErrorHandler\ErrorHandler::handleException)
0 [builtin] (N/A)
Caused by: TypeError: SimpleSAML\Module\statistics\StatDataset::__construct(): Argument #5 ($fileslot) must be of type int, string given, called in /var/simplesamlphp-212/vendor/simplesamlphp/simplesamlphp/modules/statistics/src/Statistics/Rulesets/BaseRule.php on line 179
Backtrace:
7 modules/statistics/src/StatDataset.php:64 (SimpleSAML\Module\statistics\StatDataset::__construct)
6 modules/statistics/src/Statistics/Rulesets/BaseRule.php:179 (SimpleSAML\Module\statistics\Statistics\Rulesets\BaseRule::getDataSet)
5 modules/statistics/src/Controller/Statistics.php:137 (SimpleSAML\Module\statistics\Controller\Statistics::main)
4 /var/simplesamlphp-212/vendor/symfony/http-kernel/HttpKernel.php:181 (Symfony\Component\HttpKernel\HttpKernel::handleRaw)
3 /var/simplesamlphp-212/vendor/symfony/http-kernel/HttpKernel.php:76 (Symfony\Component\HttpKernel\HttpKernel::handle)
2 /var/simplesamlphp-212/vendor/symfony/http-kernel/Kernel.php:197 (Symfony\Component\HttpKernel\Kernel::handle)
1 src/SimpleSAML/Module.php:234 (SimpleSAML\Module::process)
0 public/module.php:17 (N/A)
tvdijen commented 6 months ago

I'm confused, because these return types haven't changed for a while.. I'll have to investigate this a bit more once I get home tonight.

tvdijen commented 6 months ago

I'm seeing a totally different issue:

Caused by: InvalidArgumentException: The controller for URI "/statistics/metadata" is not callable: Controller "SimpleSAML\Module\statistics\Controller\Statistics" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service?

Maybe this module has to be declared dead, because besides you, I'm not aware of anyone using it...

malavolti commented 6 months ago

Oh no! Please! I think it is useful for all IdP that doesn't use F-Ticks and for the IdPs connected to eduGAIN that want to see statistics for their internal resources.

Is there another way to collect this kind of anonymous stats with SSP? Thanks!

tvdijen commented 6 months ago

I also think this is useful, but this module has been a pain-in-the-ass for years because no one understands the inner workings.. Currently no one is maintaining this module.

malavolti commented 6 months ago

@tvdijen

Since I'm unsure about the fate of this helpful module, I've decided to at least write a script for collecting statistics from the .stat files generated by the 'statistics:StatisticsWithAttribute' Authentication Process Filter.

Could you please let me know your thoughts?

ssp-loganalysis.php

tvdijen commented 6 months ago

I've fixed some of the issues in v1.2.2, but not all items in the dropdown-menu work.. Everytime I fix one thing, something else breaks.. It's just a horrible module

malavolti commented 6 months ago

I've fixed some of the issues in v1.2.2, but not all items in the dropdown-menu work.. Everytime I fix one thing, something else breaks.. It's just a horrible module

Thank you so much @tvdijen !

I think SimpleSamlPhp needs a New Statistics module. 😅

tvdijen commented 6 months ago

Agreed, and I think we should use Symfony charts for that instead of JQuery & Google Charts...