Autorefresh reloads images causing performance issue

Issue

  • Autorefresh causes performance issue.
  • JENKINS-19828.
  • Static images get loaded when page autorefresh enabled.
  • You are receiving the following error:
2020-12-12 07:30:27.568+0000 [id=18] WARNING hudson.Functions#configureAutoRefresh: Failed to record auto refresh status in telemetry 
java.lang.IllegalStateException: Expected 1 instance of jenkins.telemetry.impl.AutoRefresh but got 0 
at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451) 
at hudson.Functions.configureAutoRefresh(Functions.java:655) 
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 

Environment

Resolution

The auto refresh capability has been removed since Jenkins 2.235.1 to address performance issues. If you are running an earlier version of Jenkins and not able to upgrade, here are a few ways to workaround the caching issues:

  • Install Config AutoRefresh Plugin, and configure the auto refresh time to a large number.

  • If you are using a container like tomcat you can re-write the header to set the autorefresh cookie to false:

    Header edit Set-Cookie "hudson\_auto\_refresh=true" "hudson\_auto\_refresh=false"
    RewriteCond %\{QUERY\_STRING\} ^(.+?&|)auto\_refresh=true(?:&(.\*)|)$ \[NC\]
    RewriteRule ^ JENKINS\_URL%\{REQUEST\_URI\}?%1%2 \[R=301,L\]
    
  • Install the CloudBees Request Filter Plugin and add a new rule preventing someone from going to the autorefresh url: .*/.*norefresh=true.*

References

Have more questions?

0 Comments

Please sign in to leave a comment.