Author Topic: An unhandled exception ...  (Read 1070 times)

Offline LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
An unhandled exception ...
« on: July 01, 2020, 07:59:35 pm »
I wanted to edit some old translation files :
Quote
'All_codeblocks.po'  ( # 1.5MB)
'All_codeblocks.pot' ( # 1 MB)
with cb-12180, wx3.1.3, gcc-8.1.0, win32 (Vista Business)

When saving :
1- the cursor indicates a wait
2- memory usage increases linearly up to
3- Appearance of a window indicating an exception not maintained
4- after acknowledgement on any CB answer disappears
5- no RPT report

Active plugins:
Quote
- AutoSave
- Compiler
- Environment variables
- File extension handler

Quote
No problem with cb12180, wx3.0.3, gcc-7.5.0 OpenSuse-Leap-15.1

I'll test under Win7 tomorrow.

Can you check if you have the same problem ??

Attachments
- All_codeblocks.po
- cbBigFile.png
in
CBBigFile.7z
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #1 on: July 01, 2020, 08:20:21 pm »
What are the exact steps to reproduce the problem?
(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 stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Re: An unhandled exception ...
« Reply #2 on: July 01, 2020, 08:37:22 pm »
Did you answer Abort, Retry, or ignore to the message box?

Edit: I will try Abort; building C::B on Windows 7 64 bit with wxWidgets 3.0.x 64 bit.
Edit2: Saw no problem with C::B on Windows 7 64 bit with wxWidgets 3.0.x 64 bit
Now trying wxWidgets 3.1.x 64 bit; but, without the steps likely will fail to see error.
Edit4: Did not see problem with wxWidgets 3.1.3.

Edit3: Using MSys2 GCC self compiled 10.1.1 20200621

Tim S.
« Last Edit: July 02, 2020, 01:16:57 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Re: An unhandled exception ...
« Reply #3 on: July 02, 2020, 02:26:53 am »
I just did a code search for the message and found one in "wxApp::OnExceptionInMainLoop" that is in file "src/msw/app.cpp".

Code: [Select]
bool wxApp::OnExceptionInMainLoop()
{
    // ask the user about what to do: use the Win32 API function here as it
    // could be dangerous to use any wxWidgets code in this state
    switch (
            ::MessageBox
              (
                NULL,
                wxT("An unhandled exception occurred. Press \"Abort\" to \
terminate the program,\r\n\
\"Retry\" to exit the program normally and \"Ignore\" to try to continue."),
                wxT("Unhandled exception"),
                MB_ABORTRETRYIGNORE |
                MB_ICONERROR|
                MB_TASKMODAL
              )
           )
    {
        case IDABORT:
            throw;

        default:
            wxFAIL_MSG( wxT("unexpected MessageBox() return code") );
            wxFALLTHROUGH;

        case IDRETRY:
            return false;

        case IDIGNORE:
            return true;
    }
}

Tim S.
« Last Edit: July 02, 2020, 02:34:22 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #4 on: July 02, 2020, 07:35:23 pm »
@stahta01
Thank you for searching for the 'wx' function responsible for the message.
I can't find the call of this function...

@obfuscated
Steps to reproduce the problem with cb-12180,  gcc-8.1.0-dwarf, wx3.1.3,, win32 (Vista Business) :
1- active project: any
2- load 'All_codeblocks.po'
3- add spaces anywhere
4- save the file ... from that moment on,
- the cursor indicates a standby state for #40 S, then an exception message appears (see attached file)
Quote
1- action : 'Abortl' twice => new message 'Error unknown';  action : 'ok' once => CB closes
2- action : 'Retry' or Ignore' once  => CB closes and the modified file is not saved.

I've been running tests on Win7
Quote
1- win7-32: cb-12180, gcc-810-dwarf, wx-3.1.3
2- win7-64: cb-12180, gcc-810-seh, wx3.1.3
the save is correct
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #5 on: July 02, 2020, 09:10:30 pm »
I can't reproduce this on linux. You'll have to build a version with symbols and attach a debugger.
Do I understand correctly that the issue happens on vista, but it doesn't happen on win7?
(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 stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Re: An unhandled exception ...
« Reply #6 on: July 02, 2020, 10:32:03 pm »
Quote
1- active project: any

Does the problem happen if there is no open project?
Because all my tests were with no open projects.

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

Offline LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #7 on: July 03, 2020, 10:40:46 am »
@stahta01
Quote
Win32, cb12180, gcc-810-dwarf, wx-313
I've just done the test without a project: the result is identical

@obfuscated
If I understand your instructions correctly, I have to run a version of 'cb-12180' in debug mode from another version of 'cb' to capture the backup of the file.

I did another test with a version
Quote
cb-12171, gcc-810-sljl, wx-313-sljl, Vista-32
and with 'WhatIsHang' from 'http://www.nirsoft.net'.
I managed to capture some information (bigfilepo.txt)
I also captured the state of Vista's memory  (processors.png)
- the linear increase of the memory corresponds to the saving of the file until the exception message is displayed.
- the memory drop corresponds to the destruction of 'CB'.


« Last Edit: July 03, 2020, 10:46:35 am by LETARTARE »
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #8 on: July 03, 2020, 11:42:27 am »
I just ran another test on Vista-32 :
I use 'cb-12171, gcc-810-sljl, wx-313-sljl',
wherein I load 'cb-12180, gcc-810-dwarf, wx-313-dwarf'.

I'm running 'cb-12180' in which
1- I load the file 'All_codeblocks.po'.
2- I modify this file
3- I save it
=> the backup is done properly !!
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #9 on: July 04, 2020, 10:52:59 am »
I think I've found the culprit !!
Code: [Select]
'cbEditor::Save()'call
Code: [Select]
'm_pData->EnsureConsistentLineEnds();' who call
Code: [Select]
'control->ConvertEOLs(control->GetEOLMode());' which is creating the problem!
A remark : 'control->GetEOLMode()' return 0 (CRLF) while the file contains only 'LF' !

If I comment on this call the problem disappears!
So it's in ...
Code: [Select]
void wxScintilla::ConvertEOLs(int eolMode)
{
    SendMsg(SCI_CONVERTEOLS, eolMode, 0);
}

Then I'm no longer competent.
« Last Edit: July 04, 2020, 11:15:48 am by LETARTARE »
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #10 on: July 04, 2020, 11:42:10 am »
Do the problem still happen if you disable optimizations? (set a global variable "cb_release_type=-g -O0")
(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 LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #11 on: July 04, 2020, 03:14:01 pm »
No, no improvement
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #12 on: July 04, 2020, 05:48:39 pm »
By finding out why 
Quote
A remark : 'control->GetEOLMode()' return 0 (CRLF) while the file contains only 'LF' !
I replaced
Code: [Select]
// control->ConvertEOLs(control->GetEOLMode());by
Code: [Select]
control->ConvertEOLs(2);in 'Scintilla.h' we find
Code: [Select]
#define SC_EOL_LF 2
and then BINGO : it works, no more problems !!

It is therefore a bad detection of the end of line by
Code: [Select]
int wxScintilla::GetEOLMode() const
{
    return SendMsg(SCI_GETEOLMODE, 0, 0);
}
with Win32.

Gentlemen developers, to your keyboards!

« Last Edit: July 04, 2020, 06:21:11 pm by LETARTARE »
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Re: An unhandled exception ...
« Reply #13 on: July 04, 2020, 06:29:54 pm »
By finding out why 
Quote
A remark : 'control->GetEOLMode()' return 0 (CRLF) while the file contains only 'LF' !
I replaced
Code: [Select]
// control->ConvertEOLs(control->GetEOLMode());by
Code: [Select]
control->ConvertEOLs(2);in 'Scintilla.h' we find
Code: [Select]
#define SC_EOL_LF 2
and then BINGO : it works, no more problems !!

It is therefore a bad detection of the end of line by
Code: [Select]
int wxScintilla::GetEOLMode() const
{
    return SendMsg(SCI_GETEOLMODE, 0, 0);
}
with Win32.

Gentlemen developers, to your keyboards!

Not till you post what settings you had inside Code::Blocks!
End of Line options are:
The real important two are
"Ensure Consistent EOLs" and "End of Line Mode".

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

Offline LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #14 on: July 04, 2020, 07:22:55 pm »
Yes, you are right.
I use with Win-32
Quote
Ensure Consistent EOLs = Yes
End of Line : CRLF

Well, the file I used contained only Linux end of line (LF) and with the previous options chosen: CB wants to modify the end of line of the file with the end of line of the option and crashes with Win32 !

CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #15 on: July 04, 2020, 07:35:22 pm »
Yes, but this shouldn't cause a crash. Is this crash happening only on win32? Can you reproduce this with win64?
(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 LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #16 on: July 06, 2020, 05:20:12 pm »
Summary of the latest tests to date :

I use two files :
Quote
1- 'All_codeblocksLF.po' with end of line 'LF'.
2- 'All_codeblocksCRLF.po' with end of line 'CRLF'
and always 'cb-12180' compiled with the mentioned 'gcc'.
1- I load the file in the editor of CB
2- I'm modifying it.
3- I'm saving him.

Quote
Window OS:
CB->Editor->Ensure Consistent EOLs = Yes
CB->Editor->End of Line : CRLF
Win7-64bits :  gcc-810-32 bits, wx-313,  file 'LF' => crash, file 'CRLF' => good
Win7-64bits :  gcc-810-64 bits, wx-313,  file 'LF' => crash, file 'CRLF' => good
Vista-32bits :  gcc-810-32 bits, wx-313,  file 'LF' => crash, file 'CRLF' => good
Exception message for the crash.
Quote
Linux OS (OpenSuse-Leap-15.1 last update)
CB->Editor->Ensure Consistent EOLs = Yes
CB->Editor->End of Line : LF
gcc-750-64bits, wx-303 => file 'LF' => good, file 'CRLF' => crash
No exception message for the crash !
Under OpenSuse-Leap-15.1 , the file with 'CRLF' crashes the system if the CB application is not destroyed before the memory is saturated !

You can see that the error occurs if the file does not have the editor's line endings

I forgot the files...
« Last Edit: July 16, 2020, 04:14:19 pm by LETARTARE »
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #17 on: July 19, 2020, 01:30:01 am »
What are the exact steps to reproduce this?

I've done:
1. loaded the LF file. Which was slow because of the spellchecker.
2. executed Edit -> End-of-line mode -> Windows (CR & LF). This took less then ten seconds, but finished successfully. No excessive memory usage.
(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 LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #18 on: July 20, 2020, 11:46:01 am »
Which operating system ?  I'm guessing Win??

If with CB you transform the end of lines in accordance with the operating system: no problem.
If you don't do the transformation: crash

The default is to use a badly coded file at the end of the line: see the examples in my previous message.
If the end of the lines don't match, I think Scintilla is detecting the wrong file!
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #19 on: July 20, 2020, 07:50:02 pm »
My OS Linux, 64bit.
Please post step by step instructions.
Code: [Select]
1. start codeblocks
2. open this
3. do this
4.
5.

If you want this fixed please fill steps 2-5. I've spend too much time trying to reproduce it and if I'm not able to reproduce it in 5 minutes, I'll switch to doing something else.
(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 LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #20 on: July 21, 2020, 04:08:41 pm »
My test wit Linux :
- Linux OS (OpenSuse-Leap-15.1 last update) with 6GB memory and 2GB swap
- cb-12180 compiled with gcc-750-64bits, wx-303

1- start cb-12180 wit no project
    CB->Editor->Ensure Consistent EOLs = Yes
    CB->Editor->End of Line : LF
2- load 'All_codeblocksCRLF.po' with end of line 'CRLF'
3- add a space and save the file
4- the cursor indicates an important background task and the memory used increases linearly
5- ATTENTION : you must kill CB before reaching maximum memory or the system will crash !
   No message appears !

I had to reinstall a copy of my OpenSuse disk after this mishap !

CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #21 on: July 22, 2020, 10:09:19 am »
It seems to be caused by the "ChangeBar" patches to Scintilla we're using. It is not crashing on my machine, but uses a lot of memory, so I guess if you look in dmesg you'll see an OoM message. You can improve the testing time of this by disabling swap. Without swap when you get out of memory you'll get a direct crash. If you want to prevent crashes but you have a lot of time you could setup bigger swap.

I'm not sure how to resolve the problem, I'm not really familiar with the patch and should investigate it.
(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 LETARTARE

  • Regular
  • ***
  • Posts: 422
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #22 on: July 22, 2020, 04:20:16 pm »
Thank you for the test that partially corroborates mine.
Maybe contact the developer who maintains 'Scintilla'?
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12737
    • Travis build status
Re: An unhandled exception ...
« Reply #23 on: July 23, 2020, 02:22:09 am »
This is the plan, but talking to Neil is not the most pleasant or fruitful experience. :(
(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!]