You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/02/06 08:05:17 UTC

[GitHub] [commons-vfs] kinow commented on pull request #154: Rework SoftRefFilesCache locking

kinow commented on pull request #154:
URL: https://github.com/apache/commons-vfs/pull/154#issuecomment-774422095


   >I totally sympathise with @garydgregory about the lack of test, but also with @MaxKellermann in that writing tests that exercise thread-safety issues is a PITA.
   
   Ditto here. Writing tests for the thread-safety would be nice, but understandable if it's too hard to write.
   
   @MaxKellermann, @garydgregory what do you think if we break this PR into a few other smaller PR's, I think that would be easier to review, and grouping that way in case some bugs/issue is raised later, it might be easier to look at the changelog and see what could be causing it.
   
   For example, I think we could have one PR with smal improvements like (easy to review, don't think we need tests):
   
   - remove `super.close()` (maybe add a comment to the code where it was removed so we don't accidentally add it back? Will leave a comment there...)
   - use isEmpty() instead of size < 1
   - remove redundant isInterrupted() check 
   - simplify the InterruptedException catch block 
   
   Another for the Lock issues (great catch! in some cases we locked twice, in others forgot to require the lock, and in other cases we also locked the Lock object without acquiring the lock; I'd say we could code-review this change without a test [testing synchronized code blocks is hard, but code that is acquiring a Lock is even harder IMO])
   
   - fix ReentrantLock usage in {start,end}Thread() 
   - add missing lock to removeFile() 
   - require lock while calling removeFile(FileSystemAn… 
   - require lock while calling getOrCreateFilesystemCa… 
   - move endThread() call inside the lock 
   - require lock for startThread(), endThread() 
   - move code to removeFile(Reference)
   - don't use ConcurrentMap (oh, I liked this! Would need to read the code with calm to understand if there was no other case for the concurrent map, but I think you might be correct here!)
   
   Another PR for the volatile change (code-review might do I think)
   
   - eliminate "volatile" on softRefReleaseThread 
   
   And one more for the removal of `ReentrantLock`? Or maybe just create an issue for discussion regarding the Loom project with fibers and possible issues (I think that's what @efge meant?). 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org