PDGGK opened a new issue, #11749:
URL: https://github.com/apache/seatunnel/issues/11749

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   ### What happened
   
   `Neo4jSinkWriter.close()` and `Neo4jSourceReader.close()` both release the 
session and the driver as consecutive statements, so anything that throws part 
way through leaks the rest.
   
   The sink is the sharper case, because `close()` flushes the last batch first:
   
   ```java
   // Neo4jSinkWriter.java:144
   public void close() throws IOException {
       flushWriteBuffer();
       session.close();
       driver.close();
   }
   ```
   
   `flushWriteBuffer()` → `writeByQuery()` deliberately converts a 
`Neo4jException` into a `Neo4jConnectorException` and rethrows it 
(`Neo4jSinkWriter.java:129-132`). So whenever the final batch fails to write — 
the database going away during teardown is the ordinary case — neither 
`session.close()` nor `driver.close()` runs, and the whole `Driver` is leaked 
along with its connection pool and Netty event-loop group.
   
   `Neo4jSourceReader.close()` has the same shape without the flush:
   
   ```java
   // Neo4jSourceReader.java:73
   public void close() throws IOException {
       session.close();
       driver.close();
   }
   ```
   
   If `session.close()` throws, the driver is leaked.
   
   ### SeaTunnel Version
   
   dev
   
   ### SeaTunnel Config
   
   Any Neo4j sink; the leak happens at teardown, not in the pipeline definition.
   
   ### Running Command
   
   n/a
   
   ### Error Exception
   
   No exception is reported for the leak itself — the `Neo4jConnectorException` 
from the failed flush is what surfaces, and the leaked driver is silent.
   
   ### Zeta or Flink or Spark Version
   
   n/a
   
   ### Java or Scala Version
   
   n/a
   
   ### Screenshots
   
   n/a
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to