[
https://issues.apache.org/jira/browse/KAFKA-8427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sukumaar Mane updated KAFKA-8427:
---------------------------------
Summary: Error while cleanup under windows for EmbeddedKafkaCluster (was:
error while cleanup under windows for EmbeddedKafkaCluster)
> Error while cleanup under windows for EmbeddedKafkaCluster
> ----------------------------------------------------------
>
> Key: KAFKA-8427
> URL: https://issues.apache.org/jira/browse/KAFKA-8427
> Project: Kafka
> Issue Type: Bug
> Components: streams
> Affects Versions: 2.0.0, 2.2.0
> Reporter: Sukumaar Mane
> Priority: Major
> Labels: kafka, testing, win10, windows
>
> Unable to run a simple test case for EmbeddedKafkaCluster.
> Running below simple code (which is actually code snippet from
> *org.apache.kafka.streams.KafkaStreamsTest* class)
> {code:java}
> public class KTest {
> private static final int NUM_BROKERS = 1;
> // We need this to avoid the KafkaConsumer hanging on poll
> // (this may occur if the test doesn't complete quickly enough)
> @ClassRule
> public static final EmbeddedKafkaCluster CLUSTER = new
> EmbeddedKafkaCluster(NUM_BROKERS);
> private static final int NUM_THREADS = 2;
> private final StreamsBuilder builder = new StreamsBuilder();
> @Rule
> public TestName testName = new TestName();
> private KafkaStreams globalStreams;
> private Properties props;
> @Before
> public void before() {
> props = new Properties();
> props.put(StreamsConfig.APPLICATION_ID_CONFIG, "appId");
> props.put(StreamsConfig.CLIENT_ID_CONFIG, "clientId");
> props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG,
> CLUSTER.bootstrapServers());
> props.put(StreamsConfig.METRIC_REPORTER_CLASSES_CONFIG,
> MockMetricsReporter.class.getName());
> props.put(StreamsConfig.STATE_DIR_CONFIG,
> TestUtils.tempDirectory().getPath());
> props.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, NUM_THREADS);
> globalStreams = new KafkaStreams(builder.build(), props);
> }
> @After
> public void cleanup() {
> if (globalStreams != null) {
> globalStreams.close();
> }
> }
> @Test
> public void thisIsFirstFakeTest() {
> assert true;
> }
> }
> {code}
> But getting these error message at the time of cleanup
> {code:java}
> java.nio.file.FileSystemException:
> C:\Users\Sukumaar\AppData\Local\Temp\kafka-3445189010908127083\version-2\log.1:
> The process cannot access the file because it is being used by another
> process.
> at
> sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
> at
> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
> at
> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
> at
> sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
> at
> sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
> at java.nio.file.Files.delete(Files.java:1126)
> at org.apache.kafka.common.utils.Utils$2.visitFile(Utils.java:753)
> at org.apache.kafka.common.utils.Utils$2.visitFile(Utils.java:742)
> at java.nio.file.Files.walkFileTree(Files.java:2670)
> at java.nio.file.Files.walkFileTree(Files.java:2742)
> at org.apache.kafka.common.utils.Utils.delete(Utils.java:742)
> at kafka.zk.EmbeddedZookeeper.shutdown(EmbeddedZookeeper.scala:65)
> at
> org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster.stop(EmbeddedKafkaCluster.java:122)
> at
> org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster.after(EmbeddedKafkaCluster.java:151)
> at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50)
> at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
> at
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> at
> com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
> at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
> at
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
> {code}
> One similar issue (KAFKA-6075) had been reported and marked as resolved but
> still getting the error while cleanup.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)