DESCRIPTION

tmf: Bug 437841: NullPointerException in HistogramBucket

Change-Id: I5bd31107c826592cd7ffe41c73a441792470fa50
Signed-off-by: Luciana Barry xxx@xxx.xxx


COMMENTS

author: Luciana Barry
date: 2014-06-20 19:59:19.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2014-06-20 19:59:25.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/7489/

-------------------------------------
author: Brenden Conley
date: 2014-06-20 20:54:06.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/7489/ : SUCCESS

-------------------------------------
author: Annalise Jimenez
date: 2014-06-25 15:38:40.000000000

Patch Set 1: Code-Review-1

Wouldn't using synchronized be a surer way of ensuring consistency? Might there not be 2 calls to ensureCapacity at the same time and the array will be copied twice?

-1 so you notice the question

-------------------------------------
author: Luciana Barry
date: 2014-07-07 18:45:16.000000000

Patch Set 1:

Yes that is true, and if the 'new' length is different in both concurrent calls to ensureCapacity(), there might be an ArrayIndexOutOfBoundsException thrown when trying to increment the event counter.

However, I was really trying to avoid the cost of a synchronization call at every event in the trace. And with the current design, there can be only one writer thread (HistogramRequest) on the histogram buckets at a time.

This patch only attempts to fix synchronization problems between the reader thread(s) and the writer thread.

Note that a reader thread might miss an event in the middle of being counted by the writer thread, but that is OK because there should always be one last update (reader thread) after the writing is finished.

-------------------------------------
author: Annalise Jimenez
date: 2014-07-07 20:11:56.000000000

Patch Set 1:

"with the current design", that's dangerous. That class can be reused by anyone in any context. If it is not safe with more than one writer, then the one-writer rule should be enforced, or else this behavior well-documented.

I know you're solving a bug and my comment applies also to the actual code, but they class might as well be fixed right away, before we forget, at least through documentation.

So my -1 stays :D

-------------------------------------
author: Luciana Barry
date: 2014-07-08 16:07:16.000000000

Patch Set 1:

OK. I think we can add synchronization only for the write methods.

-------------------------------------
