[
https://issues.apache.org/jira/browse/PHOENIX-1143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Samarth Jain updated PHOENIX-1143:
----------------------------------
Attachment: PHOENIX-1143-3.0.patch
Patch for fixing the race condition when the PhoenixDriver or a
ConnectionQueryServicesImpl instance is closed and a PhoenixConnection is
requested using them.
Summary of changes:
1) ConnectionQueryServicesImpl.java - calls are wrapped now with a
ClosedChecker inner class that uses a ReadWriteReentrantLock to guard against
invoking a method that uses cluster when the ConnectionQueryServices instance
is closed or being closed. The performance impact of using the lock should be
minimal as the reads will be primarily uncontended. Only when the
ConnectionQueryServices instance is closing is when the readers will be
blocked.
2) PhoenixDriver and PhoenixTestDriver - now call checkClosed() before
returning a connection back to the caller in connect().
[~jamestaylor] - let me know if the patch looks good. I will upload patches for
4.0/master branches then. Thanks!
> Prevent race condition between creating phoenix connection and closing
> phoenix driver/connection query services.
> ----------------------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-1143
> URL: https://issues.apache.org/jira/browse/PHOENIX-1143
> Project: Phoenix
> Issue Type: Bug
> Reporter: Samarth Jain
> Assignee: Samarth Jain
> Fix For: 5.0.0, 3.1, 4.1
>
> Attachments: PHOENIX-1143-3.0.patch
>
>
> {code}
> java.lang.NullPointerException
> Thrown-StackTrace: at
> org.apache.phoenix.jdbc.PhoenixConnection.<init>(PhoenixConnection.java:178)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.connect(ConnectionQueryServicesImpl.java:513)
> at
> org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:116)
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)