Page 1 of 4

Random crash

Posted: Wed Dec 18, 2013 2:03 pm
by Lord
Hello!

Im my latest project I noticed a strange behaviour.
After exiting the program sometimes I got an appcrash C0000005 error.
The circumstances when this error occurs are very random.
Sometimes I could start and use the program whitout a problem,
sometime after every time I started and closed the program: crash.

This is a typical resulting system message:
[Window Title]
PureBasic_Compilation11.exe

[Main Instruction]
PureBasic_Compilation11.exe funktioniert nicht mehr

[Content]
Windows kann online nach einer Lösung für das Problem suchen.

[V] Problemdetails anzeigen [Online nach einer Lösung suchen und das Programm schließen] [Programm schließen]


Problemsignatur:
Problemereignisname: APPCRASH
Anwendungsname: PureBasic_Compilation11.exe
Anwendungsversion: 0.0.0.0
Anwendungszeitstempel: 52b18c33
Fehlermodulname: PureBasic_Compilation11.exe
Fehlermodulversion: 0.0.0.0
Fehlermodulzeitstempel: 52b18c33
Ausnahmecode: c0000005
Ausnahmeoffset: 0000a345
Betriebsystemversion: 6.1.7601.2.1.0.256.1
Gebietsschema-ID: 1031
Zusatzinformation 1: 8c89
Zusatzinformation 2: 8c89566082489d13c7b32f8a9923c3eb
Zusatzinformation 3: d465
Zusatzinformation 4: d465dd4818e5e09517e9c5df8b9460fb

Lesen Sie unsere Datenschutzbestimmungen online:
http://go.microsoft.com/fwlink/?linkid= ... cid=0x0407

Wenn die Onlinedatenschutzbestimmungen nicht verfügbar sind, lesen Sie unsere Datenschutzbestimmungen offline:
C:\Windows\system32\de-DE\erofflps.txt
I stripped the program down to a minimum where this error occurs.
I can not trap this error, because with debugger on PB has already
finished, so I cannot check variables, memory and so on. Purifier
wasn't also a help. Threadsafe on or off didn't make any difference.
The source is UTF-8 and compiled to Unicode.

I use some dummy files like these:
_Huber - Kopie.ged
_Meyer - Kopie.ged
_Müller - Kopie.ged
_Schmidt - Kopie.ged
_Schulze - Kopie.ged
Just open an empty txt-file and rename them.

To provoke the crash run the program and open the above build dummy-
files. But be warned. The error shows up very randomly, sometimes
you have to open the files 2 or 3 times and then close the program
window. Even then sometimes it happens nothing. Sometimes you have
just to open one or two files and then after closing the window the
crash occurs.
It's boring. I don't have any clue what the reason is.
I don't know wether the ListViewGadget has to be there and causes
the crash, but I couldn't provoke the error whithout it. I left
the Procedure in because in my complete program sometimes just
opening and closing the requester and then closing the window caused
the crash.
There may be also some other parts of the program witch are not
neccesary, but without I couldn't also get the crash showing up.
Maybe it has nothing to do with PureBasic, or this snippet, but
I do not have problems with other programs or my other Purebasic
programs. It's really annoying.

