www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Weird bugs in DMD 2.81.0

reply solidstate1991 <laszloszeremi outlook.com> writes:
I'll upload code tomorrow, but here's the premise:

Sometimes elements disappear from associative arrays, causing all 
sorts of errors down the line, mostly access violations.

My engine (PixelPerfectEngine) has a style sheet for its GUI, 
which generates basic values upon construction. This works mostly 
fine with PixelPerfectEditor, however WindowMaker crashes 
instantly when it needs to redraw anything. Both Mago and VS 
debugger were bit broken (first exception came from 
KernelBase.dll, then it only showed the caller of a getter 
function possibly caused the issue), but I managed to get enough 
information. The AA containing color indexes (ushort[string]) 
couldn't be accessed properly and when I tried the safe get 
method on it, a lot of values couldn't be accessed and later on a 
dynamic array had issues with access violation.

I'm thinking on going back to 2.080.0 until this bug gets fixed.
Jul 06 2018
next sibling parent reply Seb <seb wilzba.ch> writes:
On Saturday, 7 July 2018 at 02:21:31 UTC, solidstate1991 wrote:
 I'll upload code tomorrow, but here's the premise:

 Sometimes elements disappear from associative arrays, causing 
 all sorts of errors down the line, mostly access violations.

 [...]
I'm sorry but without code there's not much we can do for you. However, one thing we can try is to get your project on the project tester once this regression is fixed.
Jul 07 2018
parent reply solidstate1991 <laszloszeremi outlook.com> writes:
On Saturday, 7 July 2018 at 07:31:29 UTC, Seb wrote:
 I'm sorry but without code there's not much we can do for you.
 However, one thing we can try is to get your project on the 
 project tester once this regression is fixed.
https://github.com/ZILtoid1991/pixelperfectengine Just did a commit recently. PixelPerfectEditor runs as it should (unfinished, but most drawing algorithms work), under WindowMaker, some stuff just disappear from AA. Patching "PixelPerfectEngine.concrete.stylesheet"'s StyleSheet.getColor to the following reveals that some elements may have disappeared from the AA: public ushort getColor(string colorName){ return color.get(colorName,0); } Also tested with an LDC, which is based on 2.80.1, and the same anomaly still happens.
Jul 07 2018
parent Seb <seb wilzba.ch> writes:
On Saturday, 7 July 2018 at 17:07:42 UTC, solidstate1991 wrote:
 On Saturday, 7 July 2018 at 07:31:29 UTC, Seb wrote:
 I'm sorry but without code there's not much we can do for you.
 However, one thing we can try is to get your project on the 
 project tester once this regression is fixed.
https://github.com/ZILtoid1991/pixelperfectengine Just did a commit recently. PixelPerfectEditor runs as it should (unfinished, but most drawing algorithms work), under WindowMaker, some stuff just disappear from AA. Patching "PixelPerfectEngine.concrete.stylesheet"'s StyleSheet.getColor to the following reveals that some elements may have disappeared from the AA: public ushort getColor(string colorName){ return color.get(colorName,0); } Also tested with an LDC, which is based on 2.80.1, and the same anomaly still happens.
Sure, I will make a PR for it later, but we can't do much more than running `dub test` or whatever testing commands you use for Travis. So if this isn't covered by your testsuite, it won't help much for this specific issue.
Jul 07 2018
prev sibling next sibling parent Basile B. <b2.temp gmx.com> writes:
On Saturday, 7 July 2018 at 02:21:31 UTC, solidstate1991 wrote:
 I'll upload code tomorrow, but here's the premise:

 Sometimes elements disappear from associative arrays, causing 
 all sorts of errors down the line, mostly access violations.
Hello, what you describe makes me think to what happens when the GC phagocytes managed members of aggregates that are not on the GC heap. By any chance are the AA values classes allocated with a custom allocator ?
Jul 07 2018
prev sibling next sibling parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 7/6/18 10:21 PM, solidstate1991 wrote:
 I'll upload code tomorrow, but here's the premise:
 
 Sometimes elements disappear from associative arrays, causing all sorts 
 of errors down the line, mostly access violations.
 
 My engine (PixelPerfectEngine) has a style sheet for its GUI, which 
 generates basic values upon construction. This works mostly fine with 
 PixelPerfectEditor, however WindowMaker crashes instantly when it needs 
 to redraw anything. Both Mago and VS debugger were bit broken (first 
 exception came from KernelBase.dll, then it only showed the caller of a 
 getter function possibly caused the issue), but I managed to get enough 
 information. The AA containing color indexes (ushort[string]) couldn't 
 be accessed properly and when I tried the safe get method on it, a lot 
 of values couldn't be accessed and later on a dynamic array had issues 
 with access violation.
 
 I'm thinking on going back to 2.080.0 until this bug gets fixed.
