Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-526

GetHTTP may not release writeLock

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.0.2
    • 0.1.0
    • Extensions

    Description

      GetHTTP onTrigger process contains a path that will obtain and not release the writeLock.
      This happens if enough time elapses between the first and second check of timeToPersist.

      Also the readLock locked and unlocked with no meaningful work in between.

      GetHTTP.java
      		if ((etag != null || lastModified != null) && readLock.tryLock()) {
                          try {
      			//first check of timeToPersist against current time
                              if (timeToPersist < System.currentTimeMillis()) {
      			    readLock.unlock();
      			    //obtain writeLock
                                  writeLock.lock();
      			    //check time to persist again, this result may be different
      			    //if the result is different because enough time has elapsed the lock is not released
                                  if (timeToPersist < System.currentTimeMillis()) {
                                      try {
                              
      				 ...
               
              		         } finally {
      	                            readLock.lock();
      				    //release writeLock only if the second check of timeToPresist is before now.
      
                                          writeLock.unlock();
                                      }
                                  }
                              }
                          } finally {
                              readLock.unlock();
                          }
                      }
      

      Attachments

        Activity

          People

            joewitt Joe Witt
            MarkLat Mark Latimer
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: