www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8596] New: Indeterministic assertion failure in rehash

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596

           Summary: Indeterministic assertion failure in rehash
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch


--- Comment #0 from timon.gehr gmx.ch 2012-08-28 12:28:46 PDT ---
DMD 2.060

The following assertion failure occurs indeterministically:

dmd: ../ztc/aa.c:423: void AArray::rehash_x(aaA*, aaA**, size_t): Assertion `0'
failed.

The frequency seems to increase as project size grows.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


deadalnix <deadalnix gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |deadalnix gmail.com


--- Comment #1 from deadalnix <deadalnix gmail.com> 2012-09-02 08:03:16 PDT ---
It tend to become a serious problem to me.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 02 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #2 from timon.gehr gmx.ch 2012-09-02 08:03:54 PDT ---
(In reply to comment #1)
 It tend to become a serious problem to me.
+1. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 02 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2012-11-12
11:50:58 PST ---
The assert happens when more than one item in the hash table has the same key.
A hash table may only have one item per key.

It would be helpful if you could run it under linux or osx, compile dmd with
-g, and get a stack trace.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


deadalnix <deadalnix gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


--- Comment #4 from deadalnix <deadalnix gmail.com> 2012-11-12 12:20:48 PST ---
(In reply to comment #3)
 The assert happens when more than one item in the hash table has the same key.
 A hash table may only have one item per key.
 
 It would be helpful if you could run it under linux or osx, compile dmd with
 -g, and get a stack trace.
I fail to trigger the error when using gdb. Seems like gdb is influencing on what does trigger the error. The error trigger as well when dmd is compiled with -g . Looks like a race condition. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #5 from Walter Bright <bugzilla digitalmars.com> 2012-11-12
12:39:20 PST ---
dmd isn't multithreaded, so it could not be a race condition.

It does, however, sound like memory corruption.

Can you run it under valgrind?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #6 from deadalnix <deadalnix gmail.com> 2012-11-12 12:45:50 PST ---
(In reply to comment #5)
 dmd isn't multithreaded, so it could not be a race condition.
 
 It does, however, sound like memory corruption.
 
 Can you run it under valgrind?
Already tryed, but I don't have enough RAM on my machine to do so. Consider that compiling the project require more than 2.2Gb of RAM without valgrind. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #7 from Walter Bright <bugzilla digitalmars.com> 2012-11-12
12:51:20 PST ---
If you're running the 64 bit dmd, shouldn't it be able to use far more virtual
memory (very slowly)?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


Alex Rønne Petersen <alex lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex lycus.org


--- Comment #8 from Alex Rønne Petersen <alex lycus.org> 2012-11-12 21:54:31
CET ---
Well, only if paging is enabled (i.e. there is a swap partition in use). I know
I set my systems up without paging because I practically never need it.

 deadalnix How much RAM does your system have?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #9 from deadalnix <deadalnix gmail.com> 2012-11-12 14:00:55 PST ---
(In reply to comment #8)
 Well, only if paging is enabled (i.e. there is a swap partition in use). I know
 I set my systems up without paging because I practically never need it.
 
  deadalnix How much RAM does your system have?
I have 4Gb. Minus what the system uses plus some programs running, it is already swapping when dmd uses 2.2Gb. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #10 from deadalnix <deadalnix gmail.com> 2012-11-12 14:06:19 PST ---
(In reply to comment #9)
 (In reply to comment #8)
 Well, only if paging is enabled (i.e. there is a swap partition in use). I know
 I set my systems up without paging because I practically never need it.
 
  deadalnix How much RAM does your system have?
I have 4Gb. Minus what the system uses plus some programs running, it is already swapping when dmd uses 2.2Gb.
OK, I did ran valgrind into a terminal without any graphical interface. I hope I'll not run out of swap because of the memory I won disabling the graphical interface. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #11 from deadalnix <deadalnix gmail.com> 2012-11-12 15:48:04 PST ---
Created an attachment (id=1160)
valgrind output

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #12 from Walter Bright <bugzilla digitalmars.com> 2012-11-12
16:56:17 PST ---
(In reply to comment #11)
 Created an attachment (id=1160) [details]
 valgrind output
Fixed the valgrind reported issue. It's definitely a corruption bug in the aa.c code. Testing now. If you want to try it out: ============================== diff aa.bak aa.c 72c72 < delete en; ---
                 delete [] en;
79c79 < delete en; ---
         delete [] en;
============================== I love valgrind. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #13 from Walter Bright <bugzilla digitalmars.com> 2012-11-12
17:09:08 PST ---
https://github.com/D-Programming-Language/dmd/commit/80884506df7a020e879ba3adda5a98d0465e7164

I won't mark it fixed until you guys can verify, as I don't have your test
code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #14 from deadalnix <deadalnix gmail.com> 2012-11-12 17:21:20 PST ---
(In reply to comment #13)
 https://github.com/D-Programming-Language/dmd/commit/80884506df7a020e879ba3adda5a98d0465e7164
 
 I won't mark it fixed until you guys can verify, as I don't have your test
 code.
Bad news : just tested the patch and got 6 out of 10 compilation failed on this assert. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #15 from Walter Bright <bugzilla digitalmars.com> 2012-11-12
17:30:24 PST ---
(In reply to comment #14)
 
 Bad news : just tested the patch and got 6 out of 10 compilation failed on this
 assert.
What do you mean? Dmd won't compile? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #16 from deadalnix <deadalnix gmail.com> 2012-11-12 17:35:10 PST ---
(In reply to comment #15)
 (In reply to comment #14)
 
 Bad news : just tested the patch and got 6 out of 10 compilation failed on this
 assert.
What do you mean? Dmd won't compile?
No, dmd compile :D But my program didn't using that patched dmd 6 time out of 10. It means that the issue remains. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #17 from bearophile_hugs eml.cc 2012-11-12 18:22:33 PST ---
(In reply to comment #16)

 It means that the issue remains.
Then I suggest to run it again in Valgrind :-) Maybe there are other bugs to fix it spots. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #18 from deadalnix <deadalnix gmail.com> 2012-11-13 02:01:24 PST ---
(In reply to comment #17)
 (In reply to comment #16)
 
 It means that the issue remains.
Then I suggest to run it again in Valgrind :-) Maybe there are other bugs to fix it spots.
I did, but found nothing. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 13 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #19 from Walter Bright <bugzilla digitalmars.com> 2012-11-13
13:32:12 PST ---
Ok, the next step is to compile your app without -g. The reason is because hash
tables are used in the dwarf debug generation, and I want to see if that one is
the problem or other uses.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 13 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #20 from deadalnix <deadalnix gmail.com> 2012-11-14 04:40:08 PST ---
(In reply to comment #19)
 Ok, the next step is to compile your app without -g. The reason is because hash
 tables are used in the dwarf debug generation, and I want to see if that one is
 the problem or other uses.
Tested with flags : -m64 -w -debug -unittest (removing the -gc flag I usually use). I « successfully » triggered the error as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 14 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #21 from Walter Bright <bugzilla digitalmars.com> 2012-11-14
16:59:25 PST ---
I've tried various schemes to induce it to fail, and done a code review. I
can't find anything wrong. I need a test case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 14 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #22 from deadalnix <deadalnix gmail.com> 2012-11-25 21:56:49 PST ---
(In reply to comment #21)
 I've tried various schemes to induce it to fail, and done a code review. I
 can't find anything wrong. I need a test case.
Sorry for being unavailable the past few days, I was moving from France to USA. I can trigger the error on a regular basis with the following codebase : git clone git://github.com/deadalnix/SDC.git cd SDC git checkout aa_assert make the program is made to be compiled on linux. My computer is a dual core athlon with 4Gb of RAM. I can't come up with a simple test case that trigger the error, because it seems that size matter here. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #23 from Walter Bright <bugzilla digitalmars.com> 2012-12-10
04:58:03 PST ---
When I try your instructions, I get:


make
~/cbx/mars/dmd -ofbin/sdc src/sdc/*.d src/sdc/ast/*.d src/sdc/pass/*.d
src/d/ast/*.d src/d/backend/*.d src/d/parser/*.d src/d/pass/*.d src/util/*.d
src/etc/linux/*.d import/llvm/c/target.d -m64 -w -debug -gc -unittest -Iimport
-L-L`llvm-config-3.1 --libdir` `llvm-config-3.1 --libs | sed 's/-l/-L-l/g'`
-L-lstdc++ -L-ldl -L-lffi
/bin/sh: llvm-config-3.1: not found
/bin/sh: llvm-config-3.1: not found
src/sdc/compilererror.d(188): Warning: statement is not reachable
dmd: func.c:1200: virtual void FuncDeclaration::semantic3(Scope*): Assertion
`type == f' failed.
Aborted
make: *** [bin/sdc] Error 134


