Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange crash with a wrong functions stack #171

Closed
mmmm1998 opened this issue Jan 3, 2020 · 4 comments
Closed

Strange crash with a wrong functions stack #171

mmmm1998 opened this issue Jan 3, 2020 · 4 comments

Comments

@mmmm1998
Copy link

mmmm1998 commented Jan 3, 2020

I am not sure, that this is problem of Qalculate, but when I use try to use Qalculate in the program (Cantor), I have this strange crash. This is gdb log (qalculate builded manually with debug symbols)

$ gdb --args cantor -b qalculate
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cantor...done.
(gdb) r
Starting program: /usr/local/bin/cantor -b qalculate
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdf7a0700 (LWP 14991)]
[New Thread 0x7fffd5968700 (LWP 14992)]
[New Thread 0x7fffd4cf6700 (LWP 14994)]
[New Thread 0x7fffcffff700 (LWP 14995)]
dir:  "/usr/local/lib/x86_64-linux-gnu/plugins/cantor/backends"
Creating PythonBackend
Creating PythonBackend
dir:  "/usr/lib/x86_64-linux-gnu/qt5/plugins/cantor/backends"
dir:  "/usr/local/bin/cantor/backends"
[New Thread 0x7fffb92cf700 (LWP 14998)]
Backend  "Qalculate"  offers extensions:  ("HistoryExtension", "VariableManagementExtension", "CalculusExtension", "CASExtension", "LinearAlgebraExtension", "QalculatePlotExtension")
QalculateSession(0x555555dd2730) Cantor::VariableManagementExtension(0x555555a7f3c0, name = "VariableManagementExtension")

Thread 1 "cantor" received signal SIGSEGV, Segmentation fault.
__GI___libc_free (mem=0xffb2b6bbffb2b6bb) at malloc.c:3103
3103	malloc.c: Нет такого файла или каталога.
(gdb) where
#0  0x00007ffff3cc998d in __GI___libc_free (mem=0xffb2b6bbffb2b6bb) at malloc.c:3103
#1  0x00007fffed933593 in SampledFunction::~SampledFunction() () at /usr/lib/x86_64-linux-gnu/libpoppler.so.73
#2  0x00007fffed9335c9 in SampledFunction::~SampledFunction() () at /usr/lib/x86_64-linux-gnu/libpoppler.so.73
#3  0x00007fffbf3927fc in Calculator::addFunction(MathFunction*, bool, bool) (this=0x555555dd31e0, f=
    0x555555dd8fa0, force=true, check_names=true) at Calculator.cc:3378
#4  0x00007fffbf37feed in Calculator::addBuiltinFunctions() (this=0x555555dd31e0) at Calculator.cc:1285
#5  0x00007fffbf377cd8 in Calculator::Calculator() (this=0x555555dd31e0) at Calculator.cc:437
#6  0x00007fffbf7d9ac0 in QalculateSession::QalculateSession(Cantor::Backend*) (this=0x555555dd2730, backend=0x555555956390)
    at /home/mmmm1998/Документы/Репозитории/cantor/src/backends/qalculate/qalculatesession.cpp:54
#7  0x00007fffbf7cfdef in QalculateBackend::createSession() (this=0x555555956390)
    at /home/mmmm1998/Документы/Репозитории/cantor/src/backends/qalculate/qalculatebackend.cpp:54
#8  0x00007fffbdfc0a6b in Worksheet::initSession(Cantor::Backend*) (this=0x555555c086d0, backend=0x555555956390)
    at /home/mmmm1998/Документы/Репозитории/cantor/src/worksheet.cpp:1284
#9  0x00007fffbdfba37e in Worksheet::Worksheet(Cantor::Backend*, QWidget*, bool) (this=0x555555c086d0, backend=0x555555956390, parent=0x555555dc7cd0, useDeafultWorksheetParameters=true) at /home/mmmm1998/Документы/Репозитории/cantor/src/worksheet.cpp:102
#10 0x00007fffbdfa95a5 in CantorPart::CantorPart(QWidget*, QObject*, QList<QVariant> const&) (this=0x555555dcf210, parentWidget=0x555555d487d0, parent=0x555555d487d0, args=..., __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
    at /home/mmmm1998/Документы/Репозитории/cantor/src/cantor_part.cpp:140
