Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 6582a859c25cab0b1392a7443c3a44ad2c48b761
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Sep 25 11:03:42 2024
Add debug information to connection pool timeout exception
When a timeout occurs acquiring a connection include in the exception message the state of the connections, if acquired the coroutine context and a stacktrace of when it was acquired.
Example message:
```
Error code: 5, message: Timed out attempting to acquire a reader connection.
Writer pool:
androidx.room.coroutines.Pool@681a8b4e (capacity=1)
[1] - null
Reader pool:
androidx.room.coroutines.Pool@5cbe877d (capacity=2)
[1] - androidx.sqlite.driver.bundled.BundledSQLiteConnection@5c08c46a
Status: Acquired connection
Coroutine: [RunningInRunTest, kotlinx.coroutines.test.TestCoroutineScheduler@4218500f, kotlinx.coroutines.test.TestScopeKt$TestScope$$inlined$CoroutineExceptionHandler$1@4bff64c2, DispatchedCoroutine{Active}@1b2c4efb, java.util.concurrent.ScheduledThreadPoolExecutor@289710d9[Running, pool size = 2, active threads = 0, queued tasks = 1, completed tasks = 2]]
Acquired:
at androidx.room.coroutines.ConnectionWithLock.markAcquired(ConnectionPoolImpl.kt:276)
at androidx.room.coroutines.ConnectionPoolImpl.useConnection(ConnectionPoolImpl.kt:133)
at androidx.room.coroutines.BaseConnectionPoolTestKt.useReaderConnection(BaseConnectionPoolTest.kt:1211)
at androidx.room.coroutines.BaseConnectionPoolTest$timeoutCoroutineWaitingForConnection$1$1.invokeSuspend(BaseConnectionPoolTest.kt:606)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
[2] - androidx.sqlite.driver.bundled.BundledSQLiteConnection@8a089df3
Status: Free connection
```
Bug: 347737870
Bug: 367991769
Test: Existing
Change-Id: I3895e8c45bc7ddc80e6475208f4ae22c35056b1c
M room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/ConnectionPoolImpl.kt
M room/room-runtime/src/commonTest/kotlin/androidx/room/coroutines/BaseConnectionPoolTest.kt
https://android-review.googlesource.com/3232581
Branch: androidx-main
commit 6582a859c25cab0b1392a7443c3a44ad2c48b761
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Sep 25 11:03:42 2024
Add debug information to connection pool timeout exception
When a timeout occurs acquiring a connection include in the exception message the state of the connections, if acquired the coroutine context and a stacktrace of when it was acquired.
Example message:
```
Error code: 5, message: Timed out attempting to acquire a reader connection.
Writer pool:
androidx.room.coroutines.Pool@681a8b4e (capacity=1)
[1] - null
Reader pool:
androidx.room.coroutines.Pool@5cbe877d (capacity=2)
[1] - androidx.sqlite.driver.bundled.BundledSQLiteConnection@5c08c46a
Status: Acquired connection
Coroutine: [RunningInRunTest, kotlinx.coroutines.test.TestCoroutineScheduler@4218500f, kotlinx.coroutines.test.TestScopeKt$TestScope$$inlined$CoroutineExceptionHandler$1@4bff64c2, DispatchedCoroutine{Active}@1b2c4efb, java.util.concurrent.ScheduledThreadPoolExecutor@289710d9[Running, pool size = 2, active threads = 0, queued tasks = 1, completed tasks = 2]]
Acquired:
at androidx.room.coroutines.ConnectionWithLock.markAcquired(ConnectionPoolImpl.kt:276)
at androidx.room.coroutines.ConnectionPoolImpl.useConnection(ConnectionPoolImpl.kt:133)
at androidx.room.coroutines.BaseConnectionPoolTestKt.useReaderConnection(BaseConnectionPoolTest.kt:1211)
at androidx.room.coroutines.BaseConnectionPoolTest$timeoutCoroutineWaitingForConnection$1$1.invokeSuspend(BaseConnectionPoolTest.kt:606)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
[2] - androidx.sqlite.driver.bundled.BundledSQLiteConnection@8a089df3
Status: Free connection
```
Bug: 347737870
Bug: 367991769
Test: Existing
Change-Id: I3895e8c45bc7ddc80e6475208f4ae22c35056b1c
M room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/ConnectionPoolImpl.kt
M room/room-runtime/src/commonTest/kotlin/androidx/room/coroutines/BaseConnectionPoolTest.kt
da...@google.com <da...@google.com>
na...@google.com <na...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.room:room-runtime:2.7.0-alpha10
androidx.room:room-runtime-android:2.7.0-alpha10
androidx.room:room-runtime-macosx64:2.7.0-alpha10
Description
* Include number of connection open
* Include number of connections being used
* Include stacktrace and coroutine that acquired a connection
Also, let the user adjust the timeout time.