www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - weird exception on windows

reply Szabo Bogdan <szabobogdan3 gmail.com> writes:
Hi,

I noticed that sometimes on windows this line of code crashes the 
test suites.

https://github.com/gedaiu/fluent-asserts/blob/master/core/fluentasserts/core/results.d#L1072

This exception can be captured only with a debugger... is it a 
dmd bug?

```
Thread 25CC created, Entry: mswsock.00007FF9011604C0
EXCEPTION_DEBUG_INFO:
            dwFirstChance: 1
            ExceptionCode: C0000005 (EXCEPTION_ACCESS_VIOLATION)
           ExceptionFlags: 00000000
         ExceptionAddress: 00007FF9055E302C ntdll.00007FF9055E302C
         NumberParameters: 2
ExceptionInformation[00]: 0000000000000000 Read
ExceptionInformation[01]: FFFFFFFFFFFFFFFF Inaccessible Address
First chance exception on 00007FF9055E302C (C0000005, 
EXCEPTION_ACCESS_VIOLATION)!
```

I think this is related with this issue:
https://github.com/gedaiu/fluent-asserts/issues/63

Can anyone help me with this? I don't even know how to start 
fixing this issue...

Thanks,
Bogdan
Dec 14 2017
parent reply Kagamin <spam here.lot> writes:
writeln(fileName);
if (!fileName.exists)
{
   return;
}

:)
Dec 14 2017
parent reply Szabo Bogdan <szabobogdan3 gmail.com> writes:
On Thursday, 14 December 2017 at 14:47:25 UTC, Kagamin wrote:
 writeln(fileName);
 if (!fileName.exists)
 {
   return;
 }

 :)
I'm not sure I understand this solution...
Dec 14 2017
parent reply Kagamin <spam here.lot> writes:
Try printf debugging in case argument is invalid.
Dec 15 2017
parent reply Szabo Bogdan <szabobogdan3 gmail.com> writes:
On Friday, 15 December 2017 at 09:24:07 UTC, Kagamin wrote:
 Try printf debugging in case argument is invalid.
ah .. ok ... I tried to debug the issue and it looks like the filename is valid and there is no null value. I am thinking that the value is destroyed before it reach the `GetFileAttributesW` or during that call... but I don't see how that is possible.
Dec 15 2017
next sibling parent Kagamin <spam here.lot> writes:
You can also try to call `exists` somewhere before this part of 
code.
Dec 15 2017
prev sibling next sibling parent reply Kagamin <spam here.lot> writes:
You said tests fail?

class SourceResult
{
	private const
	{
		string file;
		size_t line;
	}
	this(string fileName = __FILE__, size_t line = __LINE__, size_t 
range = 6) nothrow
	{
		this.file = fileName;
		this.line = line;
		if (!fileName.exists)
		{
			return;
		}
	}
}

unittest
{
	auto result = new SourceResult("test/values.d", 26);
	auto msg = result.file;
}

Does this fail too?
Dec 15 2017
parent Szabo Bogdan <szabobogdan3 gmail.com> writes:
On Friday, 15 December 2017 at 13:56:41 UTC, Kagamin wrote:
 You said tests fail?

 class SourceResult
 {
 	private const
 	{
 		string file;
 		size_t line;
 	}
 	this(string fileName = __FILE__, size_t line = __LINE__, 
 size_t range = 6) nothrow
 	{
 		this.file = fileName;
 		this.line = line;
 		if (!fileName.exists)
 		{
 			return;
 		}
 	}
 }

 unittest
 {
 	auto result = new SourceResult("test/values.d", 26);
 	auto msg = result.file;
 }

 Does this fail too?
