____longjmp_chk () in Ubuntu 18.04

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

____longjmp_chk () in Ubuntu 18.04

Post by raananb » Sun Jan 26, 2020 5:41 pm

the schematic code below works perfectly on Windows and OSX. On Ubuntu 18.04.3 LTS (GTK2) it fails with

Thread 1 "MyApp" received signal SIGSEGV, Segmentation fault.
____longjmp_chk () at ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S:130

CheckDataPresent() looks at data potentially filled by an asynchronous web thread.

Code: Select all

main code
{
....
    maxTimerTicks = 300;
    timerTicks = 0;
    timerShareQuotes.StartOnce(timerShareQuoteInterval);
}

void RapportPortefeuille::OnTimerSharesQuotes(wxTimerEvent& event)
{

    if (CheckDataPresent())
    {
        Process();
    }
    else
    {
        timerTicks++;

        if (timerTicks < maxTimerTicks)
        { 
            timerShareQuotes.StartOnce(timerShareQuoteInterval);
        }
        else
        {
            wxMessageBox("Error");
            return;
        }  
    }
    
    event.Skip();
}
Aside from neutralizing this code in GTK, I see no way of avoiding the failure. Any suggestions?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3816
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ____longjmp_chk () in Ubuntu 18.04

Post by ONEEYEMAN » Mon Jan 27, 2020 1:39 pm

Hi,
What is the backtrace at the time of the crash?

Thank you.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: ____longjmp_chk () in Ubuntu 18.04

Post by raananb » Fri Feb 07, 2020 4:34 pm

Sorry for being long to reply. I was trying to see whether the problem was present in other Linux distros and that is quite time-consuming: setting up a proper environment for OpenMandriva, Mageia or Fedora is far from trivial, and indeed I did not succeed as yet.

The problem is identical under Mint (also operationg as Guest in VBox running on Windiws 10).

Without the debugger, the application simply fails, with no information.

Under debugger, when the application fails, the last lines produced by gdb are:

Thread 1 "AccountsManager" hit Breakpoint 1, RapportPortefeuille::OnTimerSharesQuotes (this=0x5555569c9280, event=...) at rapportportefeuille.cpp:391
391 wxUnusedVar(event);
(gdb) c
Continuing.
[Thread 0x7fff8bbd5700 (LWP 3059) exited]
[New Thread 0x7fff8bbd5700 (LWP 3070)]
[New Thread 0x7fff89350700 (LWP 3071)]
[New Thread 0x7fff88b4f700 (LWP 3072)]
[New Thread 0x7fff837fe700 (LWP 3073)]
130 ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: No such file or directory.

Thread 1 "AccountsManager" received signal SIGSEGV, Segmentation fault.
____longjmp_chk () at ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S:130
(gdb)

I dont see how to backtrace this, but I am open to suggestions.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3816
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ____longjmp_chk () in Ubuntu 18.04

Post by ONEEYEMAN » Fri Feb 07, 2020 4:54 pm

Hi,
Did you compile wx and you application in debug mode?

Thank you.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: ____longjmp_chk () in Ubuntu 18.04

Post by raananb » Sat Feb 08, 2020 10:50 am

Both were compiled in debug mode

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3816
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ____longjmp_chk () in Ubuntu 18.04

Post by ONEEYEMAN » Sun Feb 09, 2020 11:24 pm

Hi,
So what is the program (and/or you) do before crashing?

Can you post some code?

Also - what is the exact configure line for the wxWIdgets? And how did you build your program?

Also, which version of gcc did you use? Were you cross-compiling?

Thank you.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: ____longjmp_chk () in Ubuntu 18.04

Post by raananb » Mon Feb 10, 2020 12:38 pm

I may have come upon something:

First an explanation:

I want to get information from a website without subscribing to a service. I use a browser with the appropriate url to get the page containing the data I need. This is an asynchronous process.

I defined a class GetShareQuote where a browser is created and where a function CheckShareQuote() is provided to generate a url and load it into the browser. The event OnDocumentLoaded allows to access the page and it fills in the data elements provided in the call to that function. If relevant, a call using arrays is used, and successive urls are generated and loaded to obtain data pertinent to these urls. When all the elements are filled (a set per url) the process stops.

GetShareQuote is created in the application, and the function CheckShareQuote() is called with the relevant data. A timer is launched to check whether values were obtained in GetShareQuote. When all the expected values have been retrieved the process in the application sequence terminates.