which is not the error you reported.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


Rene Zwanenburg <renezwanenburg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |renezwanenburg gmail.com


--- Comment #24 from Rene Zwanenburg <renezwanenburg gmail.com> 2013-04-01
18:25:08 PDT ---
Running into this issue since today. I'm developing on a 64 bit windows machine
targeting 32 bit, production machine is running 64 bit debian. Using DMD 2.062
on both boxes.

The bug pops up at the strangest moments. I can confirm it's indeterministic,
but so far the production box never failed to build. That said, I don't build
very often on production, esp. if the build failed on the dev box ;). For the
sake of completeness I've just tried compiling a version of the project on the
production box which almost always fails on the dev box. So far it keeps
succeeding.

On the windows box I recently flipped the LARGE_ADDRESS_AWARE bit on dmd.exe to
work around issue 6498, perhaps this has something to do with it?

As an indication of project size, the project is medium sized: vibe.d + 1937
lines, but it's very CTFE heavy: we're using vibe.d's diet template parser to
generate 21 rather large web pages. Compilation requires a little over two GB
of memory.

Is there any additional info I can provide?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru


--- Comment #25 from Maxim Fomin <maxim maxim-fomin.ru> 2013-04-02 07:13:47 PDT
---
I think somebody should provide a (snapshot of) project to compile to
investigate the problem, deadalnix's link is outdated and guessing based on
valgrind output is not a very good idea.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8596



--- Comment #26 from Rene Zwanenburg <renezwanenburg gmail.com> 2013-04-02
07:24:10 PDT ---
Yeah I was afraid of that :)

I'd have to take it up with the PHB's, not sure what the answer will be. TBH I
doubt I can make the code public. Not that there's anything of value in it, but
you know how it is...

I'll report back when I've got an answer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 02 2013