I can not reproduce the crash with this example...
Dec 16 2017
prev sibling next sibling parent Kagamin <spam here.lot> writes:
That said, tempCString code is suspicious:
https://github.com/dlang/phobos/blob/master/std/internal/cstring.d#L221
If unittest-versioned exists calls release-versioned tempCString, 
it will corrupt the stack. Try to replace 16 with 256 there and 
recompile your code.
Dec 15 2017
prev sibling parent reply Kagamin <spam here.lot> writes:
Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Dec 15 2017
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
Dec 15 2017
next sibling parent reply Szabo Bogdan <szabobogdan3 gmail.com> writes:
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer 
wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
I have installed DMD 2.77.1 and I can not find the patched file in the phobos folder... should I try this by building the compiler? It seams that I can not build phobos without compiling dmd.. or maybe I don't know how...
Dec 16 2017
parent reply bauss <jj_1337 live.dk> writes:
On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote:
 On Friday, 15 December 2017 at 21:56:48 UTC, Steven 
 Schveighoffer wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
I have installed DMD 2.77.1 and I can not find the patched file in the phobos folder... should I try this by building the compiler? It seams that I can not build phobos without compiling dmd.. or maybe I don't know how...
Just go and do the changes manually in your local phobos folder, wherever you have DMD installed, since you can't build phobos or dmd.
Dec 16 2017
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 12/16/17 5:12 AM, bauss wrote:
 On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote:
 On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
I have installed DMD 2.77.1 and I can not find the patched file in the phobos folder... should I try this by building the compiler? It seams that I can not build phobos without compiling dmd.. or maybe I don't know how...
Just go and do the changes manually in your local phobos folder, wherever you have DMD installed, since you can't build phobos or dmd.
Yes, this won't get into the release for a while. So please do this manually (just copy the file changed by the pull over the existing one). It's something that doesn't need to be compiled into the phobos library, as it's a misrepresentation of the actual object when you compile with unittests, so there is no reason to recompile phobos. -Steve
Dec 16 2017
parent reply Szabo Bogdan <szabobogdan3 gmail.com> writes:
On Saturday, 16 December 2017 at 12:01:49 UTC, Steven 
Schveighoffer wrote:
 On 12/16/17 5:12 AM, bauss wrote:
 On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan 
 wrote:
 On Friday, 15 December 2017 at 21:56:48 UTC, Steven 
 Schveighoffer wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
I have installed DMD 2.77.1 and I can not find the patched file in the phobos folder... should I try this by building the compiler? It seams that I can not build phobos without compiling dmd.. or maybe I don't know how...
Just go and do the changes manually in your local phobos folder, wherever you have DMD installed, since you can't build phobos or dmd.
Yes, this won't get into the release for a while. So please do this manually (just copy the file changed by the pull over the existing one). It's something that doesn't need to be compiled into the phobos library, as it's a misrepresentation of the actual object when you compile with unittests, so there is no reason to recompile phobos. -Steve
I'm actually a linux and a mac user... this issue happens on a windows ci machine at work. I tried to update the file and compile phobos with that change, and I don't know how to make it work... ` C:\D\dmd2\src\phobos>make -f win64.mak cd etc\c\zlib make -f win64.mak MODEL=64 zlib64.lib "CC=\"\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cl""\"" "LIB=\"\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\lib""\"" "VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC" "\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cl" /c /O2 /nologo /I"\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE" /Zl adler32.c Error: '\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cl' not found ` I don't know where I can find a 64bit toolchain for vs2010... I was expecting that dmd uses a newer compiler on windows... I guess that the best approach for me is to wait the next beta release of dmd and try it then... Thanks for the support!
Dec 18 2017
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 12/18/17 7:20 AM, Szabo Bogdan wrote:
 On Saturday, 16 December 2017 at 12:01:49 UTC, Steven Schveighoffer wrote:
 On 12/16/17 5:12 AM, bauss wrote:
 On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote:
 On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer 
 wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
I have installed DMD 2.77.1 and I can not find the patched file in the phobos folder... should I try this by building the compiler? It seams that I can not build phobos without compiling dmd.. or maybe I don't know how...
Just go and do the changes manually in your local phobos folder, wherever you have DMD installed, since you can't build phobos or dmd.
Yes, this won't get into the release for a while. So please do this manually (just copy the file changed by the pull over the existing one). It's something that doesn't need to be compiled into the phobos library, as it's a misrepresentation of the actual object when you compile with unittests, so there is no reason to recompile phobos.
I'm actually a linux and a mac user...
Me too :)
 this issue happens on a windows 
 ci machine at work. I tried to update the file and compile phobos with 
 that change, and I don't know how to make it work...
