Author Topic: Kind of a feature request (regarding random crashes)  (Read 1726 times)

Offline arthur1966

  • Single posting newcomer
  • *
  • Posts: 7
Kind of a feature request (regarding random crashes)
« on: June 09, 2017, 11:21:48 am »
Hi,

I'm using CB to develop a quite large project on linux. (Thx for CB, btw)

I've been having random crashes while using the editor, in very different intervals (sometimes no crashes for months, somtimes several a day).

Because of the crashes, I've switched from the latest stable to svn trunk - because it was an improvement.

I'm pretty sure, the crashes stem from the realtime code scanner, since they always happen during plain source editing.

Now. I know, that hunting random crashes is difficult, and that, most likely, there will always some remain.

But - having to fear random crashes while editing a huge codebase is a psychological problem for the developer. One always has to make sure, that sources are always saved - or you have to try to remember, which edits have made to which files and may have not been saved yet. It's additional stress and, quite frankly, highly annoying. I did try autosave, but that's not a solution. It's only littering the filesystem - and the last save may already be a minute old when the crash happens.

So, this is the feature proposal: add a crash handler, that dumps all open files in some directory, in their current editing state.

It doesn't matter, if it takes me a minute to sift through the dump - basically, I'd be using git to find actual changes anyway. The important thing is, that no edit is lost in a crash. Crashes would still be a hassle and cost a few minutes to clean up - but the important thing is: one could be certain, that nothing was lost, no change was forgotten.

I'm pretty sure, this can't be done as an addon, since it needs to be a signal handler, and it may also have to be hardwired into the editor.

regards,
arthur

PS: I didn't post this to the bug tracker, because "random crash" is nothing that can be tracked or "fixed", since that's the definition of "random".
PPS: I did try to narrow down the crash occurrences - either a crash report or a way to reproduce. The crash messages usually point to something UI-related, but never the same message twice. And repeating the same edit never crashed it a second time. Also, CB is the only software with random crashes on that machine, so it's unlikely hardware-related.

Online BlueHazzard

  • Lives here!
  • ****
  • Posts: 1579
Re: Kind of a feature request (regarding random crashes)
« Reply #1 on: June 09, 2017, 01:11:41 pm »
are you using wxWidgets 3.0 ? There is a known bug in the Symbol Browser that leads to random crashes. Disable the Symbol Browser in the Settings->Editor->Code Completition->Disable symbol browser and you should be fine

Offline arthur1966

  • Single posting newcomer
  • *
  • Posts: 7
Re: Kind of a feature request (regarding random crashes)
« Reply #2 on: June 09, 2017, 02:11:31 pm »
2.8.12

I've now disabled the Symbol Browser. Thx.

However, my opinion stands, that an editor should never lose any content just because of crashes. IMO a very basic requirement.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10396
Re: Kind of a feature request (regarding random crashes)
« Reply #3 on: June 09, 2017, 03:29:56 pm »
So, this is the feature proposal: add a crash handler, that dumps all open files in some directory, in their current editing state.

I'd rather try to fix the bugs, instead of going this route. What happens if the editor data structures are damaged?

PS: I didn't post this to the bug tracker, because "random crash" is nothing that can be tracked or "fixed", since that's the definition of "random".
PPS: I did try to narrow down the crash occurrences - either a crash report or a way to reproduce. The crash messages usually point to something UI-related, but never the same message twice. And repeating the same edit never crashed it a second time. Also, CB is the only software with random crashes on that machine, so it's unlikely hardware-related.

You can either start codeblocks under gdb or enable core files and then inspect them when CB crashes or uploaded them somewhere.
Make sure you have a build with debug symbols - most major distros have special packages that contain them.
Also you can run under valgrind, but it will be very slow, so I doubt you'll have the patience to wait.

p.s. The symbol browser is broken in wx3.x, in wx2.8 it seems to work.
p.p.s. The only guarantee we give is through the autosave plugin. You could modify it to save the file more often. Or even to detect crashes.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline arthur1966

  • Single posting newcomer
  • *
  • Posts: 7
Re: Kind of a feature request (regarding random crashes)
« Reply #4 on: June 09, 2017, 04:31:23 pm »
I'd rather try to fix the bugs, instead of going this route.

Does it have to be either or? Does finding current bugs prevent new bugs from being introduced?

What happens if the editor data structures are damaged?

That would probably make the data written during the crash unreadable. In those rare cases.

Not having the data - every time - is not preferable, IMO.

