Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1679

tryLock with (and without) timeout allows simultaneous concurrent access to not thread-safe data to more then one client

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.3.5, 3.4
    • 3.2.4, 3.3.4
    • None
    • Hide

      1).Start some amount of threads.
      2).Each thread simultaneously with others obtains lock through LockService#getLock then performs tryLock with timeout. For example with timeout equal to 1 second.
      3).After successful lock the thread tries to increment an accessible by all threads counter.
      4).Thread sleeps for some time. For example for 100ms.
      5).Thread decrements the counter.
      6).Thread performs unlock.
      7).Each thread works during some time.

      Problem: in normal case the counter should have value 0 right after successful tryLock but sometimes it has value 1 meaning that some other thread modifies the counter at the same time.

      Show
      1).Start some amount of threads. 2).Each thread simultaneously with others obtains lock through LockService#getLock then performs tryLock with timeout. For example with timeout equal to 1 second. 3).After successful lock the thread tries to increment an accessible by all threads counter. 4).Thread sleeps for some time. For example for 100ms. 5).Thread decrements the counter. 6).Thread performs unlock. 7).Each thread works during some time. Problem: in normal case the counter should have value 0 right after successful tryLock but sometimes it has value 1 meaning that some other thread modifies the counter at the same time.

    Description

      It looks as it is possible to access a not thread-safe data simultaneously by several clients when tryLock with timeout is used.
      It is reproduced easily with timeouts from 1 to 3 seconds inclusive.
      It is very difficult to reproduce the issue with bigger values of the timeout.

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-bban Bela Ban
              architect.softweb.isd Architect SoftWeb.ISD (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: