Unhandled exception when running console app
leppie
Posts: 15
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
The application, uses the DLR from MS that provides an interactive console. This uses quite alot of console features, as well as threading. Unfortunately, I cannot get more info on the exception. You can however download the code from the 'source code' section on http://www.codeplex.com/IronScheme. The application behaves correctly under the CLR Profiler, and runs otherwise correctly under all other condtions.
Here is some more info:
Unhandled exception at 0x00690066 in IronScheme.Console.exe: 0xC0000005: Access violation.
callstack:
> 00690066
10005c98
[Frames below may be incorrect and/or missing, no symbols loaded for RedGate.Profiler.Core2.dll]
10005c98
10018134
registers:
EAX = 00690066 EBX = 00000000 ECX = 00000006 EDX = 048C3DDC ESI = 048C3E78 EDI = 048C3DDC EIP = 00690066 ESP = 0145DEA0 EBP = 0145DEF4 EFL = 00010206
CS = 001B DS = 0023 ES = 0023 SS = 0023 FS = 003B GS = 0000
ST0 = +0.0000000000000000e+0000 ST1 = +0.0000000000000000e+0000 ST2 = +0.0000000000000000e+0000 ST3 = +0.0000000000000000e+0000 ST4 = +0.0000000000000000e+0000 ST5 = +1.7000000000000000e+0001
ST6 = +2.5000000000000000e-0001 ST7 = +4.0902119140625000e+0003 CTRL = 027F STAT = 0120 TAGS = FFFF EIP = 79E78DEE EDO = 00000000
MM0 = 0000000000000000 MM1 = 0000000000000000 MM2 = 0000000000000000 MM3 = 0000000000000000 MM4 = 0000000000000000 MM5 = 8800000000000000 MM6 = 8000000000000000 MM7 = FFA3640000000000
XMM0 = 00000108000000000145D52C0163DAE8 XMM1 = 00000000015F000079E78BB20145D540 XMM2 = 000000010145D5DCB3DAE5E779E78BD1 XMM3 = 0046000079E743900145D54800000000 XMM4 = 79E78BD1FFFFFFFF7A33F3F40145D57C
XMM5 = 000000FC00000000015F000079E78B6A XMM6 = 79E790CA0982766879E790AD0145D588 XMM7 = 00000000000000010145D5DCB3DAE52F XMM00 = +4.18504E-038 XMM01 = +3.63361E-038 XMM02 = +0.00000E+000 XMM03 = +3.7E-043#DEN
XMM10 = +3.63362E-038 XMM11 = +1.50282E+035 XMM12 = +4.09586E-038 XMM13 = +0.00000E+000 XMM20 = +1.50282E+035 XMM21 = -1.01932E-007 XMM22 = +3.63366E-038 XMM23 = +1.4E-045#DEN
XMM30 = +0.00000E+000 XMM31 = +3.63362E-038 XMM32 = +1.50099E+035 XMM33 = +6.4E-039#DEN XMM40 = +3.63364E-038 XMM41 = +2.33592E+035 XMM42 = -1.#QNANE+000 XMM43 = +1.50282E+035
XMM50 = +1.50281E+035 XMM51 = +4.09586E-038 XMM52 = +0.00000E+000 XMM53 = +3.5E-043#DEN XMM60 = +3.63364E-038 XMM61 = +1.50294E+035 XMM62 = +3.14077E-033 XMM63 = +1.50295E+035
XMM70 = -1.01931E-007 XMM71 = +3.63366E-038 XMM72 = +1.4E-045#DEN XMM73 = +0.00000E+000 MXCSR = 00001FA0
XMM0DL = +1.59184899545106E-302 XMM0DH = +5.6020688881E-312#DEN XMM1DL = +1.66954190986592E+279 XMM1DH = +1.1365059244E-316#DEN XMM2DL = -6.69548235352161E-059
XMM2DH = +2.1325460431E-314#DEN XMM3DL = +1.59188014044409E-302 XMM3DH = +2.44758205272807E-307 XMM4DL = +4.52733796445525E+280 XMM4DH = +1.66957652679707E+279
XMM5DL = +4.52049671168142E-302 XMM5DH = +5.3474293932E-312#DEN XMM6DL = +1.67092139254564E+279 XMM6DH = +1.67095280382621E+279 XMM7DL = +1.59204557753226E-302
XMM7DH = +4.9406564584E-324#DEN
OV = 0 UP = 0 EI = 1 PL = 0 ZR = 0 AC = 0 PE = 1 CY = 0
00690066 = 00
The application, uses the DLR from MS that provides an interactive console. This uses quite alot of console features, as well as threading. Unfortunately, I cannot get more info on the exception. You can however download the code from the 'source code' section on http://www.codeplex.com/IronScheme. The application behaves correctly under the CLR Profiler, and runs otherwise correctly under all other condtions.
Here is some more info:
Unhandled exception at 0x00690066 in IronScheme.Console.exe: 0xC0000005: Access violation.
callstack:
> 00690066
10005c98
[Frames below may be incorrect and/or missing, no symbols loaded for RedGate.Profiler.Core2.dll]
10005c98
10018134
registers:
EAX = 00690066 EBX = 00000000 ECX = 00000006 EDX = 048C3DDC ESI = 048C3E78 EDI = 048C3DDC EIP = 00690066 ESP = 0145DEA0 EBP = 0145DEF4 EFL = 00010206
CS = 001B DS = 0023 ES = 0023 SS = 0023 FS = 003B GS = 0000
ST0 = +0.0000000000000000e+0000 ST1 = +0.0000000000000000e+0000 ST2 = +0.0000000000000000e+0000 ST3 = +0.0000000000000000e+0000 ST4 = +0.0000000000000000e+0000 ST5 = +1.7000000000000000e+0001
ST6 = +2.5000000000000000e-0001 ST7 = +4.0902119140625000e+0003 CTRL = 027F STAT = 0120 TAGS = FFFF EIP = 79E78DEE EDO = 00000000
MM0 = 0000000000000000 MM1 = 0000000000000000 MM2 = 0000000000000000 MM3 = 0000000000000000 MM4 = 0000000000000000 MM5 = 8800000000000000 MM6 = 8000000000000000 MM7 = FFA3640000000000
XMM0 = 00000108000000000145D52C0163DAE8 XMM1 = 00000000015F000079E78BB20145D540 XMM2 = 000000010145D5DCB3DAE5E779E78BD1 XMM3 = 0046000079E743900145D54800000000 XMM4 = 79E78BD1FFFFFFFF7A33F3F40145D57C
XMM5 = 000000FC00000000015F000079E78B6A XMM6 = 79E790CA0982766879E790AD0145D588 XMM7 = 00000000000000010145D5DCB3DAE52F XMM00 = +4.18504E-038 XMM01 = +3.63361E-038 XMM02 = +0.00000E+000 XMM03 = +3.7E-043#DEN
XMM10 = +3.63362E-038 XMM11 = +1.50282E+035 XMM12 = +4.09586E-038 XMM13 = +0.00000E+000 XMM20 = +1.50282E+035 XMM21 = -1.01932E-007 XMM22 = +3.63366E-038 XMM23 = +1.4E-045#DEN
XMM30 = +0.00000E+000 XMM31 = +3.63362E-038 XMM32 = +1.50099E+035 XMM33 = +6.4E-039#DEN XMM40 = +3.63364E-038 XMM41 = +2.33592E+035 XMM42 = -1.#QNANE+000 XMM43 = +1.50282E+035
XMM50 = +1.50281E+035 XMM51 = +4.09586E-038 XMM52 = +0.00000E+000 XMM53 = +3.5E-043#DEN XMM60 = +3.63364E-038 XMM61 = +1.50294E+035 XMM62 = +3.14077E-033 XMM63 = +1.50295E+035
XMM70 = -1.01931E-007 XMM71 = +3.63366E-038 XMM72 = +1.4E-045#DEN XMM73 = +0.00000E+000 MXCSR = 00001FA0
XMM0DL = +1.59184899545106E-302 XMM0DH = +5.6020688881E-312#DEN XMM1DL = +1.66954190986592E+279 XMM1DH = +1.1365059244E-316#DEN XMM2DL = -6.69548235352161E-059
XMM2DH = +2.1325460431E-314#DEN XMM3DL = +1.59188014044409E-302 XMM3DH = +2.44758205272807E-307 XMM4DL = +4.52733796445525E+280 XMM4DH = +1.66957652679707E+279
XMM5DL = +4.52049671168142E-302 XMM5DH = +5.3474293932E-312#DEN XMM6DL = +1.67092139254564E+279 XMM6DH = +1.67095280382621E+279 XMM7DL = +1.59204557753226E-302
XMM7DH = +4.9406564584E-324#DEN
OV = 0 UP = 0 EI = 1 PL = 0 ZR = 0 AC = 0 PE = 1 CY = 0
00690066 = 00
Comments
I'd love to debug Profiler against this, but I can't get it to compile. One of the pre-build actions fails trying to run a program called gppg.exe. It returns 9009. Unfortunately there is nothing to tell me what 9009 means and what I should do about it. Any suggestions?
// DNS server not authoritative for zone.
//
#define DNS_ERROR_RCODE_NOTAUTH 9009L
Can you maybe check the prebuild event for invalid file paths in the IronScheme project?
The only other error I have seen with gppg.exe itself was when the output-file (which you should not have) was set as read-only.
If no joy, send me a direct email, so I can forward you the 2 generated files.
Thanks
I got it figured out
As I was preparing to package it up, I just did a test run without ANTS. All good. Then I tried ANTS, it didnt crash! Then I saw what was causing it. Obviously the DLR creates assemblies with Reflection.Emit, and the ANTS run was the 2nd pass and didnt crash because the assemblies were already compiled.
Funny enough, it exactly that compilation bit I want timing for :shock:
I will send you a build that does not save assemblies, hence they should crash ANTS everytime.
Indeed and thanks for sending the compiled project. I did debug ANTS Profiler and found that it does stop at some obscure bit of assembly code (not my forte) so I was going to continue trying to find the exact cause tomorrow. But one of the possible reasons that came from the developer right off the bat is the possibility that your program emits IL. This process can conflict with the code profiler while it's instrumenting the IL.
Hopefully, with this information we can see if there is a workaround for this case. I'll let you know tomorrow. Thanks again!
I'm not sure, but I think Windbg is telling me that there is a missing attribute on the module that you're emitting in your code. I have done a reproduction of this by modifying http://msdn2.microsoft.com/en-us/library/ms228971(VS.80).aspx, changing the following: This code will run outside of Profiler but crashes much the same way as your projects when being profiled, I suspect because ANTS Profiler is assuming some information exists about the emitted module that isn't strictly mandatory.
Do you think you can locate a bit of the IronScheme code that performs a similar function to the one above?
I did a search thru the source and I cannot find a place where generic could be used. I dont use it. And it doesnt appear in any stub code in the generated assemblies either.
I did however notice when calling a DynamicMethod created at runtime seems to have a different signature the 'saved' version. It seems to prepend a parameter of type object[]. I also find some confusion about the assembly binding in this scenario. Maybe this has something to do with it. I am at a loss. :?
I did eventually get the project to compile by removing the pre-build actions. I think they need to run once to generate the .y.cs file and then subsequent runs generate an error.
...anyway...
I'm looking into the issue possibly being Microsoft.Scripting. The Visual Studio IDE messages indicate that the last thing to happen was that init.scm file had been run. Commenting out some of the lines of this file prevent ANTS Profiler from crashing, although they also prevent the console from initializing successfully.
What I'm thinking is that Microsoft.Scripting does some emmitting of IL that doesn't agree with Profiler's core components.
Open the IronScheme project, then Runtime->Control.cs. Go to line 126 and change to read There may be knock-on effects from this change, but I'm not qualified to say what they would be. At any rate this code change allows you to get the IronScheme.Console working with ANTS Profiler.
I did however did do something the other day that caused that line again, and funnily enough VS.NET started doing weird UI stuff. I will try recreate the code and see why that happens.
Unfortunately the trial has expired now, I dunno if you can extend it somehow
James
Head of DBA Tools
Red Gate Software Ltd
I've already taken the liberty of sending leppie an extension code via private message. :-)
It seems to run now, but for some reason I am hitting a null ref exception.
That code the Brian pointed has some extra nastiness that could cause it to fail worse than it should. That said, the code should never fail there either, but for some reason it is.
I will investigate some more.