IDEA-98776 Memory Leak

found 3 additional places where default svnkit pool was used -> create all clients through SvnVcs factory methods, with our no caching pool -> no auto refresh scheduled queue, no leak
This commit is contained in:
irengrig
2013-01-31 18:07:54 +04:00
parent 0fb0213c94
commit 64c6ad957e
6 changed files with 67 additions and 9 deletions
@@ -48,7 +48,6 @@ import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.SVNAuthentication;
import org.tmatesoft.svn.core.internal.util.SVNURLUtil;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import javax.swing.*;
import java.awt.*;
@@ -351,7 +350,7 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica
}
SvnInteractiveAuthenticationProvider.clearCallState();
try {
new SVNWCClient(manager, configuration.getOptions(project)).doInfo(url, SVNRevision.UNDEFINED, SVNRevision.HEAD);
SvnVcs.getInstance(project).createWCClient(manager).doInfo(url, SVNRevision.UNDEFINED, SVNRevision.HEAD);
} catch (SVNAuthenticationException e) {
log(e);
return false;
@@ -667,6 +667,12 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
return client;
}
public SVNUpdateClient createUpdateClient(@NotNull ISVNAuthenticationManager manager) {
final SVNUpdateClient client = new SVNUpdateClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(manager);
return client;
}
public SVNStatusClient createStatusClient() {
SVNStatusClient client = new SVNStatusClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
@@ -680,6 +686,12 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
return client;
}
public SVNWCClient createWCClient(@NotNull ISVNAuthenticationManager manager) {
final SVNWCClient client = new SVNWCClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(manager);
return client;
}
public SVNCopyClient createCopyClient() {
final SVNCopyClient client = new SVNCopyClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
@@ -698,6 +710,12 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
return client;
}
public SVNLogClient createLogClient(@NotNull ISVNAuthenticationManager manager) {
final SVNLogClient client = new SVNLogClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(manager);
return client;
}
public SVNCommitClient createCommitClient() {
final SVNCommitClient client = new SVNCommitClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
@@ -39,10 +39,11 @@ public class BranchesLoader {
final List<SvnBranchItem> result = new LinkedList<SvnBranchItem>();
final SvnConfiguration configuration = SvnConfiguration.getInstance(project);
final ISVNAuthenticationManager passiveManager = passive ? configuration.getPassiveAuthenticationManager(project) : configuration.getInteractiveManager(
SvnVcs.getInstance(project));
final SvnVcs vcs = SvnVcs.getInstance(project);
final ISVNAuthenticationManager passiveManager = passive ?
configuration.getPassiveAuthenticationManager(project) : configuration.getInteractiveManager(vcs);
final SVNLogClient logClient = new SVNLogClient(passiveManager, configuration.getOptions(project));
final SVNLogClient logClient = vcs.createLogClient(passiveManager);
final SVNURL branchesUrl = SVNURL.parseURIEncoded(url);
logClient.doList(branchesUrl, SVNRevision.UNDEFINED, SVNRevision.HEAD, false, SVNDepth.IMMEDIATES, SVNDirEntry.DIRENT_ALL, new ISVNDirEntryHandler() {
public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException {
@@ -22,7 +22,6 @@ import com.intellij.openapi.vcs.LineProcessEventListener;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.concurrency.Semaphore;
import org.jetbrains.idea.svn.SvnAuthenticationManager;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.portable.SvnExceptionWrapper;
import org.jetbrains.idea.svn.portable.SvnSvnkitUpdateClient;
@@ -166,7 +165,7 @@ public class SvnCommandLineUpdateClient extends SvnSvnkitUpdateClient {
@Override
public void runWithSvnkitClient(File configDir, SvnAuthenticationManager manager) throws SVNException {
final SVNUpdateClient client = new SVNUpdateClient(manager, SvnConfiguration.getInstance(myProject).getOptions(myProject));
final SVNUpdateClient client = SvnVcs.getInstance(myProject).createUpdateClient(manager);
client.doUpdate(paths, revision, depth, allowUnversionedObstructions, depthIsSticky, makeParents);
}
@@ -40,13 +40,11 @@ public class SvnAuthenticationProvider implements ISVNAuthenticationProvider {
private final Project myProject;
private final SvnAuthenticationNotifier myAuthenticationNotifier;
private final ISVNAuthenticationProvider mySvnInteractiveAuthenticationProvider;
private final SvnVcs mySvnVcs;
private final ISVNAuthenticationStorage myAuthenticationStorage;
private static final Set<Thread> ourForceInteractive = new HashSet<Thread>();
public SvnAuthenticationProvider(final SvnVcs svnVcs, final ISVNAuthenticationProvider provider,
final ISVNAuthenticationStorage authenticationStorage) {
mySvnVcs = svnVcs;
myAuthenticationStorage = authenticationStorage;
myProject = svnVcs.getProject();
myAuthenticationNotifier = svnVcs.getAuthNotifier();
@@ -0,0 +1,43 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.svn;
import com.intellij.util.net.HttpConfigurable;
import org.junit.Test;
/**
* Created with IntelliJ IDEA.
* User: Irina.Chernushina
* Date: 1/31/13
* Time: 3:37 PM
*/
public class SvnAndProxyTest extends Svn17TestCase {
@Test
public void testDirectWhenIdeaHaveProxy() throws Exception {
}
private static void setDefaultFixedProxySettings() {
final HttpConfigurable h = HttpConfigurable.getInstance();
h.USE_PROXY_PAC = false;
h.USE_HTTP_PROXY = true;
h.AUTHENTICATION_CANCELLED = false;
// doesn't matter, only significant for serialization
h.KEEP_PROXY_PASSWORD = false;
h.LAST_ERROR = null;
}
}