incubator-pagespeed-mod
incubator-pagespeed-mod copied to clipboard
Support Request: "not a valid experiment spec" - "ModPagespeedExperimentSpec id=1;percent=50;default"
cpanel on cloudlinux
yum list installed | grep pagespeed
ea-apache24-mod_pagespeed.x86_64 latest-stable @System
Hello, I am having some troubles understanding why the config shown in the documentation is failing here:
Initial configuration generation failed with the following message:
The “/usr/sbin/httpd -DSSL -t -f /etc/apache2/conf/httpd.conf.work.0cf351df.cfgcheck -C Include "/etc/apache2/conf.modules.d/*.conf"” command (process 222775) reported error number 1 when it ended.
Configuration problem detected on line 75 of file /etc/apache2/conf.modules.d/456_pagespeed.conf: not a valid experiment spec
--- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
70 ModPagespeedEnableFilters insert_ga
71 ModPagespeedRunExperiment on
72 ModPagespeedUseAnalyticsJs off
73 ModpagespeedAnalyticsID UA-00000000-1 #hidden
74
75 ===> <===
76 ModPagespeedExperimentSpec id=1;percent=50;default
77 ModPagespeedExperimentSpec id=2;percent=50
78
79
80
81 # ModPagespeedDomain
--- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
Rebuilding configuration without any local modifications.
Failed to generate a syntactically correct Apache configuration.
Bad configuration file located at /etc/apache2/conf/httpd.conf.work.0cf351df
Error:
The “/usr/sbin/httpd -DSSL -t -f /etc/apache2/conf/httpd.conf.work.0cf351df.cfgcheck -C Include "/etc/apache2/conf.modules.d/*.conf"” command (process 222781) reported error number 1 when it ended.
Configuration problem detected on line 75 of file /etc/apache2/conf.modules.d/456_pagespeed.conf: not a valid experiment spec
--- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
70 ModPagespeedEnableFilters insert_ga
71 ModPagespeedRunExperiment on
72 ModPagespeedUseAnalyticsJs off
73 ModpagespeedAnalyticsID UA-000000000-1 # hidden
74
75 ===> <===
76 ModPagespeedExperimentSpec id=1;percent=50;default
77 ModPagespeedExperimentSpec id=2;percent=50
78
79
80
81 # ModPagespeedDomain
--- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
Hi
errors are related to line 75 ===> <===
Have you tried to delete this?
Yes, and I've tried adding more lines, the issue appears to actually be at the ModPagespeedExperimentSpec id=1;percent=50;default, but I suspect somone assumed zero-based somewhere when they should have used one (or something.)
Thats probably not clear... What I mean is:
The ==> <== is always one line above:
ModPagespeedExperimentSpec id=1;percent=50;default
If I remove the empty lines, the error becomes:
72 ModPagespeedUseAnalyticsJs off
73 ==> ModpagespeedAnalyticsID UA-00000000-1 <===
74 ModPagespeedExperimentSpec id=1;percent=50;default
75 ModPagespeedExperimentSpec id=2;percent=50
if I add more empty lines it becomes:
--- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
70 ModPagespeedEnableFilters insert_ga
71 ModPagespeedRunExperiment on
72 ModPagespeedUseAnalyticsJs off
73 ModpagespeedAnalyticsID UA-00000000-1 #hidden
74
75
76
77
78 ===> <===
79 ModPagespeedExperimentSpec id=1;percent=50;default
80 ModPagespeedExperimentSpec id=2;percent=50
81
82
83
84 # ModPagespeedDomain
--- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
etc.
Hi
But these simbols ===> <=== are not allowed in apache config file.
To make a line as a comment it must start with # like # ModPagespeedDomain
The message not a valid experiment spec comes from https://github.com/apache/incubator-pagespeed-mod/blob/d8070cf1cd0dbfb70a05e28b739707c66b1cf635/net/instaweb/rewriter/rewrite_options.cc#L2957
I am not adding those, they do not appear in the config file, they only appear in the error message I posted originally.
This is my config file:
<IfModule !mod_version.c>
LoadModule version_module modules/mod_version.so
</IfModule>
<IfVersion < 2.4>
LoadModule pagespeed_module modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
LoadModule pagespeed_module modules/mod_pagespeed_ap24.so
</IfVersion>
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedDisallow "http://cpanel.*"
ModPagespeedDisallow "https://cpanel.*"
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
ModPagespeedFileCachePath "/var/mod_pagespeed/cache/"
# ModPagespeedRewriteLevel PassThrough
ModPagespeedRewriteLevel OptimizeForBandwidth
ModPagespeedInPlaceResourceOptimization on
ModPagespeedPreserveUrlRelativity on
# ModPagespeedEnableFilters rewrite_javascript,rewrite_css
# ModPagespeedEnableFilters collapse_whitespace,elide_attributes
ModPagespeedEnableFilters sprite_images,lazyload_images,collapse_whitespace,elide_attributes,strip_image_meta_data,extend_cache,dedup_inlined_images,move_css_to_head,move_css_above_scripts,hint_preload_subresources
ModPagespeedForceCaching on
ModPagespeedStickyQueryParameters sticky_60minsjw
ModPagespeedOptionCookiesDurationMs 360000
ModPagespeedEnableFilters insert_ga
ModPagespeedRunExperiment on
ModPagespeedUseAnalyticsJs off
ModpagespeedAnalyticsID UA-189408626-1
ModPagespeedExperimentSpec id=1;percent=50;default
ModPagespeedExperimentSpec id=2;percent=50
<Location /mod_pagespeed_beacon>
SetHandler mod_pagespeed_beacon
</Location>
<Location /mod_pagespeed_statistics>
Order allow,deny
Allow from 192.168.1.1
SetHandler mod_pagespeed_statistics
</Location>
</IfModule>
Hi Can you try:
ModPagespeedExperimentSpec "id=1;percent=50;default"
ModPagespeedExperimentSpec "id=2;percent=50"
I find in this file: https://github.com/apache/incubator-pagespeed-mod/blob/master/install/debug.conf.template thar experiments spec are enclosed in ""
No dice:
[2021-06-23 10:18:13 -0600] info [xml-api] Initial configuration generation failed with the following message:
[2021-06-23 10:18:13 -0600] info [xml-api] The “/usr/sbin/httpd -DSSL -t -f /etc/apache2/conf/httpd.conf.work.ee71d556.cfgcheck -C Include "/etc/apache2/conf.modules.d/*.conf"” command (process 63327) reported error number 1 when it ended.
[2021-06-23 10:18:13 -0600] info [xml-api] Configuration problem detected on line 76 of file /etc/apache2/conf.modules.d/456_pagespeed.conf: not a valid experiment spec
[2021-06-23 10:18:13 -0600] info [xml-api] --- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
[2021-06-23 10:18:13 -0600] info [xml-api] 70 ModPagespeedEnableFilters insert_ga
[2021-06-23 10:18:13 -0600] info [xml-api] 71 ModPagespeedRunExperiment on
[2021-06-23 10:18:13 -0600] info [xml-api] 72 ModPagespeedUseAnalyticsJs off
[2021-06-23 10:18:13 -0600] info [xml-api] 73 ModpagespeedAnalyticsID UA-189408626-1
[2021-06-23 10:18:13 -0600] info [xml-api] 74
[2021-06-23 10:18:13 -0600] info [xml-api] 75
[2021-06-23 10:18:13 -0600] info [xml-api] 76 ===> <===
[2021-06-23 10:18:13 -0600] info [xml-api] 77 ModPagespeedExperimentSpec "id=1;default;percent=50"
[2021-06-23 10:18:13 -0600] info [xml-api] 78 ModPagespeedExperimentSpec "id=2;percent=50"
[2021-06-23 10:18:13 -0600] info [xml-api] 79
[2021-06-23 10:18:13 -0600] info [xml-api] 80
[2021-06-23 10:18:13 -0600] info [xml-api] 81
[2021-06-23 10:18:13 -0600] info [xml-api] 82 # ModPagespeedDomain
[2021-06-23 10:18:13 -0600] info [xml-api] --- /etc/apache2/conf.modules.d/456_pagespeed.conf ---
Hi At this point I think can´t help you much more, I have never used experiments, so don´t know how it work or what the error is. Maybe @oschaaf or @jmarantz can take a look here.
Thanks for trying though. I've done some more poking around, and while I have not yet been successful in identifying the issue, I am beginning to suspect that an error message is being thrown when it's still working under the hood.
However, I am far from confident, and attemping to start a new experiment to test.
On a different server, one running litespeed, I see this in the logs:
2021-06-29 11:57:42.511975 | WARN | [2312650] [T0] [modpagespeed] "ExperimentSpec id=1;percent=50;default" not a valid experiment spec
-- | -- | --
2021-06-29 11:57:42.512167 | WARN | [2312650] [T0] [modpagespeed] "ExperimentSpec id=2;percent=50" not a valid experiment spec
For this config:
ModPagespeedExperimentSpec id=1;percent=50;default
ModPagespeedExperimentSpec id=2;percent=50
Maybe there is spected a options= or even a slot= ? I found this https://git.xvid.com/git/xvid_ngx_pagespeed/-/blob/1e1d7a31eaf7ee28344a83d998f37b08a18a9f11/html/doc/module-run-experiment.html
Well, another 6 months has come and gone and I am revisiting this. Same issue still exists, but reading through that link, I did notice this: https://git.xvid.com/git/xvid_ngx_pagespeed/-/blob/1e1d7a31eaf7ee28344a83d998f37b08a18a9f11/html/doc/module-run-experiment.html#L354
However, swapping to analytics.js and using the newer content experiments stuff still results in the same error (invalid experiment spec)
Seems like this is simply an unmaintained feature which isn't working any more, in some cases. (Though it works on other servers I manage...)
You are right that no one is actively working on the feature, but if there's some usage issues you might want to refer to the test code which can clarify with precision what valid syntax is. The test for the experiment-matcher is here:
https://github.com/apache/incubator-pagespeed-mod/blob/master/test/net/instaweb/rewriter/experiment_matcher_test.cc
and there are other related tests here:
https://github.com/apache/incubator-pagespeed-mod/blob/master/test/net/instaweb/rewriter/experiment_util_test.cc
These tests may help give clues as to what's valid syntax. Of course there's also the implementation files:
https://github.com/apache/incubator-pagespeed-mod/blob/master/net/instaweb/rewriter/experiment_matcher.cc
and
https://github.com/apache/incubator-pagespeed-mod/blob/master/net/instaweb/rewriter/experiment_util.cc
Sorry I don't have more specific advice for you -- I had high level knowledge of this filter and why we built it but didn't actively work on it myself.
oh and there's also system-tests for experiments, including this one: https://github.com/apache/incubator-pagespeed-mod/blob/master/install/apache_experiment_ga_test.sh and there may be others like it in the same directory.