datastax / cassandra-quarkus

An Apache Cassandra(R) extension for Quarkus
Apache License 2.0
39 stars 28 forks source link

Simple bootstrapped application with Cassandra client extension can't be stopped, kill -9 needed #144

Closed rsvoboda closed 3 years ago

rsvoboda commented 3 years ago

Simple bootstrapped application with Cassandra client extension can't be stopped using Ctrl+C, kill -9 was needed. Tried with Quarkus 1.11.0.Final in dev mode and when running java -jar target/..... To build the jar I had to skip the tests. The out of the box experience is not ideal.

Reproducer:

wget -q -O xx.zip https://code.quarkus.io/api/download?s=mj6
unzip -q xx.zip
cd code-with-quarkus
mvn quarkus:dev

Example with java -jar target/...., see ^C attempts to stop the app:

 java -jar target/code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2021-01-20 18:52:59,890 INFO  [com.dat.oss.dri.int.cor.DefaultMavenCoordinates] (main) DataStax Java driver for Apache Cassandra(R) (com.datastax.oss:java-driver-core) version 4.7.2
2021-01-20 18:53:00,910 INFO  [com.dat.oss.dri.int.cor.tim.Clock] (vert.x-eventloop-thread-0) Using native clock for microsecond precision
2021-01-20 18:53:00,913 INFO  [com.dat.oss.dri.int.cor.met.MetadataManager] (vert.x-eventloop-thread-0) [s0] No contact points provided, defaulting to /127.0.0.1:9042
2021-01-20 18:53:01,041 WARN  [com.dat.oss.dri.int.cor.con.ControlConnection] (vert.x-eventloop-thread-1) [s0] Error connecting to Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=5f683821), trying next node (ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (java.nio.channels.ClosedChannelException))
2021-01-20 18:53:02,055 WARN  [com.dat.oss.dri.int.cor.con.ControlConnection] (vert.x-eventloop-thread-1) [s0] Error connecting to Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=5f683821), trying next node (ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (java.nio.channels.ClosedChannelException))
2021-01-20 18:53:04,306 WARN  [com.dat.oss.dri.int.cor.con.ControlConnection] (vert.x-eventloop-thread-1) [s0] Error connecting to Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=5f683821), trying next node (ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (java.nio.channels.ClosedChannelException))
^C^C^C^C^C^C2021-01-20 18:53:08,194 WARN  [com.dat.oss.dri.int.cor.con.ControlConnection] (vert.x-eventloop-thread-1) [s0] Error connecting to Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=5f683821), trying next node (ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (java.nio.channels.ClosedChannelException))
2021-01-20 18:53:15,961 WARN  [com.dat.oss.dri.int.cor.con.ControlConnection] (vert.x-eventloop-thread-1) [s0] Error connecting to Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=5f683821), trying next node (ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (java.nio.channels.ClosedChannelException))
Killed: 9

┆Issue is synchronized with this Jira Task by Unito

adutra commented 3 years ago

Hi thanks for reporting this.

The driver itself responds nicely to interrupts, but indeed the Quarkus extension does not. I tried to look for obvious culprits (catch InterruptedException, etc. ) but couldn't spot anything.

I agree that the user experience is bad. I tried the mongo db sample for code.quarkus.io and it seems the mongodb-client is only initialized on demand, and as a result no actual connection is made. And obviously the mvn command stops when I hit CTRL+C.

adutra commented 3 years ago

OK I found the cause. There was something broken with eager session initialization. I will open a PR with a few changes: