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

Qt protobuf double free or invalid pointer error #2925

Closed
SebiSebi opened this issue Mar 31, 2017 · 6 comments
Closed

Qt protobuf double free or invalid pointer error #2925

SebiSebi opened this issue Mar 31, 2017 · 6 comments

Comments

@SebiSebi
Copy link

SebiSebi commented Mar 31, 2017

I have tried to use protocol buffers in a Qt Application. The main function is:

#include <QApplication>
#include "../../proto/client_config.pb.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    return 0;
}

I have linked the binary with -lprotobuf and run the code. It gives me the following runtime error:

*** Error in `/home/sebisebi/Anul3/IP/instant_messenger/src/build-ClientApplication-Desktop_Qt_5_8_0_GCC_64bit-Debug/ClientApplication': free(): invalid pointer: 0x0000000000985e50 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f874793f7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f8747947e0a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f874794b98c]
/usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.9(_ZN6google8protobuf8internal28DestroyDefaultRepeatedFieldsEv+0x1f)[0x7f873464b49f]
/usr/lib/x86_64-linux-gnu/libprotobuf.so.9(_ZN6google8protobuf23ShutdownProtobufLibraryEv+0x8b)[0x7f87491c7b3b]
/usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3(+0x20329)[0x7f8734a91329]
/lib64/ld-linux-x86-64.so.2(+0x10c17)[0x7f87494a8c17]
/lib/x86_64-linux-gnu/libc.so.6(+0x39ff8)[0x7f8747901ff8]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a045)[0x7f8747902045]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf7)[0x7f87478e8837]
/home/sebisebi/Anul3/IP/instant_messenger/src/build-ClientApplication-Desktop_Qt_5_8_0_GCC_64bit-Debug/ClientApplication[0x405679]

If I do not link protobuf library (not using -lprotobuf) the code compiles (since I am not using ClientConfig class at all) and it does not raise any error at runtime.

I cannot figure out what is the problem with this. It seems very strange. Moreover, if I do not define the QApplication object in the main's first line the crash does not occur. I have installed protobuf compiler and libraries using apt-get install protobuf-compiler libprotoguf-dev and the current version is 2.6.1.

@Kentzo
Copy link

Kentzo commented Apr 1, 2017

Wild guess: you have different protobuf linked against your app directly and through some other dependency.

@SebiSebi
Copy link
Author

Yes, you were right. I have managed to solve the problem by reinstalling the protobuf compiler and libraries.

@HWiese1980
Copy link

HWiese1980 commented Sep 21, 2017

I've got the same issue with some of my apps here. Is there some fancy tool by chance that can help me track the issue down? I mean, like a GUI maybe that shows me a dependency/library import tree or something?

@Kentzo
Copy link

Kentzo commented Sep 21, 2017

@HWiese1980 It depends on the platform. On Linux you have ldd, on Windows there is Dependency Walker and on macOS there is otool.

@HWiese1980
Copy link

@Kentzo I know about ldd, thanks. But it's clumsy and uncomfortable to get a complete dependency graph with it. I'm looking for something with a GUI. Something that can visualize the graph. Maybe even something that is able to detect conflicts.

@arya-coding
Copy link

Hi guys,

I had the exact same issue using Caffe. I found the fix on an another repo : CMU-Perceptual-Computing-Lab/openpose#68 (comment)

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

4 participants