You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This commit add the ability to detect if a blocking op is performed in the IO thread.
My POC ensure that we can do testing with debezium.
However it fails because the kafka consumer should be executed in the same thread than the test and so I am unaware to make entity request in test and also in kafka consumer.
Expected behavior
I would like to do in test:
save an entity using the entity manager ;
pool the entity manager multiple time (using awaitability) until the consumer do his job (by muting an entity in database).
Actual behavior
When the test is keep running (in awaitibility await method) and the kafka consumer execute a database request using the entity manager this exception is thrown:
2019-10-14 20:41:04,995 ERROR [com.dam.san.GiftConsumer#onMessage] (vert.x-eventloop-thread-0) The method com.damdamdamdeo.santa.GiftConsumer#onMessage has thrown an exception: java.lang.IllegalStateException: You have attempted to perform a blocking operation on a IO thread. This is not allowed, as blocking the IO thread will cause major performance issues with your application. If you want to perform blocking EntityManager operations make sure you are doing it from a worker thread.
at io.quarkus.hibernate.orm.runtime.entitymanager.TransactionScopedEntityManager.checkBlocking(TransactionScopedEntityManager.java:84)
at io.quarkus.hibernate.orm.runtime.entitymanager.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:315)
at io.quarkus.hibernate.orm.runtime.entitymanager.ForwardingEntityManager.createQuery(ForwardingEntityManager.java:142)
at com.damdamdamdeo.santa.GiftConsumer.onMessage(GiftConsumer.java:25)
at com.damdamdamdeo.santa.GiftConsumer_ClientProxy.onMessage(GiftConsumer_ClientProxy.zig:135)
at com.damdamdamdeo.santa.GiftConsumer_SmallryeMessagingInvoker_onMessage_8a2a58316cee48b845e8e88cd5a3d9a98cc9dcf4.invoke(GiftConsumer_SmallryeMessagingInvoker_onMessage_8a2a58316cee48b845e8e88cd5a3d9a98cc9dcf4.zig:48)
Output of java -version:
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (build 1.8.0_202-20190206132807.buildslave.jdk8u-src-tar--b08)
OpenJDK GraalVM CE 1.0.0-rc16 (build 25.202-b08-jvmci-0.59, mixed mode)
GraalVM version (if different from Java):
Quarkus version or git rev: 0.24.0
Additional context
If you run multiple time the test without restarting the kafka container the kafka event may not be consumed.
Workaround
By injecting a new instance of EntityManager in the kafka consumer it works :)
The workaround is in the branch debezium-workaround.
edit: I've rework the branch and I produce multiple EntityManager instance using Dependent scope.
The text was updated successfully, but these errors were encountered:
Describe the bug
This commit add the ability to detect if a blocking op is performed in the IO thread.
My POC ensure that we can do testing with debezium.
However it fails because the kafka consumer should be executed in the same thread than the test and so I am unaware to make entity request in test and also in kafka consumer.
Expected behavior
I would like to do in test:
Actual behavior
When the test is keep running (in awaitibility await method) and the kafka consumer execute a database request using the entity manager this exception is thrown:
To Reproduce
Steps to reproduce the behavior:
run_container.sh
(warning it will kill and remove all containers)mvn clean test
Configuration
In the poc.
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a
orver
: Linux arch-anywhere 5.3.1-arch1-1-ARCH Switch to the Maven distributed copy of the SubstrateVM annotations #1 SMP PREEMPT Sat Sep 21 11:33:49 UTC 2019 x86_64 GNU/Linuxjava -version
:openjdk version "1.8.0_202"
OpenJDK Runtime Environment (build 1.8.0_202-20190206132807.buildslave.jdk8u-src-tar--b08)
OpenJDK GraalVM CE 1.0.0-rc16 (build 25.202-b08-jvmci-0.59, mixed mode)
Additional context
If you run multiple time the test without restarting the kafka container the kafka event may not be consumed.
Workaround
By injecting a new instance of EntityManager in the kafka consumer it works :)
The workaround is in the branch
debezium-workaround
.edit: I've rework the branch and I produce multiple EntityManager instance using Dependent scope.
The text was updated successfully, but these errors were encountered: