diff --git a/quic/interop/src/main/kotlin/com/vitorpamplona/quic/interop/runner/InteropClient.kt b/quic/interop/src/main/kotlin/com/vitorpamplona/quic/interop/runner/InteropClient.kt index 449269e84..d9ce893f0 100644 --- a/quic/interop/src/main/kotlin/com/vitorpamplona/quic/interop/runner/InteropClient.kt +++ b/quic/interop/src/main/kotlin/com/vitorpamplona/quic/interop/runner/InteropClient.kt @@ -364,8 +364,20 @@ private fun runTransferTest( // (responses dribble in over a long stretch). val debug = System.getenv("QUIC_INTEROP_DEBUG") == "1" val transferStartMs = nowMs() + if (debug) { + System.err.println( + "[interop] multiplex start: total_urls=${urls.size} " + + "MULTIPLEX_PARALLELISM=$MULTIPLEX_PARALLELISM " + + "expected_chunks=${(urls.size + MULTIPLEX_PARALLELISM - 1) / MULTIPLEX_PARALLELISM}", + ) + } urls.chunked(MULTIPLEX_PARALLELISM).forEachIndexed { chunkIdx, chunk -> val chunkStartMs = nowMs() + if (debug && chunkIdx < 3) { + System.err.println( + "[interop] chunk=$chunkIdx size=${chunk.size} starting prepareRequests", + ) + } // Single lock-held batch open + enqueue. // Without this, openBidiStream's per-call // lock acquire / release lets the send loop diff --git a/quic/src/commonMain/kotlin/com/vitorpamplona/quic/connection/QuicConnection.kt b/quic/src/commonMain/kotlin/com/vitorpamplona/quic/connection/QuicConnection.kt index aeaafd667..e23cabdaf 100644 --- a/quic/src/commonMain/kotlin/com/vitorpamplona/quic/connection/QuicConnection.kt +++ b/quic/src/commonMain/kotlin/com/vitorpamplona/quic/connection/QuicConnection.kt @@ -800,9 +800,18 @@ class QuicConnection( init: (QuicStream, I) -> R, ): List { if (items.isEmpty()) return emptyList() - return streamsLock.withLock { - items.map { init(openBidiStreamLocked(), it) } + val streamsBefore = if (writerDebugEnabled) streams.size else 0 + val result = + streamsLock.withLock { + items.map { init(openBidiStreamLocked(), it) } + } + if (writerDebugEnabled) { + System.err.println( + "[batch] openBidiStreamsBatch items=${items.size} returned=${result.size} " + + "streamsList_before=$streamsBefore streamsList_after=${streams.size}", + ) } + return result } /**