Hm... you shouldn't need to recompile phobos, it should be identical when not in unittest mode. Just replace the one file and see if the CI starts working.
 I don't know where I can find a 64bit toolchain for vs2010... I was 
 expecting that dmd uses a newer compiler on windows...
I hope someone can help you there, but I would expect most folks here to either not be Windows developers, or to be using the interactive version (not CI version). There may be someone with some experience than can help.
 I guess that the best approach for me is to wait the next beta release 
 of dmd and try it then...
That is also an option. However, the PR hasn't been pulled yet... -Steve
Dec 18 2017
prev sibling next sibling parent reply Kagamin <spam here.lot> writes:
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer 
wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
Regression in 2.072?
Dec 16 2017
parent reply Vino <vino.bheeman hotmail.com> writes:
On Saturday, 16 December 2017 at 12:39:53 UTC, Kagamin wrote:
 On Friday, 15 December 2017 at 21:56:48 UTC, Steven 
 Schveighoffer wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
Regression in 2.072?
H, All, Are are also getting the same exception on Windows after updating the dmd to version v2.077.1, our code was working fine for the past 2 months, the exception is just crashes the program, and it occur's every 1 time among in 3 runs. As per Microsoft it stated to download the package apps.diagcab and execute, but still no luck. ExceptionCode: C0000005 From, Vino.B
Dec 16 2017
parent reply Vino <vino.bheeman hotmail.com> writes:
On Saturday, 16 December 2017 at 13:59:11 UTC, Vino wrote:
 On Saturday, 16 December 2017 at 12:39:53 UTC, Kagamin wrote:
 On Friday, 15 December 2017 at 21:56:48 UTC, Steven 
 Schveighoffer wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
Regression in 2.072?
H, All, Are are also getting the same exception on Windows after updating the dmd to version v2.077.1, our code was working fine for the past 2 months, the exception is just crashes the program, and it occur's every 1 time among in 3 runs. As per Microsoft it stated to download the package apps.diagcab and execute, but still no luck. ExceptionCode: C0000005 From, Vino.B
Moreover we were able to find the line of code which was causing this exception string a = "1" a.to!int.isNumber /* exception is occurring at this point. From, Vino.B
Dec 16 2017
parent Mengu <mengukagan gmail.com> writes:
On Saturday, 16 December 2017 at 14:05:28 UTC, Vino wrote:
 On Saturday, 16 December 2017 at 13:59:11 UTC, Vino wrote:
 On Saturday, 16 December 2017 at 12:39:53 UTC, Kagamin wrote:
 [...]
H, All, Are are also getting the same exception on Windows after updating the dmd to version v2.077.1, our code was working fine for the past 2 months, the exception is just crashes the program, and it occur's every 1 time among in 3 runs. As per Microsoft it stated to download the package apps.diagcab and execute, but still no luck. ExceptionCode: C0000005 From, Vino.B
Moreover we were able to find the line of code which was causing this exception string a = "1" a.to!int.isNumber /* exception is occurring at this point. From, Vino.B
the compiler might be parsing the expr like (a.to!(int.isNumber)) so it becomes a.to!bool.
Dec 18 2017
prev sibling parent reply unleashy <lakeavenger gmail.com> writes:
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer 
wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
I created the original issue in Szabo's post. I applied your fix, but nothing changed—the test program still crashes with the same exception :/ What gives?
Dec 18 2017
parent Szabo Bogdan <szabobogdan3 gmail.com> writes:
On Monday, 18 December 2017 at 22:49:30 UTC, unleashy wrote:
 On Friday, 15 December 2017 at 21:56:48 UTC, Steven 
 Schveighoffer wrote:
 On 12/15/17 10:08 AM, Kagamin wrote:
 Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve
I created the original issue in Szabo's post. I applied your fix, but nothing changed—the test program still crashes with the same exception :/ What gives?
It looks like this fix does not work: https://github.com/dlang/phobos/pull/5932 Does anyone know how to debug this crash?
Jan 05 2018