One last comment : this works fine under Windows and OSX.

Code:

1. Application sequence:
...
GSQ = new GetShareQuote(this);

// single url
GSQ->CheckShareQuote(titre, isin, &quote, &devise, &quoteDate, &dQuote, &errMessage);

// multiple urls
// GSQ->CheckShareQuote(&titres, &isins, &quotes, &devises, &quoteDates, &dQuotes, &errMessage);

timerShareQuotes.SetOwner(this, ID_TimerShareQuotesRPF);
timerShareQuotes.StartOnce(timerShareQuoteInterval);
...

void OnTimerShareQuote()
{ // check if all data has been retrieved

}


2. Class GetShareQuote:

void GetShareQuote::CreateControls()
{
////@begin GetShareQuote content construction
// Generated by DialogBlocks, Mon 10 Feb 2020 11:46:33 CET (unregistered)

GetShareQuote* itemFrame1 = this;

////@end GetShareQuote content construction
m_browser = wxWebView::New(this, wxID_ANY,wxEmptyString);
m_browser->Connect(m_browser->GetId(), wxEVT_WEBVIEW_LOADED, wxWebViewEventHandler(GetShareQuote::OnDocumentLoaded), NULL, this);
}

bool GetShareQuote::CheckShareQuote(wxString Titre, wxString CodeIsin, wxString* Quote, wxString* Devise, wxString* QuoteDate, wxString* ErrMessage)
{ // keep different from download for clarity
m_titre = Titre;
m_codeISIN = CodeIsin;
m_quote = Quote;
m_devise = Devise;
m_dateQuote = QuoteDate;
m_errMessage = ErrMessage;
m_errMessage->Clear();
m_numberOfShares = 1;

url = BuildUrl(m_titre,m_codeISIN);

m_browser->LoadURL(url);

return true;
}

void GetShareQuote::OnDocumentLoaded(wxWebViewEvent& event)
{ // here the loaded page is processed and the value retrieved.
// If several urls are present, they are loaded in the browser succesively
// and processed here.

// procedd page loaded

item++;

if (item < m_numberOfShares)
{ // multiple urls - next url
url = BuildUrl(m_titres->Item(item).Lower(), m_codesISIN->Item(item));

m_browser->LoadURL(url);
}

}


3. Debugger

The url is printed below at the first break at line 166 (the url is generated in line 162 and used in line 164).

further down the url is damaged: see console messages.

That may be the reason why the applications fails.

Starting program: /home/raanan/Documents/AccountsManager2/GTKDebug/AccountsManager
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe3684700 (LWP 15105)]
[New Thread 0x7fffa2d61700 (LWP 15106)]
[New Thread 0x7fffa13b2700 (LWP 15107)]
[New Thread 0x7fffa0bb1700 (LWP 15108)]
[New Thread 0x7fff91a4a700 (LWP 15109)]
[New Thread 0x7fff90c44700 (LWP 15110)]

Thread 1 "AccountsManager" hit Breakpoint 3, GetShareQuote::CheckShareQuote (
this=0x5555566e8020, Titres=0x55555698ec18, CodesISIN=0x55555698ec40,
Quotes=0x55555698ec68, Devises=0x55555698ec90, QuoteDates=0x55555698ecb8,
DQuotes=0x55555698ece0, ErrMessage=0x55555698eb68)
at getsharequote.cpp:166
166 return true;
(gdb) p url
$1 = {static npos = 18446744073709551615,
m_impl = L"https://www.boursier.com/actions/cours/ ... 04,FR.html", m_convertedToChar = {
m_str = 0x5555569c3da0 "https://www.boursier.com/actions/cours/ ... 04,FR.html", m_len =
71}}
(gdb) c
Continuing.
[New Thread 0x7fff8bbf2700 (LWP 15116)]
[New Thread 0x7fff89c09700 (LWP 15117)]
[New Thread 0x7fff89408700 (LWP 15118)]
[New Thread 0x7fff88c07700 (LWP 15119)]
[New Thread 0x7fff7ffff700 (LWP 15120)]
[New Thread 0x7fff7f7fe700 (LWP 15121)]
[New Thread 0x7fff7effd700 (LWP 15122)]
[New Thread 0x7fff7e7fc700 (LWP 15123)]
[New Thread 0x7fff7dffb700 (LWP 15124)]
[New Thread 0x7fff7d05b700 (LWP 15125)]
** Message: 11:50:34.994: console message: https://www.boursier.com/Scripts/js/bot ... 26SmOUqHQ1 @37791: SyntaxError: Unexpected identifier 'isDown'

