Non reproducable crash with PB 5.6 and later

Just starting out? Need help? Post your questions and find answers here.
e-biker
New User
New User
Posts: 6
Joined: Wed Feb 21, 2018 11:49 am

Non reproducable crash with PB 5.6 and later

Post by e-biker »

Hi folks,

I have a problem with one of my Windows programs I developed for one of my clients.

It is running 100% stable when compiled with PB 5.46 LTS but will crash randomly after 5 - 30 min in use when compiled with all later versions. Crash means the program window freezes. Sometimes the you can still close the program by the window exit button sometimes you have to you the task manager to kill it. The behavior is the same if you run it in the IDE debugger or as standalone compiled program. OnError or debugger is not triggered at all. The crash can't be reproduced by a certain action in the program.

Can I get information from Windows what caused the crash? Windows 32 and 64 bit show the same behavior.

Since there is a lot of Canvas Gadget event handling involved can it be that the updates to the Canvas Gadget (container) might cause the crashes?

All ideas are welcome!

Erich
e-biker using Purebasic since 2009 for hobby and business
User avatar
Bisonte
Addict
Addict
Posts: 1327
Joined: Tue Oct 09, 2007 2:15 am

Re: Non reproducable crash with PB 5.6 and later

Post by Bisonte »

Without code it's hard to say... but 5.46 was the latest Version with ASCII support.
Maybe you use an extern lib that requires ASCII values... maybe you are using threads ?

Many things....
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
BarryG
Addict
Addict
Posts: 4289
Joined: Thu Apr 18, 2019 8:17 am

Re: Non reproducable crash with PB 5.6 and later

Post by BarryG »

My mistake; it's not a crash situation in the manner I was describing. Pointless tips removed.
Last edited by BarryG on Sat Sep 14, 2019 12:06 pm, edited 1 time in total.
#NULL
Addict
Addict
Posts: 1499
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Non reproducable crash with PB 5.6 and later

Post by #NULL »

The description sounds like it's not a crash at all, but rather a freezing (unresponsive). Maybe there is some event processing done wrong?
Bitblazer
Enthusiast
Enthusiast
Posts: 769
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Non reproducable crash with PB 5.6 and later

Post by Bitblazer »

First try running it with the purifier enabled and see what happens. Alternatively you can run a tracer. I think the purebasic forum had two of them as tools, but they might be years old. I personally use my own version, but its not ready for release.

If it is a message processing problem, you might just use a bunch of debug commands to find the reason, or something like a windows message debugging tool. The one on my website includes a purebasic source interface to debug message processing from the inside of your application.

If you still dont know what is the cause : make it crash while running it from WinAPIOverride. Then check the bottom log of what happened.
#NULL
Addict
Addict
Posts: 1499
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Non reproducable crash with PB 5.6 and later

Post by #NULL »

#NULL wrote:The description sounds like it's not a crash at all, but rather a freezing (unresponsive). Maybe there is some event processing done wrong?
To elaborate on this..
If you react to events by doing things that trigger other events, this could lead to endless (or at least very long) loops. For example with the following code on Linux if you resize the window with the mouse by making it smaller, this will trigger events repeatedly and the window becomes unresponsive, at least for a while.

Code: Select all


win = OpenWindow(#PB_Any, 50,100, 800, 600, "..", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
Repeat
  
  While WaitWindowEvent(10)
    Select Event()
      Case #PB_Event_CloseWindow
        quit = #True
      Case #PB_Event_SizeWindow
        Debug "size event, " + Random(999)
        ResizeWindow(win, #PB_Ignore, #PB_Ignore, 810, #PB_Ignore)
    EndSelect
  Wend
  
  Debug "events done"
  
Until quit

This could also be less obvious than in the example if a chain of multiple different events create a trigger loop.
With the following code all events are processed first and only then are new events triggered:

Code: Select all

win = OpenWindow(#PB_Any, 50,100, 800, 600, "..", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
Repeat
  
  sized = #False
  
  While WaitWindowEvent(10)
    Select Event()
      Case #PB_Event_CloseWindow
        quit = #True
      Case #PB_Event_SizeWindow
        sized = #True
        Debug "size event, " + Random(999)
    EndSelect
  Wend
  
  Debug "events done"
  
  If sized
    ResizeWindow(win, #PB_Ignore, #PB_Ignore, 810, #PB_Ignore)
  EndIf
  
Until quit
This might still trigger events forever, but all event s are processed in between so the window stays responsive. Custom events is another way it could be done but I once had problems due to their different priority.
User avatar
skywalk
Addict
Addict
Posts: 4273
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Non reproducable crash with PB 5.6 and later

Post by skywalk »

Yes, for cases like this, would a log file and healthy delay()'s,10-100ms help?
If the log file is blocking, that slows down the rat race.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
e-biker
New User
New User
Posts: 6
Joined: Wed Feb 21, 2018 11:49 am

Re: Non reproducable crash with PB 5.6 and later

Post by e-biker »

Thank you all!

Your comments are great and now I think so too, that the error is an unresponsive freezing.
I have the admit that the error occurred now once also with PB 5.46 LTS, so my assumption and the topic of this thread is not correct.
I will have to scrutinize the event handling and try to separate the different events in the loop.

You all really helped me a lot!

Erich
e-biker using Purebasic since 2009 for hobby and business
Post Reply