Daniel Barclay (Drill/MapR) created DRILL-1735:
--------------------------------------------------

             Summary: JDBC driver's close() leaks resources in local mode
                 Key: DRILL-1735
                 URL: https://issues.apache.org/jira/browse/DRILL-1735
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Daniel Barclay (Drill/MapR)


When the Drill JDBC driver is used in local mode (as  
DriverManager.getConnection("jdbc:drill:zk=local", ... ), the close() method 
doesn't free resources:  Calling getConnection() and then close() and then 
repeating that pair of calls enough times results in an exception, the root 
cause exeception of which is an IOException saying "Too many open files":

java.sql.SQLException: Failure while attempting to start Drillbit in embedded 
mode.
        at 
org.apache.drill.jdbc.DrillConnectionImpl.<init>(DrillConnectionImpl.java:81)
        at 
org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection.<init>(DrillJdbc41Factory.java:88)
        at 
org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:57)
        at 
org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:1)
        at 
org.apache.drill.jdbc.DrillFactory.newConnection(DrillFactory.java:51)
        at 
net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:126)
        at java.sql.DriverManager.getConnection(DriverManager.java:571)
        at java.sql.DriverManager.getConnection(DriverManager.java:187)
        at 
temp.BugXxxxCloseDoesntCloseTest.testBug(BugXxxxCloseDoesntCloseTest.java:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalStateException: failed to create a child event loop
        at 
io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:68)
        at 
io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:49)
        at 
io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:61)
        at 
io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:52)
        at 
org.apache.drill.exec.rpc.TransportCheck.createEventLoopGroup(TransportCheck.java:75)
        at 
org.apache.drill.exec.server.BootStrapContext.<init>(BootStrapContext.java:45)
        at org.apache.drill.exec.server.Drillbit.<init>(Drillbit.java:95)
        at 
org.apache.drill.jdbc.DrillConnectionImpl.<init>(DrillConnectionImpl.java:78)
        ... 18 more
Caused by: io.netty.channel.ChannelException: failed to open a new selector
        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:128)
        at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:120)
        at 
io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:87)
        at 
io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:64)
        ... 25 more
Caused by: java.io.IOException: Too many open files
        at sun.nio.ch.IOUtil.makePipe(Native Method)
        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:126)
        ... 28 more







java.sql.SQLException: Failure while attempting to start Drillbit in embedded 
mode.
        at 
org.apache.drill.jdbc.DrillConnectionImpl.<init>(DrillConnectionImpl.java:81)
        at 
org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection.<init>(DrillJdbc41Factory.java:88)
        at 
org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:57)
        at 
org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:1)
        at 
org.apache.drill.jdbc.DrillFactory.newConnection(DrillFactory.java:51)
        at 
net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:126)
        at java.sql.DriverManager.getConnection(DriverManager.java:571)
        at java.sql.DriverManager.getConnection(DriverManager.java:187)
        at 
org.apache.drill.jdbc.test.BugXxxxCloseDoesntCloseTest.testBug(BugXxxxCloseDoesntCloseTest.java:42)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalStateException: failed to create a child event loop
        at 
io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:68)
        at 
io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:49)
        at 
io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:61)
        at 
io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:52)
        at 
org.apache.drill.exec.rpc.TransportCheck.createEventLoopGroup(TransportCheck.java:75)
        at 
org.apache.drill.exec.server.BootStrapContext.<init>(BootStrapContext.java:45)
        at org.apache.drill.exec.server.Drillbit.<init>(Drillbit.java:95)
        at 
org.apache.drill.jdbc.DrillConnectionImpl.<init>(DrillConnectionImpl.java:78)
        ... 18 more
Caused by: io.netty.channel.ChannelException: failed to open a new selector
        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:128)
        at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:120)
        at 
io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:87)
        at 
io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:64)
        ... 25 more
Caused by: java.io.IOException: Too many open files
        at sun.nio.ch.IOUtil.makePipe(Native Method)
        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:126)
        ... 28 more





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to