- I have setup of 2 JDG 7.1 servers, which are supposed to be set for cross-site setup. They are connected through the RELAY2 protocol and have caches in the SYNC backup mode. Pretty much similar to the documentation setup: https://access.redhat.com/documentation/en-us/red_hat_jboss_data_grid/7.1/html/administration_and_configuration_guide/set_up_cross_datacenter_replication#configure_cross_datacenter_replication_remote_client_server_mode
- Then I have a simple Java application, which connects to the infinispan server through the hotrod (RemoteCache). I am seeing the deadlock when there is an attempt to write record to the same key "123" on both sites concurrently. There are those exceptions in the server.log of both servers:
I am also attaching the files with thread dumps from both servers.
If I am analyzing the thread-dump correctly, I see that what happened is:
- Site1 transaction1: cache.replace("123", val)
- Site1 transaction1: lockManager.lock("123", ...) called from AbstractLockingInterceptor. Acquired "site1-lock".
- Site1 transaction1: BackupSender.backupWrite called for "123" and sending backup to Site2
Concurrently with it, I have on site2:
- Site2 transaction2: cache.replace("123", val);
- Site2 transaction2: lockManager.lock("123", ...) called from AbstractLockingInterceptor. Acquired "site2-lock".
- Site2 transaction2: BackupSender.backupWrite called for "123" and sending backup to Site1
- In the meantime, Site2 received backup from Site1 (triggered by Site1 transaction1). But BaseBackupReceiver on site2 needs to wait for Site2 transaction2, for the site2-lock, so cannot continue. But site1 transaction1 is waiting for the response from BaseBackupReceiver, so cannot continue.
- In the meantime, Site1 received backup from Site2 (triggered by Site2 transaction2). But BaseBackupReceiver on site1 needs to wait for Site1 transaction1, for the site1-lock, so cannot continue. But site2 transaction2 is waiting for the response from BaseBackupReceiver, so cannot continue.
So we have nice deadlock here, which is "unblocked" after 10 seconds due the BackupSender timeout.