Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-10473

Coverity, volatile not atomically updated in RotatingFileAuditEndpoint (Elytron)

XMLWordPrintable

      There is variable currentSize marked with modifier as volatile, what hint variable currentSize is used in multithreaded manner, as volatile ensures actual value can be seen between threads.
      On the other side there is update operation on currentSize, which is not written in atomic manner, so can lead race condition.

          @Override
          protected void write(byte[] bytes) throws IOException {
              super.write(bytes);
              currentSize += bytes.length;
          }
      

      Setting as Critical as that can lead to strange / hard to reproduce errors.
      https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=15443553&defectInstanceId=3634186&mergedDefectId=1429223

            yborgess1@redhat.com Yeray Borges Santana
            mchoma@redhat.com Martin Choma
            Martin Choma Martin Choma
            Martin Choma Martin Choma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: