[PyKDE] high event volumes causing seg faults
Patrick Stinson
ajole-1 at gci.net
Wed Dec 31 00:56:01 GMT 2003
sip: 3.8
python: 2.3.2
PyQt: 3.8.1
On Tuesday 30 December 2003 03:19, Phil Thompson wrote:
> Version numbers?
>
> If you are not already doing so I'd suggest using the latest SIP v4 and
> PyQt snapshots.
>
> Phil
>
> On Monday 29 December 2003 7:47 am, Patrick Stinson wrote:
> > I'm using alsa's rawmidi interface to read midi messages from hardware,
> > then pumping them to my qt application code. The problem thus far has
> > been dealing with the higher (~50-100/sec) volumes of messages received
> > in a dedicated thread, and integrating them safely into the main qt event
> > thread.
> >
> > My midi class has a blocking read method that produces messages. a python
> > thread is created to call it, and messages are put into a Queue.Queue
> > object. Another python thread reads from the queue and uses
> > QApplication.postEvent to get the message into the qt thread. All is fine
> > until I call a method like 'QSlider.setValue' that changes the way a
> > widget looks from my overridden QWidget.event() method. I've tried
> > setting a single-millisecond timer to generate events in place of the
> > midi object, and of course, everything works fine. Why is it that the
> > slider dies when the 'events', however proxied, originate in the midi
> > thread?
> >
> > Sometimes I'm getting negative ref counts; what could be left over or
> > deleted so fast that python/qt couldn't keep up?
> >
> >
> > here is the simple result from an attempt at a
> > [midi thread: Queue.put()] ->
> > [dispatch thread: Queue.get(), QApplication.postEvent()] ->
> > [qt thread: event(),QEvent.data()]
> >
> >
> > bash-2.05b$ pksampler
> > WAD Enabled
> > pkaudio: found 4 devices, but only using 1.
> > pkaudio: ->> Found device: hw:PCI,0
> > pkaudio: outputs: 2
> > pkaudio: inputs: 2
> > pkaudio: [[loaded device 1]]
> > pkaudio: ->> Found device: hw:Extigy,0
> > pkaudio: outputs: 6
> > pkaudio: inputs: 2
> > pkaudio: sample rates: 48000
> > pkaudio: ->> Found device: hw:Extigy,2
> > pkaudio: outputs: 2
> > pkaudio: inputs: 0
> > pkaudio: sample rates: 48000
> > PKSampler: driver buffer size: 2048
> > PKSampler: driver sample rate: 44100
> > PKSampler: All daemons up and running
> > WAD: Collecting debugging information...
> > WAD: Segmentation fault.
> > #12 0x40238247 in __clone()
> > #11 0x40030d40 in pthread_start_thread()
> > #10 0x080ee9bd in t_bootstrap()
> > #9 0x080c2da9 in PyEval_CallObjectWithKeywords()
> > #8 0x0805c3fe in PyObject_Call()
> > #7 0x080642d3 in instancemethod_call()
> > #6 0x0805c3fe in PyObject_Call()
> > #5 0x0810d125 in function_call()
> > #4 0x080c162f in PyEval_EvalCodeEx()
> > #3 0x080bf82f in eval_frame()
> > #2 0x080c3119 in call_function()
> > #1 0x0810d8d6 in PyCFunction_Call()
> > #0 0x417f58b1 in _Z26sipDo_QCustomEvent_setDataP7_objectS0_()
> >
> >
> > --------------------------------------
> >
> >
> > I've had several horrendous stack traces, but I think the following one
> > best suits the extent of my problem...
> >
> > PKSampler: All daemons up and running
> > WAD: Collecting debugging information...
> > SegFault: [ C stack trace ]
> >
> > #50 0x080b9ef4 in PyEval_EvalCode()
> > #49 0x080c162f in PyEval_EvalCodeEx()
> > #48 0x080bf82f in eval_frame()
> > #47 0x080c3119 in call_function()
> > #46 0x0810d8d6 in PyCFunction_Call()
> > #45 0x418de03b in _Z28sipDo_QApplication_exec_loopP7_objectS0_()
> > #44 0x40563b11 in _ZN12QApplication4execEv()
> > #43 0x40576928 in _ZN10QEventLoop4execEv()
> > #42 0x40576a86 in _ZN10QEventLoop9enterLoopEv()
> > #41 0x4050fea4 in _ZN10QEventLoop13processEventsEj()
> > #40 0x4055301d in _ZN10QEventLoop14activateTimersEv()
> > #39 0x418db9fb in _ZN15sipQApplication6notifyEP7QObjectP6QEvent()
> > #38 0x40562cb5 in _ZN12QApplication6notifyEP7QObjectP6QEvent()
> > #37 0x405638c5 in _ZN12QApplication14internalNotifyEP7QObjectP6QEvent()
> > #36 0x41598b6f in _ZN9sipQTimer5eventEP6QEvent()
> > #35 0x405df932 in _ZN6QTimer5eventEP6QEvent()
> > #34 0x408da8eb in _ZN6QTimer7timeoutEv()
> > #33 0x405be454 in _ZN7QObject15activate_signalEi()
> > #32 0x405be620 in
> > _ZN7QObject15activate_signalEP15QConnectionListP8QUObject() #31
> > 0x41907334 in _ZN10sipProxyqt9qt_invokeEiP8QUObject()
> > #30 0x41523175 in _ZN10sipProxyqt9proxySlotEv()
> > #29 0x40019fdf in _Z13sipEmitToSlotP7sipSlotP7_object()
> > #28 0x080c2da9 in PyEval_CallObjectWithKeywords()
> > #27 0x0805c3fe in PyObject_Call()
> > #26 0x080642d3 in instancemethod_call()
> > #25 0x0805c3fe in PyObject_Call()
> > #24 0x0810d125 in function_call()
> > #23 0x080c162f in PyEval_EvalCodeEx()
> > #22 0x080bf82f in eval_frame()
> > #21 0x080c325b in call_function()
> > #20 0x080c3463 in fast_function()
> > #19 0x080bf82f in eval_frame()
> > #18 0x080c325b in call_function()
> > #17 0x080c3463 in fast_function()
> > #16 0x080bf82f in eval_frame()
> > #15 0x080c3119 in call_function()
> > #14 0x0810d8d6 in PyCFunction_Call()
> > #13 0x41b4223d in _Z23sipDo_PK_Effect_ControlP7_objectS0_()
> > #12 0x40020157 in sipMapCppToSelf()
> > #11 0x4001b713 in sipNewCppToSelf()
> > #10 0x0805ea92 in PyInstance_New()
> > #9 0x080c2da9 in PyEval_CallObjectWithKeywords()
> > #8 0x0805c3fe in PyObject_Call()
> > #7 0x080642d3 in instancemethod_call()
> > #6 0x0805c3fe in PyObject_Call()
> > #5 0x0810d125 in function_call()
> > #4 0x080c16a8 in PyEval_EvalCodeEx()
> > #3 0x08082a95 in _Py_Dealloc()
> > #2 0x0810a7c6 in frame_dealloc()
> > #1 0x08082a8a in _Py_Dealloc()
> > #0 0x08082a1e in _Py_ForgetReference()
> >
> > pkaudio: buffer thread exiting.
> > pkaudio: engine thread exiting.
> > PKSampler: All daemons stopped cleanly.
> > [40724 refs]
> > Fatal Python error: Objects/frameobject.c:403 object at 0x81ff8a4 has
> > negative ref count -1
> > WAD: Collecting debugging information...
> > WAD: Abort.
> > #14 0x08054ca1 in ?()
> > #13 0x4017390c in __libc_start_main()
> > #12 0x08054d5a in main()
> > #11 0x08055638 in Py_Main()
> > #10 0x080e5b61 in Py_Finalize()
> > #9 0x080e45ca in PyInterpreterState_Clear()
> > #8 0x080e4a9c in PyThreadState_Clear()
> > #7 0x08082a95 in _Py_Dealloc()
> > #6 0x0810a7b6 in frame_dealloc()
> > #5 0x0807ec70 in _Py_NegativeRefcount()
> > #4 0x080e838b in Py_AtExit()
> > #3 0x401885fb in __GI_abort()
> > #2 0x40187094 in __GI_raise()
> > #1 0x4003386b in __pthread_raise()
> > #0 0x401872e1 in __kill()
> >
> >
> >
> > _______________________________________________
> > PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
> > http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>
> _______________________________________________
> PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
More information about the PyQt
mailing list