File event listener is recreated after deletion
Assignee

Reporter

Sprint
Description
Steps to reproduce
Attachments
Activity

Filip Reichman August 18, 2020 at 11:38 AM
Added a check: an EventListener is not updated if it has already been deleted.

Filip Reichman August 18, 2020 at 6:42 AMEdited
It is a race condition
there is a collection of FileEventProducers (NodeDependentEventListenerLifecycleAware.activeEventProducers), each FileEventProducer is holding an instance of FileEventListener
a FileEventListener is deleted from DB
in the meantime FileEventProducer holding reference to the deleted FileEventListener is executed and it updates the FileEventListener in the DB
the FileEventListener is not in the DB anymore, so a brand new FileEventListener is created
the original FileEventProducer is removed from the collection
a new FileEventProducer is added to the collection
The FileEventProducer should be removed from the collection before it is deleted from DB, but there is a job ClusterNodeCheckJob (executing EventListenerManager.checkActiveListeners()) checking if listeners (located in the Cache) are active, so the (not in DB) listener can be initialized again.
Recently, some of our CTE test fail (on core, worker, cluster) because of errors logged in
all.log
. The errors come from a failing file event listener.Example of the error:
The listener is created during
FileEventListenerTest
(specifically/cloveretl.server/src/integrationTest/java/com/cloveretl/server/test/events/file/suite/A2_ImportFileEventListenersTest.java
). I've seenS3-remote-file-event-listener-test
orFTP-slow-file-upload-listener-test
. All the listeners are deleted after the test, so this should not happen. It seems that some of the listeners are sometimes recreated after deletion.Example: https://linda.javlin.eu/jenkins/job/cloveretl.server-vte-test-worker-master/790/CONTAINER=weblogic-12-2-1,DATABASE=db2,OBFUSCATION=obfuscated,jdk=java-1.8/ - listener
FTP-slow-file-upload-listener-test
is active (and failing) after the tests finished.Creation of the listener (jenkins build log + all.log):
So the listener has id 92 and taskId 115.
Then the listener is deleted (jenkins build log + server-audit.log):
So the listener should be deleted, but it appears again with different id (from all.log):