You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
server: work done reporters for client-provided tokens are never released if done() isn't called #1906
WorkDoneProgressReporterImpl adds every reporter to a static Instances map (progress.ts#L49-L52) and removes it only in done(), so each request carrying a workDoneToken whose handler doesn't call done() leaks an entry. Only server-created reporters can be cancelled (#L176-L177), so only those need to be tracked.
// node --expose-gc repro.mjsimport{Duplex}from'stream';import{createConnection,DeclarationRequest}from'vscode-languageserver/node';classPipeextendsDuplex{_write(chunk,_enc,done){this.emit('data',chunk);done();}_read(){}}constup=newPipe(),down=newPipe();constserver=createConnection(up,down);constclient=createConnection(down,up);constrefs=[];// A handler that ignores its work done reporter, so done() is never called.server.onDeclaration((_params,_token,workDone)=>{refs.push(newWeakRef(workDone));// workDone.done();return[];});server.listen();client.listen();for(leti=0;i<1000;i++){awaitclient.sendRequest(DeclarationRequest.type,{textDocument: {uri: 'file:///a.ts'},position: {line: 0,character: 0},workDoneToken: `token-${i}`});}awaitnewPromise((r)=>setTimeout(r,100));global.gc();awaitnewPromise((r)=>setTimeout(r,100));global.gc();console.log(`${refs.filter((r)=>r.deref()!==undefined).length} of ${refs.length} reporters still reachable`);process.exit(0);
Activity