So, here is my (#*$&*#/&§!!) test code:

Code: Select all

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

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, "", 10, #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
Please have a look and tell me what's wrong with the code and if
the crash shows up.

Thank you for reading.

Re: Random crash

Posted: Wed Dec 18, 2013 2:14 pm
by Lord
Addition:
Ich just tried the snippet compiled to an exe and run it.
The result was (after opening the 5 dummy-files 2 times)
that I got 2 crash messages as posted above.
The second showed up after I closed the first.
After I followed the first procedure a second time, the
crash messages didn't show up.
Weird.

Re: Random crash

Posted: Wed Dec 18, 2013 8:09 pm
by acreis
I tried here, no crash. PB 5.21 x86.

Re: Random crash

Posted: Thu Dec 19, 2013 8:33 am
by Lord
acreis wrote:I tried here, no crash. PB 5.21 x86.
How often did you try?

Sometimes you I had to open the files 10x or more,
sometimes it happend just after opening one file.
I said its weird.

Re: Random crash

Posted: Thu Dec 19, 2013 3:29 pm
by JHPJHP
Hi Lord,

With the snippet of code you supplied I'm not seeing a menu to open any files... I could simply add the GetGED() Procedure to the body of the script - but it would be better to test with the same sequence of script you're using.

Re: Random crash

Posted: Thu Dec 19, 2013 3:33 pm
by Lord
This ist part of the code snipped:

Code: Select all

...
AddKeyboardShortcut(#MainWindow, #PB_Shortcut_Control|#PB_Shortcut_O, #OpenGedComFile)
...
So just use [CTRL][O]

What "script" are you referring to?

Re: Random crash

Posted: Thu Dec 19, 2013 3:48 pm
by JHPJHP
Missed that, had my blinders on - my eyes went straight to:

Code: Select all

Case #PB_Event_Menu
  Select EventMenu
------------------

PureBasic 5.21 LTS (x86)
Windows XP 32-bit
(unicode executable selected)

With Debugger:
Tried over 10 times, opening each file 3 - 4 times first before closing the app, but no crash?

Without Debugger:
Tried over 10 times, opening each file 3 - 4 times first before closing the app, but no crash?

Compiled:
Tried over 10 times, opening each file 3 - 4 times first before closing the app, but no crash?

------------------

This may not help, but: http://www.windowsbbs.com/legacy-window ... ation.html

The article seems to indicate that it could be related to a third party tool - an old version of a dependant DLL...

Have you tried it on other computers? If you don't have an answer by this evening - I'll test it again on my Windows 7 64-bit system - when I'm home.

Re: Random crash

Posted: Thu Dec 19, 2013 4:34 pm
by netmaestro
I can't make it crash. I tried until I got tired fingers and then I automated it and let it open and select a file 100 times in a row, when it was finished I pushed the close button and it closed without issue. Win8.1 pb5.21 x86 unicode

Re: Random crash

Posted: Thu Dec 19, 2013 5:48 pm
by Lord
@ JHPJHP
Thanks for your reply.

I run my program on PureBasic 5.21 LTS (x86)
Windows 7 64-bit (unicode executable selected)

I don't have another machine to test, I don't think a VM would help.

As this is the only constellation, where this exception occurs, I don't
think that this is machine depending thing. I tried some older programs
of mine, where I also use CTRL C to open a file in a window with a
ListIconGadget. There was and is no problem.

@ netmaestro
Also thanks for responding.

I also did a looped opening and closing of test files. There was no error.
It looks to me that there is something concerning OpenFileRequester().
As I see, both of you are using a x86-machine. My is a x64. Maybe that's
the reason you got tired fingers now?


Another thing that let's me think it has to do with PB:
I tried the whole afternoon the code snippet with older PB versions, which
I still have on my machine:
PB 4.51 x86, PB 4.51 x64, PB 4.61 x86 and PB 4.61 x64
I couldn't get it to crash there. But after starting it on PB 5.21 x86 and
trying about 10 times each 5 times opening the 5 dummy files and closing
the window, the exception fired up.
I know that this is no proof for anything, as it is a random event, but
makes me think, that this has to do with PB.

Re: Random crash

Posted: Fri Dec 20, 2013 12:00 am
by JHPJHP
PureBasic 5.21 LTS (x86)
Windows 7 64-bit (unicode executable selected)

I've been running the process for near 15 minutes without a crash.
- opened each file a min. of two times before closing

If you can suggest anything else, possibly a setting change - I'll give it a try.

Re: Random crash

Posted: Fri Dec 20, 2013 12:58 am
by netmaestro
Bad memory maybe.

Re: Random crash

Posted: Fri Dec 20, 2013 7:42 am
by Danilo
Lord wrote:It looks to me that there is something concerning OpenFileRequester().
Do you have file system plugins or Antivirus stuff installed?
If so, check again with disabled plugins and disabled Antivirus.

I remember an old issue where a system plugin changed the language settings of the process,
so after OpenFileRequester() the command ValF() or StrF() didn't work anymore correctly,
because it wanted now ',' (comma) instead '.' (point) when parsing float numbers.
So, it is possible that plugins or Antivirus change the behavior of commands like OpenFileRequester.
If this 3rd party codes have bugs, it can result in weird behavior and crashes within your program.

You could also replace OpenFileRequester() with some API code that does the same, just for testing.

Re: Random crash

Posted: Fri Dec 20, 2013 8:42 am
by Lord
JHPJHP wrote:PureBasic 5.21 LTS (x86)
Windows 7 64-bit (unicode executable selected)

I've been running the process for near 15 minutes without a crash.
- opened each file a min. of two times before closing

If you can suggest anything else, possibly a setting change - I'll give it a try.
Sorry, I can't give you a "cookbook" on hand how to provoke the crash.
It's really very random.
My "standardprocedure" to get "success" is:

Code: Select all

start program (with or without debugger, or compiled  as exe makes no difference)
Repeat
 For Random(1 to x)
  Random Choice(open dummy file 1)
  Random Choice(open dummy file 2)
  Random Choice(open dummy file 3)
  Random Choice(open dummy file 4)
  Random Choice(open dummy file 5)
 Next
 Close Window
Until Crash
netmaestro wrote:Bad memory maybe.
I did a mem test over night. Everything shows "OK".

Danilo wrote:
Lord wrote:It looks to me that there is something concerning OpenFileRequester().
Do you have file system plugins or Antivirus stuff installed?
If so, check again with disabled plugins and disabled Antivirus.

I remember an old issue where a system plugin changed the language settings of the process,
so after OpenFileRequester() the command ValF() or StrF() didn't work anymore correctly,
because it wanted now ',' (comma) instead '.' (point) when parsing float numbers.
So, it is possible that plugins or Antivirus change the behavior of commands like OpenFileRequester.
If this 3rd party codes have bugs, it can result in weird behavior and crashes within your program.

You could also replace OpenFileRequester() with some API code that does the same, just for testing.
No file system plugins and no Antivirus (ok, Windows Defender is aktiv).
My system is running it its state since december 2011 without any problem.
I set up my system in december 2011 with all programs I need.
No fancy programs or extensions. Just regular system updates allowed.
PureBasic is always installed in a new folder and used with switch /Portable.
And only this code snippet (and the underlaying program , from which
the snippet is a strip down) produces this crash.

I'm still convinced that this has something to do with PB 5.21 LTS(x86).
But as long as nobody else can confirm, I can not make a bug report.

Re: Random crash

Posted: Fri Dec 20, 2013 1:17 pm
by JHPJHP
Sorry, I can't give you a "cookbook" on hand how to provoke the crash.
Yea, I was just grabbing at straws :), it's just that our systems are identical (OS and PB version)...

A couple things you might want to try
- from a Command Prompt - Run: sfc /scannow
- fresh install of PureBasic (completely removing the previous version)

Re: Random crash

Posted: Fri Dec 20, 2013 3:24 pm
by Lord
JHPJHP wrote:...
A couple things you might want to try
- from a Command Prompt - Run: sfc /scannow
- fresh install of PureBasic (completely removing the previous version)
sfc yieled:
Der Windows-Ressourcenschutz hat keine Integritätsverletzungen gefunden.
That means sfc didn't find a problem.

I also did a fresh install of PB .
It took a while to get the ecxeption again, but the problem is still there.

That's really annoying.