View Issue Details

IDProjectCategoryView StatusLast Update
0002970SymmetricDSBugpublic2021-11-17 16:00
Reporternuralimca Assigned Topmarzullo  
Priorityhigh 
Status closedResolutionfixed 
Product Version3.7.33 
Target Version3.13.0Fixed in Version3.13.0 
Summary0002970: db connection leaks after engine stop
DescriptionDear All,

I have embedded Symmetric DS 3.7.33 into my webapp. I have Web UI which allows user to start and stop Symmetric DS Engine.

When user click on Stop button, I internally call below method on server side:
ISymmetricEngine.destroy()

Which first stop() and then destroy() the engine.

I found that after destroy() called if I check then there are few database connections are not closed (connection for database associated with given engine).

Overall, even after calling destroy() on engine, there are database connection leak.

I was expecting that once I call destroy() method all the database connection should be closed.

Please suggest if there is any other cleaner way to stop/destroy engine so that database connection leak is not happened or fix database connection leak issue with stop/destroy of engine.

Thanks,
Nurali
Steps To Reproduce1. start source engine for source database with stream.to.file.enabled=true
2. start target engine for target database.
3. make sure there is active data copy going on, like keep huge initial load and on start of both engine data is continuously getting copied from source to target.
4. stop source engine and stop target engine.
5. try to delete target database.

For step 5, delete of target database is failing with error that there are active connections.
Tagsapi, sym/sym_service

Relationships

related to 0003897 closedpmarzullo Cleanly exit all job threads when engine is stopped 

Activities

nuralimca

2017-01-25 11:10

reporter   ~0000960

Dear All,

*Issue Details:*
I have also analyzed the issue. The issue happens when there is continuous data copy happening between source and target engine. This issue generally easily reproduce for initial load with some good amount of data to be copied.

When I call ClientSymmetricEngine.destroy(), it internally call AbstractSymmetricEngine.stop() in which thread.interrupt() is called for processInfo.getThread().

It happens that ..

1. ClientSymmetricEngine.destroy() is called at first
2. AbstractSymmetricEngine.stop() will be call
3. thread.interrupt() will be called
4. destroy() will call ((BasicDataSource)dataSource).close()
5. thread will throw org.jumpmind.exception.IoException: This thread was interrupted

Here, thread which got interrupted at step 3 is push thread with thread name "tnt3_rt-0000-push-1".

So, it happens that the push thread got interrupted at step-3 and dataSource.close() called before the push thread actually complete and got interrupt. This somehow leads to connection leaks for source database.

*One way to Fix:*
In AbstractSymmetricEngine.stop() after interrupting the thread, we should wait to join the thread.

thread.interrupt()
thread.join()

Thanks,
Nurali

pmarzullo

2021-06-14 19:06

developer   ~0001954

Fixed on 0003897

Issue History

Date Modified Username Field Change
2017-01-25 10:57 nuralimca New Issue
2017-01-25 11:10 nuralimca Note Added: 0000960
2017-03-22 18:47 chenson Assigned To => maxwellpettit
2017-03-22 18:47 chenson Status new => assigned
2019-04-24 14:35 elong Relationship added related to 0003897
2019-04-24 14:35 elong Tag Attached: api
2019-04-26 17:11 elong Tag Attached: sym/sym_service
2019-05-13 18:24 elong Assigned To maxwellpettit => pmarzullo
2019-05-13 18:24 elong Target Version => 3.10.3
2019-06-24 17:45 elong Target Version 3.10.3 => 3.10.4
2019-08-09 19:41 elong Target Version 3.10.4 => 3.10.5
2019-10-31 14:59 admin Target Version 3.10.5 => 3.10.6
2019-11-14 19:47 elong Target Version 3.10.6 => 3.10.7
2019-12-09 15:25 admin Target Version 3.10.7 => 3.10.8
2020-01-02 14:40 admin Target Version 3.10.8 => 3.10.9
2020-01-22 19:03 elong Target Version 3.10.9 => 3.10.10
2020-02-14 13:46 elong Target Version 3.10.10 => 3.10.11
2020-03-16 20:10 admin Target Version 3.10.11 => 3.12.0
2020-05-26 12:27 elong Target Version 3.12.0 => 3.13.0
2021-06-14 19:06 pmarzullo Status assigned => resolved
2021-06-14 19:06 pmarzullo Resolution open => fixed
2021-06-14 19:06 pmarzullo Fixed in Version => 3.13.0
2021-06-14 19:06 pmarzullo Note Added: 0001954
2021-11-17 16:00 admin Status resolved => closed