Skip to content

IOException "Stream closed" during stress testing #153

@znzryb

Description

@znzryb

Bug: IOException "Stream closed" during test execution

Description

When running stress testing, the program throws a java.io.IOException: Stream closed exception, causing the testing process to terminate abnormally.

Error Message

This was not supposed to happen, please file an <a herf="https://github.com/Pushpavel/AutoCp/issues/new/choose">issue</a>

Error message:
Stream closed
Stacktrace:
java.io.IOException: Stream closed
	at java.base/java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:447)
	at java.base/java.io.OutputStream.write(OutputStream.java:167)
	at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:125)
	at java.base/java.io.BufferedOutputStream.implFlush(BufferedOutputStream.java:252)
	at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:246)
	at java.base/java.io.FilterOutputStream.close(FilterOutputStream.java:184)
	at kotlin.io.CloseableKt.closeFinally(Closeable.kt:56)
	at com.github.pushpavel.autocp.tester.base.ProcessRunner$run$2$deferred$1.invokeSuspend(ProcessRunner.kt:48)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)

Screenshot

Image

Steps to Reproduce

  1. Configure an AutoCp project with a solution file
  2. Run stress testing
  3. When the program attempts to write data to the subprocess input stream, the exception is triggered

(may be clang++ and macos can reproduce this problem more likely. I didn't encounter this issue previously when using g++-14 on macOS, likely because the binaries compiled by g++-14 ran relatively slower. Recently, I switched to native clang++, which significantly improved execution speed. The much faster process creation and destruction cycle might be triggering this race condition, leading to the 'Stream closed' error.)

Expected Behavior

The program should do stress testing until it reaches the number I input or find an WA testcase.

Environment

  • OS: macOS 24.6.0
  • IDE: CLion 2025.1.3
  • Programming Language: Cpp
  • Plugin Version: AutoCp 0.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions