[Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread Derek Gaston
Ummm... guys... is it just me... or did I _completely_ cock up the double-checked lock I put into PetscVector? Just look at where the damn lock is! It's inside the second `if`!! That's not going to work! https://github.com/libMesh/libmesh/blob/master/src/numerics/petsc_vector.C#L1331 We had so

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread Cody Permann
We aren't building C++11 yet on the build boxes so I guess that's why it appears fine. Also, our users are still defaulting to C++03 so yeah, nobody would be hitting this bug except for devs and we don't exercise threading too often in our day to day work. On Wed, Mar 30, 2016 at 10:01 AM Derek Ga

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread John Peterson
On Wed, Mar 30, 2016 at 10:00 AM, Derek Gaston wrote: > Ummm... guys... is it just me... or did I _completely_ cock up the > double-checked lock I put into PetscVector? > > Just look at where the damn lock is! It's inside the second `if`!! > That's not going to work! > > > https://github.com/lib

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread Derek Gaston
Yeah - definitely egg on my face. There were so many different versions that I just screwed up the final one. I'll put in a PR to fix it. The weird thing is... I know that I ran tests on this version... and it worked fine. Must have just gotten lucky (a few million times). Derek On Wed, Mar 3

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread John Peterson
On Wed, Mar 30, 2016 at 10:09 AM, Derek Gaston wrote: > Yeah - definitely egg on my face. There were so many different versions > that I just screwed up the final one. > > I'll put in a PR to fix it. > > The weird thing is... I know that I ran tests on this version... and it > worked fine. Must

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread Slaughter, Andrew E
Is Hork > Bork? If so, how may borks does it take to create a hork? On Wed, Mar 30, 2016 at 10:20 AM, John Peterson wrote: > > > On Wed, Mar 30, 2016 at 10:09 AM, Derek Gaston wrote: > >> Yeah - definitely egg on my face. There were so many different versions >> that I just screwed up the fina

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread Derek Gaston
Yep - they are just straddling the wrong "if". They need to be straddling the _first_ "if". Just a dumb mistake. The timing results weren't BS... they were real... but I don't know how the code was working! Derek On Wed, Mar 30, 2016 at 12:21 PM John Peterson wrote: > On Wed, Mar 30, 2016 at

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread Derek Gaston
Actually - after thinking about it a bit more... the current code is actually _correct_ (in that, it will always produce the correct result). The worst that's going to happen is that we'll cache that data twice. But the memory fences are in place and the lock is there... so the data caching will

Re: [Libmesh-devel] Horked Up Double-checked Lock

2016-03-30 Thread Derek Gaston
Andrew: "horked" is actually the correct technical term in this case: http://www.urbandictionary.com/define.php?term=horked ;-) Derek On Wed, Mar 30, 2016 at 12:25 PM Slaughter, Andrew E < andrew.slaugh...@inl.gov> wrote: > Is Hork > Bork? If so, how may borks does it take to create a hork? > >