SOLR-4189: Fix hanging threads on FreeBSD in JettySolrRunner by making connector configureable through sysprop, listen only on 127.0.0.1 in tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1422127 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-12-14 22:19:58 +00:00
parent 17569aa775
commit 6af24c8866
5 changed files with 32 additions and 5 deletions

View File

@ -154,6 +154,7 @@
<subant buildpath="." antfile="extra-targets.xml" target="-run-maven-build" inheritall="false" failonerror="true"> <subant buildpath="." antfile="extra-targets.xml" target="-run-maven-build" inheritall="false" failonerror="true">
<propertyset> <propertyset>
<propertyref prefix="maven-"/> <propertyref prefix="maven-"/>
<propertyref builtin="commandline"/>
</propertyset> </propertyset>
</subant> </subant>
</target> </target>

View File

@ -99,6 +99,15 @@
<doctitle>${project.name} ${project.version} API (${now.version})</doctitle> <doctitle>${project.name} ${project.version} API (${now.version})</doctitle>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<tests.jettyConnector>${tests.jettyConnector}</tests.jettyConnector>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>

View File

@ -56,6 +56,9 @@
mavenVersion="${maven-version}" failonerror="true" fork="true"> mavenVersion="${maven-version}" failonerror="true" fork="true">
<arg value="-fae"/> <arg value="-fae"/>
<arg value="install"/> <arg value="install"/>
<syspropertyset>
<propertyref builtin="commandline"/>
</syspropertyset>
</mvn> </mvn>
</target> </target>

View File

@ -916,6 +916,7 @@
<propertyref prefix="tests.failfast" /> <propertyref prefix="tests.failfast" />
<propertyref prefix="tests.badapples" /> <propertyref prefix="tests.badapples" />
<propertyref prefix="tests.timeoutSuite" /> <propertyref prefix="tests.timeoutSuite" />
<propertyref prefix="tests.jettyConnector" />
</syspropertyset> </syspropertyset>
<!-- Pass randomized settings to the forked JVM. --> <!-- Pass randomized settings to the forked JVM. -->

View File

@ -154,12 +154,25 @@ public class JettySolrRunner {
} }
System.setProperty("solr.solr.home", solrHome); System.setProperty("solr.solr.home", solrHome);
if (System.getProperty("jetty.testMode") != null) { if (System.getProperty("jetty.testMode") != null) {
SelectChannelConnector connector = new SelectChannelConnector(); final String connectorName = System.getProperty("tests.jettyConnector", "SelectChannel");
final Connector connector;
final QueuedThreadPool threadPool;
if ("SelectChannel".equals(connectorName)) {
final SelectChannelConnector c = new SelectChannelConnector();
c.setReuseAddress(true);
c.setLowResourcesMaxIdleTime(1500);
connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else if ("Socket".equals(connectorName)) {
final SocketConnector c = new SocketConnector();
c.setReuseAddress(true);
connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else {
throw new IllegalArgumentException("Illegal value for system property 'tests.jettyConnector': " + connectorName);
}
connector.setPort(port); connector.setPort(port);
connector.setReuseAddress(true); connector.setHost("127.0.0.1");
connector.setLowResourcesMaxIdleTime(1500);
QueuedThreadPool threadPool = (QueuedThreadPool) connector
.getThreadPool();
if (threadPool != null) { if (threadPool != null) {
threadPool.setMaxThreads(10000); threadPool.setMaxThreads(10000);
threadPool.setMaxIdleTimeMs(5000); threadPool.setMaxIdleTimeMs(5000);