Losing data because of editor crashes reminds me of MS-DOS times :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10396
Re: Kind of a feature request (regarding random crashes)
« Reply #5 on: June 09, 2017, 07:00:48 pm »
Do you know an editor that does this?
I'm using autosave and I don't remember to have lost any changes to my code for all the years.
If you have then you're probably seeing more crashes than me, so the lost data is the least of your problems.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline arthur1966

  • Single posting newcomer
  • *
  • Posts: 7
Re: Kind of a feature request (regarding random crashes)
« Reply #6 on: June 09, 2017, 08:05:57 pm »
Do you know any other editor that crashes?

But I got it: a problem, that doesn't affect you, is not a problem :)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5988
    • My Best Post
Re: Kind of a feature request (regarding random crashes)
« Reply #7 on: June 09, 2017, 10:11:21 pm »
Do you know any other editor that crashes?

But I got it: a problem, that doesn't affect you, is not a problem :)

Are you or are you not using the CB autosave plugin?

Or are you just a troll?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10396
Re: Kind of a feature request (regarding random crashes)
« Reply #8 on: June 09, 2017, 10:44:06 pm »
Do you know any other editor that crashes?
Yes, I've seen visual studio 2015 to crash, now what?

But I got it: a problem, that doesn't affect you, is not a problem :)
I've not said that. I've said that the crashes you see aren't that rare, because you're loosing your recent work too often, so it becomes a problem that bothers you so much that you'll start a topic on the forum. Am I correct in my understanding of the problem? How often do you see crashes? Once a day? Once a minute? More often?

For me it doesn't make sense to spend time on the crash handler, I prefer to fix the real problems.

@stahta01: Please behave yourself and read the full posts before jumping to conclusions!
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline arthur1966

  • Single posting newcomer
  • *
  • Posts: 7
Re: Kind of a feature request (regarding random crashes)
« Reply #9 on: June 10, 2017, 12:55:19 am »
Okay, you bothered to reply three times, but not to read my post up to the third line. Your signature seems to be true :)

As I said, I get it. Crashing editors that lose a user's work are so normal that nothing needs to be done about it - and the only solution to lose as little as possible, is to have every open file written every minute.

btw, I just googled it: apparently, visual studio offers crash recovery ;)

Offline sodev

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: Kind of a feature request (regarding random crashes)
« Reply #10 on: June 10, 2017, 06:30:24 am »
It cant be helped, but i cannot press enter more than three times without pressing CTRL+S in between...

What you are looking for is already present, windows and linux can create a nice memory dump for you when a process crashes. All you have to do is enable that feature, load it into your favorite debugger and reverse engineer your documents out of it.

Sounds complicated? Yes it is. And thats why the "crash recovery" of the mighty Visual Studio does nothing more than automatically save your files in the background. This very same feature is also integrated into CodeBlocks.

So i see no problem here as well. However i prefer my own integrated AutoSave, so far i have lost almost nothing (and when i lost something it was usually because of my AutoSave keeping only one copy :) ) in all these years of using CodeBlocks.

Granted i didnt see that many crashes, i only see these using CodeBlocks compiled against wx 3.x, this combination is still absolutely not working for me :(.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10396
Re: Kind of a feature request (regarding random crashes)
« Reply #11 on: June 10, 2017, 07:58:27 am »
Okay, you bothered to reply three times, but not to read my post up to the third line. Your signature seems to be true :)

I've read your whole post, but I guess you're not reading or understanding mine.
It seems that you want one thing only and if you don't get it you won't cooperate in any other way.
I've asked you some questions. I'm out of the conversation unless you answer those.

As I said, I get it. Crashing editors that lose a user's work are so normal that nothing needs to be done about it - and the only solution to lose as little as possible, is to have every open file written every minute.
I guess you're misunderstanding me. So please re-read my posts and come back!
Auto-save plugin will save only modified files, not all open files.

btw, I just googled it: apparently, visual studio offers crash recovery ;)
Link or it doesn't exists! :)
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10396
Re: Kind of a feature request (regarding random crashes)
« Reply #12 on: June 10, 2017, 08:02:22 am »
So i see no problem here as well. However i prefer my own integrated AutoSave, so far i have lost almost nothing (and when i lost something it was usually because of my AutoSave keeping only one copy :) ) in all these years of using CodeBlocks.
Do you have your own version of the autosave plugin?

