Github user arina-ielchiieva commented on a diff in the pull request: https://github.com/apache/drill/pull/1094#discussion_r162311140 --- Diff: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java --- @@ -132,10 +132,12 @@ protected DrillConnectionImpl(DriverImpl driver, AvaticaFactory factory, bit = new Drillbit(dConfig, serviceSet); bit.run(); } catch (final UserException e) { + cleanup(); throw new SQLException( "Failure in starting embedded Drillbit: " + e.getMessage(), e); } catch (Exception e) { + cleanup(); --- End diff -- What if you use flag `doCleanup` which will be true by default and after `this.client.connect(connect, info);` succeedes, it would be set to false. In finally block you'll do clean up only if flag is true?
---