<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thanks Stuart, I've created a JIRA to
      track these issues:<br>
      <br>
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <a href="https://issues.jboss.org/browse/PLINK-225">https://issues.jboss.org/browse/PLINK-225</a><br>
      <br>
      On 06/08/13 17:02, Stuart Douglas wrote:<br>
    </div>
    <blockquote
      cite="mid:198261837.9178857.1375772546248.JavaMail.root@redhat.com"
      type="cite">
      <pre wrap="">Hi,

I have just been looking over Picketlink and I think I have spotted a couple of thread safety issues:

- File Data Store is not thread safe

It looks like there are quite a few problems here, but the biggest is that FileDataStore does not seem to use any sync, so multiple threads can be attempting to write out the database at the same time. Also threads can be modifying the database in memory at the same time it is being written out, so it is possible to write the DB in an inconsistent state. 

Also when the file is written out it is written out directly over the old file, which greatly increases the chance of file corruption (rather than writing a tmp file and then moving it over the existing one). The also means that any sort of error (such as a non-serializable attribute) will corrupt the store and make it unreadable. 

- LDAPIdentityStore is using SimpleDateFormat in a non-threadsafe manner

LDAPIdentityStore uses a static SimpleDateFormat, which is not thread safe. Not only that but this date format is modified before it is used in LDAPIdentityStore#parseLDAPDate, so if multiple threads are parsing dates with different timezone formats at the same time anything could happen.

Stuart</pre>
    </blockquote>
    <br>
  </body>
</html>