launchpad is eating batteries

Bug #616138 reported by MarcH
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

Launchpad's javascript is eating batteries, probably due to some abusive polling.

To reproduce on Linux, simply open your browser with no window. Starting monitoring it like this:
- powertop
- strace -T -tt $(pgrep firefox-bin)
- etc.

Then open a page like for instance this one:
  https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/95144
and observe the resulting abuse of system resources.

Reproduced with firefox and opera. Workaround: disable javascript for the launchpad.net domain.

Tags: lp-web
Revision history for this message
MarcH (marc-h38) wrote :

Sorry for the typo, it is actually: strace -T -tt -p $(pgrep firefox-bin)

Revision history for this message
Robert Collins (lifeless) wrote :

YUI.add("oop",function(F){var E=F.Lang,D=F.Array,C=Object.prototype,B="_~yuim~_";F.augment=function(A,T,I,R,N){var L=T.prototype,P=null,S=T,O=(N)?F.Array(N):[],H=A.prototype,M=H||A,Q=false,G,J,K;if(H&&S){G={};J={};P={};F.each(L,function(V,U){J[U]=function(){for(K in G){if(G.hasOwnProperty(K)&&(this[K]===J[K])){this[K]=G[K];}}S.apply(this,O);return G[U].apply(this,arguments);};if((!R||(U in R))&&(I||!(U in this))){if(E.isFunction(V)){G[U]=V;this[U]=J[U];}else{this[U]=V;}}},P,true);}else{Q=true;}F.mix(M,P||L,I,R);if(Q){T.apply(M,O);}return A;};F.aggregate=function(H,G,A,I){return F.mix(H,G,A,I,0,true);};F.extend=function(I,H,A,K){if(!H||!I){F.error("extend failed, verify dependencies");}var J=H.prototype,G=F.Object(J);I.prototype=G;G.constructor=I;I.superclass=J;if(H!=Object&&J.constructor==C.constructor){J.constructor=H;}if(A){F.mix(G,A,true);}if(K){F.mix(I,K,true);}return I;};F.each=function(H,G,I,A){if(H.each&&H.item){return H.each.call(H,G,I);}else{switch(D.test(H)){case 1:return D.each(H,G,I);case 2:return D.each(F.Array(H,0,true),G,I);default:return F.Object.each(H,G,I,A);}}};F.clone=function(I,J,M,N,H,L){if(!E.isObject(I)){return I;}var K,G=L||{},A;switch(E.type(I)){case"date":return new Date(I);case"regexp":return new RegExp(I.source);case"function":K=F.bind(I,H);break;case"array":K=[];break;default:if(I[B]){return G[I[B]];}A=F.guid();K=(J)?{}:F.Object(I);I[B]=A;G[A]=I;}if(!I.addEventListener&&!I.attachEvent){F.each(I,function(P,O){if(!M||(M.call(N||this,P,O,this,I)!==false)){if(O!==B){this[O]=F.clone(P,J,M,N,H||I,G);}}},K);}if(!L){F.each(G,function(P,O){delete P[B];});G=null;}return K;};F.bind=function(A,H){var G=arguments.length>2?F.Array(arguments,2,true):null;return function(){var J=E.isString(A)?H[A]:A,I=(G)?G.concat(F.Array(arguments,0,true)):arguments;return J.apply(H||J,I);};};F.rbind=function(A,H){var G=arguments.length>2?F.Array(arguments,2,true):null;return function(){var J=E.isString(A)?H[A]:A,I=(G)?F.Array(arguments,0,true).concat(G):arguments;return J.apply(H||J,I);};};},"3.0.0");

is the culprit, firing based on a timer.

Changed in launchpad:
status: New → Triaged
status: Triaged → Confirmed
affects: launchpad → launchpad-web
Revision history for this message
Sidnei da Silva (sidnei) wrote :

That looks like the content of the 'oop' module, which I don't think contains any timers. Maybe something else that creates a new sandbox requiring the oop module instead?

Revision history for this message
MarcH (marc-h38) wrote :

Handy enough, this bug can also be reproduced thanks to its own bug report. In firefox 3.6.8 on Linux, this bug causes about 200 hundred system calls per second, the vast majority of them according to the following pattern:

1. gettimeofday()
2. non-blocking read() on some unix socket, returns EAGAIN
3. poll ( [ 10 unix sockets or pipes + 1 anon_inode:inotify], 11, timeout=0)
repeat 1 2 3 forever

Come on guys, do something for the planet! This bug is causing billions of useless system calls per second across the world...

Curtis Hovey (sinzui)
Changed in launchpad-web:
status: Confirmed → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.