These are chat archives for highfidelity/hifi

29th
Jun 2014
AlericInglewood
@AlericInglewood
Jun 29 2014 12:35
I'm having a Segmentation fault in kernel/qobject.cpp:2827 after compiling my own Qt5, backtrace:
#0 0x00007fffcc010270 in ?? ()
#1 0x00007ffff723f4f0 in QObject::disconnect (sender=0x7fffffffd1a8, signal=0x0, receiver=0x7fffcc00baf0, method=0x0) at kernel/qobject.cpp:2827
#2 0x00000000007058b7 in QObject::disconnect (this=0x7fffffffd1a8, receiver=0x7fffcc00baf0, member=0x0)
at /opt/highfidelity/qt5/qt-everywhere-opensource-src-5.2.1/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:363
#3 0x00000000007028d1 in Audio::switchInputToAudioDevice (this=0x7fffffffd1a8, inputDeviceInfo=...) at /opt/highfidelity/hifi/hifi/interface/src/Audio.cpp:1332
#4 0x00000000006ff016 in Audio::switchInputToAudioDevice (this=0x7fffffffd1a8, inputDeviceName=...) at /opt/highfidelity/hifi/hifi/interface/src/Audio.cpp:413
AlericInglewood
@AlericInglewood
Jun 29 2014 12:41

In this line: 2827 Q_ASSERT(!receiver || QMetaObjectPrivate::get(receiver->metaObject())->revision >= 7);
While executing the 'receiver->metaObject()'. The value of 'receiver' (0x7fffcc00baf0) is the same as when it was assigned: it's a copy of Audio::_inputDevice and I added debug output to print it's value when it is assigned:

[2014-06-29T14:38:09] The default audio input device is "alsa_input.pci-0000_00_14.2.analog-stereo"
[2014-06-29T14:38:09] The audio input device "alsa_input.pci-0000_00_14.2.analog-stereo" is available.
[2014-06-29T14:38:09] The format to be used for audio input is QAudioFormat(24000Hz, 16bit, channelCount=1, sampleType=SignedInt, byteOrder=LittleEndian, codec="audio/pcm")
[2014-06-29T14:38:09] _inputDevice set to 0x7fffcc00baf0
[...]
Then short after, the next call to Audio::switchInputToAudioDevice, it crashes as above.

AlericInglewood
@AlericInglewood
Jun 29 2014 12:53
http://qt-project.org/doc/qt-5/qobject.html#metaObject
Hmm, that is a virtual function. I guess the virtual pointer is NULL.
I'll try printing _inputDevice->metaObject()->className() immediately after assignment of _inputDevice.
AlericInglewood
@AlericInglewood
Jun 29 2014 13:23
Breakpoint 1, Audio::switchInputToAudioDevice (this=0x7fffffffd1a8, inputDeviceInfo=...) at /opt/highfidelity/hifi/hifi/interface/src/Audio.cpp:1361
1361                    QMetaObject const* meta = receiver->metaObject();
(gdb) p receiver
$3 = (const QObject *) 0x7fffcc00baf0
(gdb) set print static-members off
(gdb) p *this
$5 = {<QIODevice> = {<QObject> = {_vptr.QObject = 0x7fffd5a15d70, d_ptr = {d = 0x7fffcc00b4f0}}, }, m_audioDevice = 0x7fffcc00b880}
(gdb) p this->d_ptr.d->metaObject
$9 = (QDynamicMetaObjectData *) 0x0
(gdb) p &staticMetaObject
$10 = (const QMetaObject *) 0x7fffd5a15d20
and
InputPrivate::metaObject (this=0x7fffcc00baf0) at .moc/moc_qaudioinput_pulse.cpp:162
162         return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
returns
(gdb) p meta
$11 = (const QMetaObject *) 0x7fffd5a15d20
AlericInglewood
@AlericInglewood
Jun 29 2014 13:29
This message was deleted
AlericInglewood
@AlericInglewood
Jun 29 2014 13:41