Granted i didnt see that many crashes, i only see these using CodeBlocks compiled against wx 3.x, this combination is still absolutely not working for me :(.
Please report them in another topic or on the sf.net tickets page. Make sure you're using a night build. There are tons of problems fixed in wx3 builds...
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline arthur1966

  • Single posting newcomer
  • *
  • Posts: 7
Re: Kind of a feature request (regarding random crashes)
« Reply #13 on: June 10, 2017, 01:30:09 pm »
It cant be helped, but i cannot press enter more than three times without pressing CTRL+S in between...

Finally someone who at least knows the problem, even if you don't seem to see it that way. How would you describe that behaviour? Pressing CTRL-S every few seconds? Manic? Compulsive?

Thing is, I've noticed exactly that behaviour on myself. It is sick - and completely unnecessary. Ergo: a problem.

(as a sidenote: during writing this reply, I had to step away from the keyboard, to do something else. I did not bother to save the draft somewhere outside the web-formular, because there is no chance in hell, that the browser crashes while I'm away, just because an edit window is open.)

I've read your whole post, but I guess you're not reading or understanding mine.
I've asked you some questions. I'm out of the conversation unless you answer those.

I have answered every single question of you. I've answered them before you asked them, but still...

I've said that the crashes you see aren't that rare, because you're loosing your recent work too often, so it becomes a problem that bothers you so much that you'll start a topic on the forum. Am I correct in my understanding of the problem?

FYI - I started looking for alternatives right after the first crash. And to be clear about that: the crashes are not the problem, the possible loss of work is.
And yes, I still am able to use CB and get my work done, obviously. But how is that the question? What bothers me, is that I'm becoming a nervous CTRL-S-monkey. You have no idea, how often I had to delete signature lines from the git-gui commit message window - because CTRL-S does not "save" there but "sign". But again: this was already stated in the middle of my first post.

How often do you see crashes? Once a day? Once a minute? More often?

As I described in the first post: sometimes none for months, sometimes several a day. The crashes are random. Always in the editor but not always during editing - sometimes just while moving the cursor.

It seems that you want one thing only and if you don't get it you won't cooperate in any other way.

Quite the contrary. I keep getting told, how my problem is not a problem but normal behaviour. How that declaration of bankruptcy called autosave is the only possible solution.

Well, you are right in one way: I won't stick around to help you fix random crashes that don't occur sometimes for months. That would be futile. I told you, which part of the code I'm suspecting and I gave you a feasible workaround.

Auto-save plugin will save only modified files, not all open files.

And in your eyes, this makes all the difference, because who would be so crazy and not always have every file saved after every modification, right? Who would be so crazy, when one always has to fear, that the editor crashes and loses your work.

Dude, you /really/ need to take a step back and look at the whole situation here :)

You have an immutable "that's the way it is and has always been and has to be for all eternity" stamped in your brain. That is a pity, because most probably you are not even half my age - and it's the old folks who are supposed to be stuck in their ways. Well, maybe thinking that a crash should not always lose you your work is old fashioned. Historically, it's the opposite: old crappy OS like DOS just terminated your program in case of crashes, and therefore autosave /was/ the only solution (short of "not crashing", ofc). But now, on modern unix-based desktops, your program gets told, when it does something crash-worthy, and you get a chance to do some cleanup before you accept the crash. signal() is your friend :)

I've now altered autosave to think in seconds instead of minutes, because the chances of this thread leading to something productive are zero, and that's all of a "solution" you're willing to consider.

Thanks for trying to talk me out of my problem. But you're no jedi, and i'm still quite aware of which droids I'm looking for ;)

Online BlueHazzard

  • Lives here!
  • ****
  • Posts: 1579
Re: Kind of a feature request (regarding random crashes)
« Reply #14 on: June 10, 2017, 03:59:32 pm »
1) Best thing to handle crashes is to fix the cause of the crashes. The problem with them is if a developer can't reproduce them it gets hard to fix them... As you say you get them quite random so it is hard to reproduce them. Can you give some more info, so there es even the possibility to track the crashes down.
A core dump with backtrace would be great, but this can be hard. I don't know how experienced you are, this can help https://stackoverflow.com/questions/17965/how-to-generate-a-core-dump-in-linux-when-a-process-gets-a-segmentation-fault
Can you give more information about your operating system? GTK version, operating system (debian, ubuntu....)
Can you give more information about the project? How many files? Does the code completition work without problems?
How does the crash manifest? Does codeblocks hangs or does it simply closes? Do you get any error message in the console?

2) On not loosing data without autosave: Have you a idea how this can work technically? How can we be sure that the data in the editor is not corrupt? How can we not know that the editor is not the source of crash? This is fully technical question. I never informed me about crash recovery...

3) What is your problem with autosave?

4) I am also a notorious ctrl+s type and i don't have any problem with it xD