openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <>
Subject [jira] Updated: (OPENJPA-1168) NPE in UUIDGenerator.initializeForType1()
Date Wed, 08 Jul 2009 22:07:15 GMT


Rick Curtis updated OPENJPA-1168:

    Attachment: OPENJPA-1168.patch

The patch includes a test case and the fix for this issue. 

Since this bug is a timing window, running this test case against an un-patched tree may work
from time to time. Please let me know if you want me to post some more information in the
test case about why I did what I did.

- Rick

> NPE in UUIDGenerator.initializeForType1()
> -----------------------------------------
>                 Key: OPENJPA-1168
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: lib
>            Reporter: Rick Curtis
>            Assignee: Rick Curtis
>             Fix For: 1.3.0, 2.0.0
>         Attachments: OPENJPA-1168.patch
> When UUIDGenerator.createType1() is called by more than one thread at *nearly* the same
time AND UUIDGenerator.createType1() wasn't called previously, a small timing window exists
where a NPE will result.
> Scenario:
> Thread 1 calls UUIDGenerator.createType1() and RANDOM == null so initializeForType1()
is called. While that thread is in initializeForType1(), it sets the static variable RANDOM
so that value is no longer null. Now Thread 2 calls UUIDGenerator.createType1() and RANDOM
is no longer null, so it proceeds to the call System.arraycopy(IP, 0, uuid, 10, IP.length);.
At this point Thread 1 hasn't got to initializing IP yet, so Thread 2 gets hits a NPE.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message