Page 2 of 4
Re: Random crash
Posted: Fri Dec 20, 2013 3:37 pm
by acreis
Ok,
I've hurt my fingers in two laptops win7 64 PB 5.21.
No crash yet.
I wish I could automate this testing.
Anyone could show me how?
Thanks
Re: Random crash
Posted: Fri Dec 20, 2013 4:06 pm
by Lord
acreis wrote:Ok,
I've hurt my fingers in two laptops win7 64 PB 5.21.
No crash yet.
I wish I could automate this testing.
Anyone could show me how?
Thanks
Sorry, I don't know how to do this.
I wouldn't know if that would include the problem.
(Unless it would show up)
Re: Random crash
Posted: Sat Dec 21, 2013 4:33 pm
by Lord
I did some more searching and testing.
So I found this:
http://forum.purebasic.com/english/view ... 12&t=37389
I included the Try/Catch parts im my little code snippet.
After some tries the error messagerequester appears before the system message.
Code: Select all
; 2009 (c) Hroudtwolf
; PureBasic-Lounge.com
; Windows
; PureBasic 4.x
Prototype.i pEXCEPTION_DivideByZero()
Prototype.i pEXCEPTION_IllegalInstruction()
Prototype.i pEXCEPTION_AccessViolation()
Prototype.i pEXCEPTION_OutOfBounds()
Prototype.i pEXCEPTION_Unknown()
Prototype.i pEXCEPTION_Throw(nErrorID.i)
Structure tTryCatch
EXCEPTION_DivideByZero.pEXCEPTION_DivideByZero
EXCEPTION_IllegalInstruction.pEXCEPTION_IllegalInstruction
EXCEPTION_AccessViolation.pEXCEPTION_AccessViolation
EXCEPTION_OutOfBounds.pEXCEPTION_OutOfBounds
EXCEPTION_Unknown.pEXCEPTION_Unknown
EXCEPTION_Throw.pEXCEPTION_Throw
EndStructure
Declare.i TryCatchHandler(*ptrEP.EXCEPTION_POINTERS)
Global TryCatch.tTryCatch
Macro CallException (_EXCEPTION_)
If TryCatch\EXCEPTION_#_EXCEPTION_
TryCatch\EXCEPTION_#_EXCEPTION_()
EndIf
EndMacro
Procedure TryCatchHandler(*ptrEP.EXCEPTION_POINTERS)
Protected *ptrRec.EXCEPTION_RECORD=*ptrEP\ExceptionRecord
Protected *ptrContext.CONTEXT= *ptrEP\ContextRecord
Select *ptrRec\ExceptionCode
Case #EXCEPTION_FLT_DIVIDE_BY_ZERO, #EXCEPTION_INT_DIVIDE_BY_ZERO
CallException (DivideByZero)
Case #EXCEPTION_ILLEGAL_INSTRUCTION
CallException (IllegalInstruction)
Case #EXCEPTION_ACCESS_VIOLATION
CallException (AccessViolation)
Case #EXCEPTION_ARRAY_BOUNDS_EXCEEDED
CallException (AccessViolation)
Default
CallException (Unknown)
EndSelect
*ptrContext\eip + 1
ProcedureReturn #EXCEPTION_CONTINUE_EXECUTION
EndProcedure
Macro Try
SetUnhandledExceptionFilter_(@TryCatchHandler())
EndMacro
Macro EndTry
SetUnhandledExceptionFilter_( #Null )
TryCatch\EXCEPTION_DivideByZero = #Null
TryCatch\EXCEPTION_IllegalInstruction = #Null
TryCatch\EXCEPTION_AccessViolation = #Null
TryCatch\EXCEPTION_OutOfBounds = #Null
TryCatch\EXCEPTION_Unknown = #Null
TryCatch\EXCEPTION_Throw = #Null
EndMacro
Macro Catch(_EXCEPTION_, _CATCHPROC_)
TryCatch\EXCEPTION_#_EXCEPTION_ = @_CATCHPROC_
EndMacro
EnableExplicit
;
#MainWindow = 1
#myList = 1
#OpenGedComFile = 1
;
Global Datei.s
;
Procedure GetGED()
Protected Pattern.s
Pattern.s="GedCom-Dateien (*.ged)|*.ged|Alle Dateien (*.*)|*.*"
Datei=OpenFileRequester("Datei öffnen", Datei, Pattern, 0)
If Datei=""
End
EndIf
EndProcedure
Procedure myCatchProc()
MessageRequester ("Error" , "'Access Violation' error in try-block" )
End
EndProcedure
DisableDebugger
Catch (AccessViolation, myCatchProc())
Try
OpenWindow(#MainWindow, 10, 10, 900, 556,"", #PB_Window_SystemMenu|#PB_Window_SizeGadget)
AddKeyboardShortcut(#MainWindow, #PB_Shortcut_Control|#PB_Shortcut_O, #OpenGedComFile)
ListIconGadget(#myList, 0, 0, WindowWidth(#MainWindow), WindowHeight(#MainWindow)-240, "", 0, #PB_ListIcon_GridLines|#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_FullRowSelect|#PB_ListIcon_MultiSelect)
Define quit=#False
Repeat
Define Event=WaitWindowEvent()
Define EventWindow=EventWindow()
Define EventMenu=EventMenu()
Select EventWindow
Case #MainWindow
Select Event
Case #PB_Event_Menu
Select EventMenu
Case #OpenGedComFile; [STRG][O] neue GEDCOM-Datei laden
Datei=OpenFileRequester("GedCom öffnen...", GetPathPart(Datei), "GedCom Datei (ged)|*.ged",1)
If Datei
If GetExtensionPart(Datei)="ged"
;
EndIf
EndIf
EndSelect
Case #PB_Event_CloseWindow
Quit=#True
EndSelect
EndSelect
Until Quit
End
EndTry
If I place "Try" just before "End", the Messagerequester doesn't show up,
only the system message.
I did this because the crash seemed to take place after PB had finished.
A breakpoint just before End couldn't show the system message. It
showed up after the next step over End. So I thought it should have
something to do with PB clean up after program execution.
Re: Random crash
Posted: Sat Dec 21, 2013 8:20 pm
by Lord
Until now, this is the smallest snippet which produces the
observed exception:
Code: Select all
Define Path.s=GetPathPart(ProgramFilename())
Define Pattern.s="GedCom Datei (ged)|*.ged"
Define Datei.s
Define quit=#False
OpenWindow(1, 10, 10, 900, 556,"", #PB_Window_SystemMenu|#PB_Window_SizeGadget)
AddKeyboardShortcut(1, #PB_Shortcut_Control|#PB_Shortcut_O, 1)
Repeat
Define Event=WaitWindowEvent()
Define EventMenu=EventMenu()
Select Event
Case #PB_Event_Menu
Select EventMenu
Case 1
Datei=OpenFileRequester("GedCom öffnen...",Path, Pattern, 1)
EndSelect
Case #PB_Event_CloseWindow
Quit=#True
EndSelect
Until Quit
End
I can also substitute "GetPathPart(ProgramFilename())" with a hard coded path.
Makes no difference.
Are there any known problems concerning OpenFileRequester()?
Are there any known problems concerning AddKeyboardShortcut()?
Any other recommendations besides wrecking my computer?
Re: Random crash
Posted: Sat Jan 18, 2014 11:42 am
by Lord
My update on this issue:
The crash with the snippet above still happens.
Very rarely, but happens.
I tried a new Win7 installation in a VM.
Result: same random crash
Then - after making a complete backup of my sytem -
I formatted my system drive an installed Win7 again.
Then I installed all MS updates to get an up to date
system.
In this virgin system I installed only PB 5.21 LTS(x86),
no other software.
Result: same randow crash.
At last, I could try the compiled code on a laptop from
a friend of mine.
Result: random crash.
So the question is: What do these and earlier mentioned
test scenarios in common?
Right, PureBasic.
So I still think there must be a bug in PureBasic which
causes the crash.
Re: Random crash
Posted: Sat Jan 18, 2014 12:04 pm
by PB
I didn't get any crashes with your test code. Stats in my sig.
I remember reading something once about a crash with requesters,
and it was fixed by putting CoInitialize_(0) at the start of the code,
and CoUninitialize_() at the end. Maybe wrap your test code with
those and see if you still get the crashes?
Re: Random crash
Posted: Sat Jan 18, 2014 4:34 pm
by Rings
no crash here.
if anybody except the poster can reproduce the error,
i'm willing to move this topic into bug reports.
Re: Random crash
Posted: Sun Jan 19, 2014 11:22 am
by Lord
Hi PB!
PB wrote:...
I remember reading something once about a crash with requesters,
and it was fixed by putting CoInitialize_(0) at the start of the code,
and CoUninitialize_() at the end. Maybe wrap your test code with
those and see if you still get the crashes?
Thank you for your answer.
I tried CoInitialize_(0) and CoUninitialize_() but still get the exception.
@Rings
Any better ideas to pinpoint this "bug"?
I tried different versions of PB: It seems that it started with PB 5.20 LTS
as on previous versions I couldn't reproduce the crash (I know, this is no
proof, as it is hard to provoke this error).
I tried 2 different computer, both have Intel i5, but different OS: Win7 and Win8
I tried different OS in a VM: Win7 and XP
It makes no difference wether the code is execute with or without debugger
(the debugger doesn't catch the error) nor if the code is run as executable.
Re: Random crash
Posted: Sun Jan 19, 2014 1:59 pm
by rsts
Tried a few dozen times on Win 8.1 x64 PB 5.21 LTS x64. (AMD processor)
Could not reproduce an error.
Will keep trying throughout the day on PB 32 and 64 bit.
Re: Random crash
Posted: Mon Jan 20, 2014 8:49 am
by Lord
rsts wrote:Tried a few dozen times on Win 8.1 x64 PB 5.21 LTS x64. (AMD processor)
Could not reproduce an error.
Will keep trying throughout the day on PB 32 and 64 bit.
Thank you for your effort.
I will keep you up to date on this topic here if there are any news.
Re: Random crash
Posted: Mon Jan 20, 2014 10:34 am
by dman
I have tested this, No crash.
Re: Random crash
Posted: Mon Jan 20, 2014 1:00 pm
by PB
> After exiting the program sometimes I got an appcrash C0000005 error
"AppCrash C0000005" errors are
not always the fault of the running exe.
Sometimes other factors* can cause the crash of a running exe (in your case,
"PureBasic_Compilation.exe") rather than the crashed exe itself being to blame.
So, until you can prove otherwise with reproducible steps that at least one
other person in these forums can verify, I'd say that's what's been happening.
*Source:
http://www.sevenforums.com/bsod-help-su ... 00005.html
Look how many games this guy has, that are crashing with "AppCrash C0000005"!
Do you really think they are
all buggy executables by their respective developers?
Re: Random crash
Posted: Mon Jan 20, 2014 1:31 pm
by auser
I would recommend to take a look with Process Monitor:
http://technet.microsoft.com/en-us/sysi ... s/bb896645 - You should see there about 10 further lines from your exe after it finished already (e.g. Registry stuff and so on). Create a filter to exlucde everything that is not your test.exe and search for Buffer Overflow and other bad stuff. Since it's independent from the PB-Debugger you could get a clue that way (maybe it's something related to user-rights or network-shares).
Or maybe you could try to use WinAPI command instead of built in OpenFileRequester to compare if the result differs:
Code: Select all
Define Path.s=GetPathPart(ProgramFilename())
Define Pattern.s="GedCom Datei (ged)|*.ged"
Define Datei.s
Define ofname.openfilename
Define *filter
Define *filename
Define quit=#False
OpenWindow(1, 10, 10, 900, 556,"", #PB_Window_SystemMenu|#PB_Window_SizeGadget)
AddKeyboardShortcut(1, #PB_Shortcut_Control|#PB_Shortcut_O, 1)
Repeat
Define Event=WaitWindowEvent()
Define EventMenu=EventMenu()
Select Event
Case #PB_Event_Menu
Select EventMenu
Case 1
*filter = AllocateMemory(StringByteLength(Pattern)+4)
*filename = AllocateMemory(65536)
Define x.i
For x = 0 To StringByteLength(Pattern)
If Not PeekC(@Pattern+x) = '|'
PokeC(*filter+x,PeekC(@Pattern+x))
EndIf
CompilerIf #PB_Compiler_Unicode
x + 1
CompilerEndIf
Next
ofname\lStructsize = SizeOf(ofname)
ofname\lpstrFilter = *filter
ofname\nMaxFile = 65536
ofname\lpstrFile = *filename
ofname\lpstrTitle = @"GedCom öffnen..."
If GetOpenFileName_(@ofname)
Datei = PeekS(ofname\lpstrFile,65536)
EndIf
FreeMemory(*filter)
FreeMemory(*filename)
EndSelect
Case #PB_Event_CloseWindow
Quit=#True
EndSelect
Until Quit
End
Greetings,
auser
Re: Random crash
Posted: Mon Jan 20, 2014 4:42 pm
by Lord
PB wrote:> After exiting the program sometimes I got an appcrash C0000005 error
"AppCrash C0000005" errors are
not always the fault of the running exe.
Sometimes other factors* can cause the crash of a running exe (in your case,
"PureBasic_Compilation.exe") rather than the crashed exe itself being to blame.
So, until you can prove otherwise with reproducible steps that at least one
other person in these forums can verify, I'd say that's what's been happening.
*Source:
http://www.sevenforums.com/bsod-help-su ... 00005.html
Look how many games this guy has, that are crashing with "AppCrash C0000005"!
Do you really think they are
all buggy executables by their respective developers?
I don't know, why that guy has so many different games wich chrashes.
I know, that I have one constellation where an exe produced with PureBasic
causes on my computer and at least on one Laptop a crash. If I avoid
OpenFileRequester() and avoid Purebasic-versions after PB 5.20 I don't have
these random exceptions. That is all I (can) say. All other programs I'm
running (including PB generated exe) are working fine in this respect.
Re: Random crash
Posted: Mon Jan 20, 2014 4:48 pm
by Lord
Hi auser!
auser wrote:I would recommend to take a look with Process Monitor:
http://technet.microsoft.com/en-us/sysi ... s/bb896645 - You should see there about 10 further lines from your exe after it finished already (e.g. Registry stuff and so on). Create a filter to exlucde everything that is not your test.exe and search for Buffer Overflow and other bad stuff. Since it's independent from the PB-Debugger you could get a clue that way (maybe it's something related to user-rights or network-shares).
Or maybe you could try to use WinAPI command instead of built in OpenFileRequester to compare if the result differs:
...
I tried the API variation of OpenFileRequester() and it also throws that exception.
I think I tried this in a early stage of my attempts to locate the reason an error,
but I forgot to mention that. Sorry for that.
I will try your recommendation in capturing the exception with Process Monitor and
report back.