Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Support Request: "not a valid experiment spec" - "ModPagespeedExperimentSpec id=1;percent=50;default" #2070

Open
jwest75674 opened this issue Jun 18, 2021 · 13 comments

Comments

@jwest75674
Copy link

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 ---

@Lofesa
Copy link
Contributor

Lofesa commented Jun 19, 2021

Hi
errors are related to line 75 ===> <===
Have you tried to delete this?

@jwest75674
Copy link
Author

jwest75674 commented Jun 20, 2021

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.

@Lofesa
Copy link
Contributor

Lofesa commented Jun 21, 2021

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

*msg = "not a valid experiment spec";

@jwest75674
Copy link
Author

I am not adding those, they do not appear in the config file, they only appear in the error message I posted originally.

@jwest75674
Copy link
Author

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>

@Lofesa
Copy link
Contributor

Lofesa commented Jun 21, 2021

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 ""

@jwest75674
Copy link
Author

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 ---

@Lofesa
Copy link
Contributor

Lofesa commented Jun 24, 2021

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.

@jwest75674
Copy link
Author

jwest75674 commented Jun 29, 2021

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

@Lofesa
Copy link
Contributor

Lofesa commented Jun 29, 2021

@jwest75674
Copy link
Author

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...)

@jmarantz
Copy link
Contributor

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.

@jmarantz
Copy link
Contributor

jmarantz commented Dec 18, 2021

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.

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

No branches or pull requests

3 participants