Unsynchronized access to ContentEntry.state
-------------------------------------------
Key: GEOT-3314
URL: http://jira.codehaus.org/browse/GEOT-3314
Project: GeoTools
Issue Type: Bug
Components: data
Affects Versions: 2.6.1
Environment: ESX guest Linux, Oracle JDK 1.6u22. Running transactions
against PostgreSQL 8.3. Library being used by GeoServer 2.0.1.
Reporter: Dustin Parker
I was looking at a running GeoServer (2.0.1, which means GeoTools 2.6.1) that
had lots of transactions running against it and it started throwing NPEs in
org.geotools.data.store.ContentEntry:131. I looked at that line:
{code:title=ContentEntry.java}
130 ContentState auto = state.get(Transaction.AUTO_COMMIT);
131 ContentState copy = (ContentState) auto.copy(); // NPE
132 copy.setTransaction(transaction != null ? transaction :
Transaction.AUTO_COMMIT);
133 state.put(transaction, copy);
{code}
So it implies that 'auto' is null. However, the constructor says:
{code:title=ContentEntry.java}
87 ContentState autoState = dataStore.createContentState(this);
88 autoState.setTransaction(Transaction.AUTO_COMMIT);
89 this.state.put(Transaction.AUTO_COMMIT, autoState);
{code}
this.state.put is only called in two places: line 133 and line 89. Line 89
happens first, associating {{Transaction.AUTO_COMMIT}} with a newly-created
(and dereferenced, so non-null) {{ContentState}}. 133 associates a given
transaction, transaction, with the {{ContentState}} associated with
{{Transaction.AUTO_COMMIT}}, which we already must be non-null. So there is no
chance of autoState ever being null, but it clearly was in the live system. I
did a heap dump and ran {[jhat}} (I still have the heap dump, so I can answer
any questions you may have about it, but I can't post it) and saw that there
were instances of {{ContentEntry}} whose state map had no association for
{{Transaction.AUTO_COMMIT}}! This should have been impossible, so it leaves
only the possibility of map corruption by unsynchronized access
({{ContentEntry.state}} is a plain {{HashMap}}).
If this really is a problem, it would explain some of the random failures we've
been having....
I'm going to try and reproduce the problem on my own laptop and then try and
make a patch to fix the problem if there are no objections.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel