Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidafsilva/vertx-unused-waiting-threads-reproducer
Reproducer for a potential issue found in Vert.x 4.x
https://github.com/davidafsilva/vertx-unused-waiting-threads-reproducer
Last synced: 8 days ago
JSON representation
Reproducer for a potential issue found in Vert.x 4.x
- Host: GitHub
- URL: https://github.com/davidafsilva/vertx-unused-waiting-threads-reproducer
- Owner: davidafsilva
- Created: 2023-06-29T11:26:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-29T13:45:35.000Z (over 1 year ago)
- Last Synced: 2024-11-16T04:41:46.472Z (2 months ago)
- Language: Kotlin
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= Vertx Unused Waiting Threads Reproducer
image:https://img.shields.io/badge/vert.x-4.4.4-purple.svg[link="https://vertx.io"]
Reproducer for an issue, or at least an unexpected behavior, related to the
execution of tasks under a shared worker pool where a blocked thread seems
to be halting the execution of tasks on the remaining (waiting) threads of the
pool.Note that reproducer is a bit more complex to better represent the use-case
where I originally noticed the behavior. The reproducer mimics exactly that,
a worker verticle which spawns two type of consumers: Event-Bus (local) and
Kafka.[source,mermaid]
----
flowchart TB;
subgraph User
I(Stdin Parser)
endsubgraph K[Kafka]
KB(Broker)
endsubgraph V[Vert.x]
VEB[Vert.x EB]
subgraph VWV[Vert.x Worker Verticle]
EBC[Event-Bus Consumer]
KC[Kafka Consumer]
end
endI -- sends op --> VEB
VEB -- delivers message --> EBC
EBC -- sends record --> KB
KC -- polls records --> KB
----== Running the Reproducer
Deploy a single node Kafka broker locally through the provided docker-compose
file:
[source]
----
docker compose up
----Run the application through Gradle:
[source]
----
./gradlew run --console=plain
----You should see an output similar to the one below
[source]
----
Supported operations:
[1] Send a message that does not block the Kafka Consumer handler
[2] Send a message that blocks the Kafka Consumer handler
[3] Unblocks any ongoing 'blocking' operation, if any
[0] ExitType the numerical value for the desired operation and press
----Choosing `1` will send a message through the event-bus that shall be "quickly"
processed by the Kafka consumer handler. You should see omething along the
lines of:
[source]
----
[][] - EventBus - message received: quick
[][] - KafkaConsumer - record received: /quick
[][] - KafkaConsumer - record processed: /quick
----Choosing `2` will send a message through the event-bus as well, however it shall
block on the kafka consumer handler (through the means of a sleep) until you
`3` is entered. If you try to send `1` or `2` prior to sending `3`, you'll notice
that both consumers (event-bus and kafka) will not process any message despite
having more threads (1) available in a wait state, only one them is blocked.
This is the target issue being reproduced here.Full example of a test run can be found below.
[source]
----
Supported operations:
[1] Send a message that does not block the Kafka Consumer handler
[2] Send a message that blocks the Kafka Consumer handler
[3] Unblocks any ongoing 'blocking' operation, if any
[0] ExitType the numerical value for the desired operation and press
1[kafka-verticle-worker-pool-0][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:23.052496 - EventBus - message received: quick
[kafka-verticle-worker-pool-0][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:23.108731 - KafkaConsumer - record received: 1/quick
[kafka-verticle-worker-pool-0][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:23.108858 - KafkaConsumer - record processed: 1/quick
2[kafka-verticle-worker-pool-1][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:29.393930 - EventBus - message received: slow
[kafka-verticle-worker-pool-0][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:29.411352 - KafkaConsumer - record received: 2/slow
11
3
[kafka-verticle-worker-pool-0][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:41.002428 - KafkaConsumer - record processed: 2/slow
[kafka-verticle-worker-pool-0][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:41.007458 - EventBus - message received: quick
[kafka-verticle-worker-pool-0][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:41.007763 - EventBus - message received: quick
[kafka-verticle-worker-pool-1][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:41.021551 - KafkaConsumer - record received: 3/quick
[kafka-verticle-worker-pool-1][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:41.021731 - KafkaConsumer - record processed: 3/quick
[kafka-verticle-worker-pool-1][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:41.021790 - KafkaConsumer - record received: 4/quick
[kafka-verticle-worker-pool-1][io.vertx.core.impl.WorkerContext@5f88e225] 2023-06-29T11:47:41.021839 - KafkaConsumer - record processed: 4/quick0
closing Vert.x..
----