#11 0x00007fffbdfb7565 in KPluginFactory::createPartInstance<CantorPart>(QWidget*, QObject*, QList<QVariant> const&) (parentWidget=0x555555d487d0, parent=0x555555d487d0, args=...) at /usr/local/include/KF5/KCoreAddons/kpluginfactory.h:539
#12 0x00007ffff5f7fa60 in KPluginFactory::create(char const*, QWidget*, QObject*, QList<QVariant> const&, QString const&) ()
    at /usr/local/lib/x86_64-linux-gnu/libKF5CoreAddons.so.5
#13 0x000055555556f94f in KPluginFactory::create<KParts::ReadWritePart>(QObject*, QList<QVariant> const&) (this=0x555555dcf0f0, parent=0x555555d487d0, args=...) at /usr/local/include/KF5/KCoreAddons/kpluginfactory.h:551
#14 0x0000555555567d05 in CantorShell::addWorksheet(QString const&) (this=0x55555593b600, backendName=...)
    at /home/mmmm1998/Документы/Репозитории/cantor/src/cantor.cpp:342
#15 0x00005555555632f7 in main(int, char**) (argc=3, argv=0x7fffffffda58)
    at /home/mmmm1998/Документы/Репозитории/cantor/src/main.cpp:127
(gdb) frame 3
#3  0x00007fffbf3927fc in Calculator::addFunction (this=0x555555dd31e0, f=0x555555dd8fa0, force=true, check_names=true)
    at Calculator.cc:3378
3378				f->setName(getName(f->getName(i).name, f, force), i);
(gdb) frame 2
#2  0x00007fffed9335c9 in SampledFunction::~SampledFunction() () from /usr/lib/x86_64-linux-gnu/libpoppler.so.73
(gdb) frame 3
#3  0x00007fffbf3927fc in Calculator::addFunction (this=0x555555dd31e0, f=0x555555dd8fa0, force=true, check_names=true)
    at Calculator.cc:3378
3378				f->setName(getName(f->getName(i).name, f, force), i);
(gdb) p f
$1 = (MathFunction *) 0x555555dd8fa0
(gdb) p i
$2 = 1
(gdb) p force
$3 = true
(gdb) frame 6
#6  0x00007fffbf7d9ac0 in QalculateSession::QalculateSession (this=0x555555dd2730, backend=0x555555956390)
    at /home/mmmm1998/Документы/Репозитории/cantor/src/backends/qalculate/qalculatesession.cpp:54
54	             new Calculator();
(gdb) 

As you can see, code from Qalculate somehow go to poppler code (poppler is a library for working with pdfs, also used in Cantor).
Any ideas, why it goes like that?

@mmmm1998 mmmm1998 changed the title Strange crash with wrong function stack Strange crash with a wrong function stack Jan 3, 2020
@mmmm1998 mmmm1998 changed the title Strange crash with a wrong function stack Strange crash with a wrong functions stack Jan 3, 2020
@mmmm1998
Copy link
Author

mmmm1998 commented Jan 3, 2020

Also, maybe this is a just coincidence, but MathFunction from Qalculate placed in Function.h source file and SampledFunction from poppler place in a file with the same filename (link to file)

@mmmm1998
Copy link
Author

mmmm1998 commented Jan 3, 2020

Also, the problem produced only in Cantor program: using the same code, but in clear main.cpp, even with poppler library don't crash.

hanna-kn added a commit that referenced this issue Jan 11, 2020
…flict with Poppler class with same name (issue #171)
@hanna-kn
Copy link
Contributor

hanna-kn commented Jan 11, 2020

I was able to fix Cantor crashing on startup (on my system) by renaming the IdentityFunction class in libqalculate (there is a class with the same name in Poppler).

@mmmm1998
Copy link
Author

Yes, I confirm, that after c784307 the problem is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants