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

Segmentation fault sometimes when lost connection #25

Open
nerdknight opened this issue Feb 5, 2015 · 4 comments
Open

Segmentation fault sometimes when lost connection #25

nerdknight opened this issue Feb 5, 2015 · 4 comments

Comments

@nerdknight
Copy link

This happens once in a while, usally when the phone disconnects form wifi , 3g, or connect to other network, it's a bit dificult to reproduce. Here is the log:

There was an IO error: Connection closed by server. 
Connection closed. 
Stopping timers. 
Freeing up the connection. 
Freeing up the socket. 
Yappari will retry the connection in 10 seconds. 
Segmentation fault
@agamez
Copy link
Owner

agamez commented Apr 16, 2015

Hi!

Is there any news on this? Latest patches you and cepiperez sent solved this issue or is it still standing?

@nunks
Copy link

nunks commented Apr 16, 2015

It's not anymore a segfault per se, but Yappari still crashes here, with an "invalid length" message:

INCOMING:
<chatstate>
   from=***@s.whatsapp.net
<composing>

INCOMING:
<message>
   from=***@s.whatsapp.net
   id=1429144049-138
   notify=***
   t=1429151616
   type=text
<body>
   Ehehehe

parseMessageInitialTagAlreadyChecked
OUTGOING:
<receipt>
   id=1429144049-138
   to=***@s.whatsapp.net

logMessage():  
There was an IO error: Connection closed by server.
Connection closed.
Stopping timers.
Freeing up the connection.
Freeing up the socket.
Yappari will retry the connection in 10 seconds.
Invalid length 0x14
Yappari 2.0.10 Build 5210
Yappari console debug start
Reading roster DB...
Roster retrieved in 555 milliseconds.
Resetting timestamps at 1429151933006
Next run in 1266994
Reading open chats DB...
Open Chats retrieved in 5 milliseconds.
Entry retrieved: ***@s.whatsapp.net
Entry retrieved: ***@s.whatsapp.net

@nerdknight
Copy link
Author

Works a little better but still crashes some times with segfault:

#0  0x414f03d2 in QIODevice::isOpen() const () from /usr/lib/libQtCore.so.4
#1  0x414e3336 in QBuffer::setBuffer(QByteArray*) ()
   from /usr/lib/libQtCore.so.4
#2  0x0005ed34 in BinTreeNodeReader::getOneToplevelStream (this=0xce2a88)
    at Whatsapp/bintreenodereader.cpp:60
#3  0x0005ed9c in BinTreeNodeReader::nextTree (this=0xce2a88, node=...)
    at Whatsapp/bintreenodereader.cpp:103
#4  0x0004eb64 in Connection::read (this=0xee6578)
    at Whatsapp/connection.cpp:124
#5  0x00063dcc in Client::read (this=0x3fe3b0) at client.cpp:1132
#6  0x001423ac in Client::qt_metacall (this=0x3fe3b0, 
    _c=QMetaObject::InvokeMetaMethod, _id=12, _a=0xbeac3fa0)
    at moc_client.cpp:198
#7  0x41533770 in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#8  0x4153dcca in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
---Type <return> to continue, or q <return> to quit---
#9  0x4136c418 in ?? () from /usr/lib/libQtNetwork.so.4
#10 0x413611ca in ?? () from /usr/lib/libQtNetwork.so.4
#11 0x4136183a in ?? () from /usr/lib/libQtNetwork.so.4
#12 0x40d88c3c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/libQtGui.so.4
#13 0x40d8bafa in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libQtGui.so.4
#14 0x40adad28 in ?? () from /lib/libglib-2.0.so.0
#15 0x40adad28 in ?? () from /lib/libglib-2.0.so.0

@agamez
Copy link
Owner

agamez commented Apr 18, 2015

I'm still not sure how SEGFAULT can happen while using a QByteArray member, but lets assume it's not correctly initialized.

Could you please try replacing the BinTreeNodeReader constructor with the following code? It simply initializes both QByteArray to the empty (not null) string. It works for me but I've never experiencied any segfault, so I need you test this for me. Thanks!

BinTreeNodeReader::BinTreeNodeReader(QTcpSocket *socket, WATokenDictionary *dictionary,
QObject *parent) : QObject(parent)
{
this->dict = dictionary;
this->socket = socket;

decodedBuffer = "";
rawBuffer = "";

}

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

3 participants