question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

r2dbc @Transactional causes Connection pool request timeout

See original GitHub issue

Environment Information

  • Operating System: window
  • Micronaut Version: 2.5.3
  • JDK Version: jdk8
  • MYSQL Version mysql8

Interface with transaction annotation, stress test causes connection pool request timeout, after closing pressure test for a few minutes, single request interface still prompts connection pool request timeout, which may be caused by connection pool leakage. There is no error because the transaction annotation is cancelled.

Example

@Get("/")
Flux<Book> all() {
  return bookService.findAll(); // With transaction;pool request timeout
  //return bookRepository.findAll(); // without,it's ok
}

  1. ab -n 5000 -c 300 http://127.0.0.1:8080/books
  2. curl http://127.0.0.1:8080/books curl: (18) transfer closed with outstanding read data remaining

logs

14:02:16.486 [default-nioEventLoopGroup-1-8] DEBUG i.m.d.r.o.DefaultR2dbcRepositoryOperations - Creating a new Connection for DataSource: default 14:02:28.504 [parallel-4] ERROR i.m.h.n.stream.HttpStreamsHandler - Error occurred writing stream response: Connection Acquisition timed out after 6000ms io.r2dbc.spi.R2dbcTimeoutException: Connection Acquisition timed out after 6000ms at io.r2dbc.pool.ConnectionPool.lambda$null$6(ConnectionPool.java:123) at reactor.core.publisher.Mono.lambda$onErrorMap$29(Mono.java:3370) at reactor.core.publisher.Mono.lambda$onErrorResume$31(Mono.java:3460) at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94) at reactor.core.publisher.SerializedSubscriber.onError(SerializedSubscriber.java:124) at reactor.core.publisher.SerializedSubscriber.onError(SerializedSubscriber.java:124) at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:294) at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.doTimeout(FluxTimeout.java:279) at reactor.core.publisher.FluxTimeout$TimeoutTimeoutSubscriber.onNext(FluxTimeout.java:418) at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79) at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:119) at io.micronaut.reactor.instrument.ReactorInstrumentation.lambda$null$0(ReactorInstrumentation.java:62) at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:832) Caused by: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 6000ms in ‘Connection Acquisition from [dev.miku.r2dbc.mysql.MySqlConnectionFactory@3e4fddc3]’ (and no fallback has been configured) … 13 common frames omitted

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chenjpucommented, Jul 8, 2021

Thanks so much, the problem was thoroughly solved.

1reaction
dstepanovcommented, Jun 9, 2021

@chenjpu I will look at it probably next week

Read more comments on GitHub >

github_iconTop Results From Across the Web

r2dbc-pool connection not released after cancel - Stack Overflow
I suppose that the cancellation request propagates to connectionPool.create(), but some iterations seems to have enough time to end the preQuery ...
Read more >
R2DBC/r2dbc - Gitter
our suspect is that db connections has become stale and pool is trying to clean-up/re-establish the connections and which is taking time. our...
Read more >
Reactive Relational Database Connectivity - R2DBC
R2DBC stands for Reactive Relational Database Connectivity. R2DBC started as an experiment and proof of concept to enable integration of ...
Read more >
R2dbcTransactionManager (Spring Framework 6.0.2 API)
The Connection s may come from a pool (the typical case), but the ConnectionFactory must not return scoped Connection s or the like....
Read more >
4 Optimizing Universal Connection Pool Behavior
Universal Connection Pool for JDBC Developer's Guide. Contents. Previous · Next ... The request receives an SQL exception if the timeout value is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found