stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mariangela Hills (JIRA)" <>
Subject [jira] [Created] (STRATOS-1439) Detecting Issues with Read Write Locks
Date Wed, 24 Jun 2015 09:55:06 GMT
Mariangela Hills created STRATOS-1439:

             Summary: Detecting Issues with Read Write Locks
                 Key: STRATOS-1439
             Project: Stratos
          Issue Type: Task
          Components: Documentation
    Affects Versions: 4.1.0
            Reporter: Mariangela Hills

Derive the information provided by Imesh in the email thread [1] and add it to the developer

[1] [Discuss] Detecting Issues with Read Write Locks
Hi Devs,

Currently we have significant amount of read write locks in Stratos codebase to synchronize
data structure updates made by multiple threads. 

As I figured out recently there are several possibilities that these locks could cause problems
if not properly implemented:

Problem 1: A thread trying to acquire a write lock while having a read lock.
Problem 2: Locks acquired but not released

I just implemented a ReadWriteLock class in stratos common module which could detect these
problems. This class make use of java.util.concurrent.locks.ReentrantReadWriteLock and implements
additional logic to detect problems. By default problem 2 detection logic is disabled, it
can be enabled by setting following system property:


I have now updated all read write locks with the above class.
Following is an example scenario where I detected an unreleased lock in the REST API:

	at org.apache.stratos.common.concurrent.locks.ReadWriteLockMonitor.checkTimeout(
	at java.util.concurrent.Executors$
	at java.util.concurrent.FutureTask.runAndReset(
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(
	at java.util.concurrent.ScheduledThreadPoolExecutor$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
[2015-01-20 18:30:12,952] ERROR {org.apache.stratos.common.concurrent.locks.ReadWriteLockMonitor}
-  System error, lock has not released for 30 seconds: [lock-name] topology [lock-type] Read
[thread-id] 405 [thread-name] http-nio-9443-exec-21 [stack-trace]


This message was sent by Atlassian JIRA

View raw message