FYI there have been a lot of recent changes on druntime that have to do with hashing. It's possible something changed that affects you. Having code that reproduces the issue would be super-useful. If it's specifically to do with AA, it should be easily reduced -- just recreate the AA in a minimal app and show how it's missing data. -Steve
Jul 09 2018
parent Nathan S. <no.public.email example.com> writes:
On Monday, 9 July 2018 at 19:31:52 UTC, Steven Schveighoffer 
wrote:
 FYI there have been a lot of recent changes on druntime that 
 have to do with hashing. It's possible something changed that 
 affects you.
None of the recent changes ought to affect `ushort[string]` since it hashes its keys using `rt.typeinfo.ti_Ag.TypeInfo_Aa.getHash` which hasn't been touched. If https://github.com/dlang/druntime/pull/2243 is accepted the `TypeInfo.getHash` hashes of various strings would change but this shouldn't cause inability to lookup keys in a builtin AA.
Jul 09 2018
prev sibling parent reply solidstate1991 <laszloszeremi outlook.com> writes:
On Saturday, 7 July 2018 at 02:21:31 UTC, solidstate1991 wrote:
 I'll upload code tomorrow, but here's the premise:

 Sometimes elements disappear from associative arrays, causing 
 all sorts of errors down the line, mostly access violations.

 My engine (PixelPerfectEngine) has a style sheet for its GUI, 
 which generates basic values upon construction. This works 
 mostly fine with PixelPerfectEditor, however WindowMaker 
 crashes instantly when it needs to redraw anything. Both Mago 
 and VS debugger were bit broken (first exception came from 
 KernelBase.dll, then it only showed the caller of a getter 
 function possibly caused the issue), but I managed to get 
 enough information. The AA containing color indexes 
 (ushort[string]) couldn't be accessed properly and when I tried 
 the safe get method on it, a lot of values couldn't be accessed 
 and later on a dynamic array had issues with access violation.

 I'm thinking on going back to 2.080.0 until this bug gets fixed.
I found a temporary workaround. Basically I just save the content of the AA, then reapply it after the application's constructor finished, before that it always generated an exception when I tried to check its content e.g. via printing it to the screen. The program still crashes when I close it, and it seems like it's something GC related, which will be extremely hard to reproduce. I'm going to make a commit soon to Github (maybe even an alpha release), so people can check it out for themselves.
Jul 13 2018
parent reply solidstate1991 <laszloszeremi outlook.com> writes:
On Saturday, 14 July 2018 at 00:58:08 UTC, solidstate1991 wrote:
 I found a temporary workaround. Basically I just save the 
 content of the AA, then reapply it after the application's 
 constructor finished, before that it always generated an 
 exception when I tried to check its content e.g. via printing 
 it to the screen. The program still crashes when I close it, 
 and it seems like it's something GC related, which will be 
 extremely hard to reproduce. I'm going to make a commit soon to 
 Github (maybe even an alpha release), so people can check it 
 out for themselves.
The AA issue still happens when I disable the GC. What happens if I accidentally write into the memory space of an AA? Might be a pointer-overflow related issue I messed up, which will be a hell of a ride to find.
Jul 13 2018
parent reply Seb <seb wilzba.ch> writes:
On Saturday, 14 July 2018 at 01:27:03 UTC, solidstate1991 wrote:
 On Saturday, 14 July 2018 at 00:58:08 UTC, solidstate1991 wrote:
 I found a temporary workaround. Basically I just save the 
 content of the AA, then reapply it after the application's 
 constructor finished, before that it always generated an 
 exception when I tried to check its content e.g. via printing 
 it to the screen. The program still crashes when I close it, 
 and it seems like it's something GC related, which will be 
 extremely hard to reproduce. I'm going to make a commit soon 
 to Github (maybe even an alpha release), so people can check 
 it out for themselves.
The AA issue still happens when I disable the GC. What happens if I accidentally write into the memory space of an AA? Might be a pointer-overflow related issue I messed up, which will be a hell of a ride to find.
Any chance you can make a minimal, reproducible example of this? Would be great because then it can be put on bugzilla and other people can have a look at it too.
Jul 14 2018
parent reply solidstate1991 <laszloszeremi outlook.com> writes:
On Saturday, 14 July 2018 at 07:01:59 UTC, Seb wrote:
 Any chance you can make a minimal, reproducible example of this?
 Would be great because then it can be put on bugzilla and other 
 people can have a look at it too.
I might try, but first I'll look at the functions to see if I can fix some of it by myself, fixing pointer overflows. I suspect that the drawing functions overflow due to small typos, once I mixed up the x and y coordinates of something then it resulted in a corrupted image.
Jul 14 2018
parent solidstate1991 <laszloszeremi outlook.com> writes:
Well, it seems I fixed the AA issue by removing a totally 
unrelated thing (an undoable event chain system, that got 
"deprecated"), but now I got another weird issue.

Sometimes setting a dynamic array's length causes an access 
violation. Still only on WindowMaker, and nothing in 
PixelPerfectEditor.

Does somebody have a foolproof method for designing window 
layouts without an editor? I starting to give up on this piece of 
crap software, however before that it took me a whole day to 
figure out where the elements should fall, then another day to 
debug issues with the layout. My current solution at this point 
is to type in stuff instead of relying on generated code.
Jul 14 2018