[Thread 0x7fff8bbf2700 (LWP 15116) exited]
[Thread 0x7fff7e7fc700 (LWP 15123) exited]
[Thread 0x7fff7ffff700 (LWP 15120) exited]
[Thread 0x7fff88c07700 (LWP 15119) exited]
[Thread 0x7fff7effd700 (LWP 15122) exited]
[Thread 0x7fff7f7fe700 (LWP 15121) exited]
[Thread 0x7fff7dffb700 (LWP 15124) exited]
[Thread 0x7fff89408700 (LWP 15118) exited]
** Message: 11:50:36.729: console message: https://www.boursier.com/actions/cours/ ... 04,FR.html @846: TypeError: undefined is not a function (evaluating '$('.bmodaal').modaal({
'width' : 600,
'custom_class': 'buy-sell--modaal'
})')

130 ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: No such file or directory.

Thread 1 "AccountsManager" received signal SIGSEGV, Segmentation fault.
____longjmp_chk () at ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S:130
(gdb)

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: ____longjmp_chk () in Ubuntu 18.04

Post by raananb » Mon Feb 10, 2020 2:49 pm

Poking deeper with th debugger, the following seems to be alarming:

0x00007ffff5b2fd03 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) n
Cannot find bounds of current function

I am nor sure what that means but is seems like a corrupt lib.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3816
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ____longjmp_chk () in Ubuntu 18.04

Post by ONEEYEMAN » Mon Feb 10, 2020 3:41 pm

Hi,
Are you trying it inside VM?

Thank you.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: ____longjmp_chk () in Ubuntu 18.04

Post by raananb » Mon Feb 10, 2020 7:55 pm

Linux is a guest in VBox running under Windows 10

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3816
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ____longjmp_chk () in Ubuntu 18.04

Post by ONEEYEMAN » Mon Feb 10, 2020 7:58 pm

Hi,
Can you try to do a fresh actual install (not a VM)?

Thank you.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: ____longjmp_chk () in Ubuntu 18.04

Post by raananb » Thu Feb 13, 2020 9:43 am

Thanks for keeping up.

I moved to gtk+3 (hoping that this would have a positive effect) but the problem remains.

I then simplified the communication between the calling and the called routines but the problem still remains. It looks like the problem occurs after the url is loaded in the browser, since the url is loaded with no problems, but 'DocumentLoaded' event is never fired (and OnDocumentLoaded is never reached). As shown earlier, the url becomes broken which suggests there is a pointer problem somewhere.

On a Booted Ubuntu 18.04 (not VBox) the application fails with a segmentation fault with no useful data.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3816
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ____longjmp_chk () in Ubuntu 18.04

Post by ONEEYEMAN » Thu Feb 13, 2020 3:43 pm

Hi,
What is the URL?
Can you successfully open it in the FF or default GNOME browser?

Does it contains any JS code, that modifies the URL?
Can you open the www.wxwidgets.org in your software?

Thank you.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 410
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: ____longjmp_chk () in Ubuntu 18.04

Post by raananb » Fri Feb 14, 2020 12:45 pm

Your remark is very pertinent.

My application generates the url 'https://www.boursier.com/actions/cours/ ... 04,FR.html' which the application processes as expected in Windows and Osx executing exactly the same application code. In Linux the same code fails; the backend is evidently different.

With Ubuntu 18.04 under VBox, I replaced the url above by 'www.wxwidgets.org' in the application. The application does not fail and OnDocumentLoaded is fired. However, the loaded page length is 0;

I inserted the application-generated url into the webview sample and in Firefox, and the corresponding page is displayed correctly in both browsers.

I am not sure where to proceed from here...

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3816
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ____longjmp_chk () in Ubuntu 18.04

Post by ONEEYEMAN » Fri Feb 14, 2020 4:31 pm

Hi,
Well, unfortunately I'm out of ideas.
The only suggestion I could give is to recompile the WebKit in debug mode and try to debug what is happening and where does it crash.

The other thing is - do you have both WebKit-1 and WebKit-2 installed on the box?

Thank you.

Post Reply