[2014-06-29T15:36:16] The audio input device "alsa_input.pci-0000_00_14.2.analog-stereo" is available.
[2014-06-29T15:36:16] The format to be used for audio input is QAudioFormat(24000Hz, 16bit, channelCount=1, sampleType=SignedInt, byteOrder=LittleEndian, codec="audio/pcm")
[2014-06-29T15:36:16] _inputDevice set to 0x7fffcc00baf0
[Switching to Thread 0x7fffd6217700 (LWP 25088)]

Breakpoint 1, Audio::switchInputToAudioDevice (this=0x7fffffffd1a8, inputDeviceInfo=...) at /opt/highfidelity/hifi/hifi/interface/src/Audio.cpp:1361
1361                    QMetaObject const* meta = receiver->metaObject();
(gdb) p receiver
$25 = (const QObject *) 0x7fffcc00baf0
(gdb) p *receiver
$26 = {_vptr.QObject = 0x7fffd5a15d70, d_ptr = {d = 0x7fffcc00b4f0}}

[2014-06-29T15:36:34] _inputDevice->metaObject()->className() = InputPrivate
[...]
[2014-06-29T15:36:35] "alsa_input.pci-0000_00_14.2.analog-stereo" "alsa_input.pci-0000_00_14.2.analog-stereo"
[2014-06-29T15:36:35] "alsa_output.pci-0000_00_14.2.analog-stereo.monitor" "alsa_input.pci-0000_00_14.2.analog-stereo"

Breakpoint 2, QObject::disconnect (sender=0x7fffffffd1a8, signal=0x0, receiver=0x7fffcc00baf0, method=0x0) at kernel/qobject.cpp:2829
2829            QMetaObject const* meta = receiver->metaObject();
(gdb) p receiver
$27 = (const QObject *) 0x7fffcc00baf0
(gdb) p *receiver
$28 = {_vptr.QObject = 0x7fffcc012b90, d_ptr = {d = 0x7fffcc00b4f0}}

The second is inside qt... the 'receiver' pointer is the same, but the pointer to it's _vptr.QObject changed :/

AlericInglewood
@AlericInglewood
Jun 29 2014 13:49

I did:

(gdb) p &receiver->'_vptr.QObject'
$32 = (int (***)(void)) 0x7fffcc00baf0
(gdb) watch *((void**)0x7fffcc00baf0)
Hardware watchpoint 3: *((void**)0x7fffcc00baf0)

with result..

[2014-06-29T15:46:36] "alsa_output.pci-0000_00_14.2.analog-stereo.monitor"   "alsa_input.pci-0000_00_14.2.analog-stereo" 
Hardware watchpoint 3: *((void**)0x7fffcc00baf0)

Old value = (void *) 0x7fffd5a15d70
New value = (void *) 0x7ffff74ffe90
0x00007ffff7133cd0 in QIODevice::~QIODevice (this=0x7fffcc00baf0, __in_chrg=<optimized out>) at io/qiodevice.cpp:400
400     QIODevice::~QIODevice()

In other words... the input device that _inputDevice points to is destroyed while a pointer to it still exists and is used.

It is deleted here:
#3  0x00007fffd5a09b5f in QPulseAudioInput::close (this=0x7fffcc00b880) at qaudioinput_pulse.cpp:386
386             delete m_audioSource;
(gdb) p m_audioSource
$33 = (QIODevice *) 0x7fffcc00baf0
close() is called from stop() called here:
#6 0x00000000007028af in Audio::switchInputToAudioDevice (this=0x7fffffffd1a8, inputDeviceInfo=...) at /opt/highfidelity/hifi/hifi/interface/src/Audio.cpp:1331
1331 _audioInput->stop();

This code is wrong therefore:
_audioInput->stop();
disconnect(_inputDevice);
_inputDevice = NULL;

I think the disconnect is not needed at all - but I guess it won't hurt to reverse the first two lines.

AlericInglewood
@AlericInglewood
Jun 29 2014 13:59
Ok - that fixed the crash. I can login again... but, now I don't see any voxels anymore :/
AlericInglewood @AlericInglewood created a job for this to test job system again (try two) :P
Felipe Mattos
@IAMFELIPEMATTOS
Jun 29 2014 14:48
omg
AlericInglewood
@AlericInglewood
Jun 29 2014 14:48
lol