<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Mar 24, 2018 at 12:42 PM, <span id="m_5532476575628918290:1ja.1">Tanu</span> <span id="m_5532476575628918290:1ja.2">Kaskinen</span> <span dir="ltr"><<a href="mailto:tanuk@iki.fi" target="_blank"><span id="m_5532476575628918290:1ja.3">tanuk</span>@<span id="m_5532476575628918290:1ja.4">iki</span>.<span id="m_5532476575628918290:1ja.5">fi</span></a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Fri, 2018-03-23 at 15:38 -0300, wellington wallace wrote:<br>
> Hi! PulseEffects developer here.<br>
><br>
> Every now and then when my applications starts it crashes with:<br>
><br>
> Assertion '!e->next' failed at pulsecore/queue.c:104, function<br>
> pa_queue_pop(). Aborting.<br>
><br>
> This error is one of those that almost never happens and when it does it<br>
> has no obvious reason. What could be causing this? As I am talking to<br>
> Pulseaudio from Python it is possible I am doing something wrong in this<br>
> communication. But as this error means nothing to me I don't know where to<br>
> look.<br>
<br>
</span>I don't recall seeing this specific error, but a low-level data<br>
structure corruption suggests a concurrency bug. If your application<br>
were a C program, it should not access pa_mainloop, pa_context,<br>
pa_stream etc. objects from multiple threads, unless locking is<br>
appropriately implemented with pa_threaded_mainloop. I'm not familiar<br>
with the Python bindings, so I'm not sure how helpful this is to you.<br>
Does your application have multiple threads? It could also be that the<br>
Python bindings are buggy.<br>
<span class="m_5532476575628918290HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Hi <span id="m_5532476575628918290:1ja.6">Tanu</span>,</div><div><br></div><div>I wrote the python bindings I am using in <span id="m_5532476575628918290:1ja.7">PulseEffects</span>. Although I doubt they are perfect I think your point about the wrong use of multiple threads is probably the source of the problem. Last night I was reading <span id="m_5532476575628918290:1ja.8">Pulseaudio</span> api guide again and I realized I was doing something wrong when waiting for operations completion. For some reason I was doing:</div><div><br></div>while (pa_operation_get_state(o) == PA_OPERATION_RUNNING):</div><div class="gmail_quote">        pass</div><div class="gmail_quote"><br></div><div class="gmail_quote">instead of</div><div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_quote" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">while (pa_operation_get_state(o) == PA_OPERATION_RUNNING):</div><div class="gmail_quote" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">        <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">pa_threaded_</span><span id="m_5532476575628918290gmail-:1ja.10" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">mainloop</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">_wait(<wbr>main_loop)</span></div><br></div><div class="gmail_quote">and the lock/unlock mechanism explained in the docs. I use pa_operation_get_state when waiting for the null sinks to be loaded. Every now and then PulseEffects got stuck when waiting for these sinks. Maybe both problems have my api misuse as source.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Changing a little of subject. What would be the proper way to show the user the current latency-time and buffer-time of sink inputs?  Right now I am updating these values when there is a "change event" on the sink inputs. But I noticed that changes in latency or buffer does not trigger this signal like volume or cork state changes do. </div><div class="gmail_quote"><br></div><div class="gmail_quote">Best regards,</div><div class="gmail_quote"><br></div><div class="gmail_quote">                  Wellington <br></div><div class="gmail_quote"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"></span></div><div><br></div>-- <br><div class="m_5532476575628918290gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Prof.° Wellington Wallace Miguel <span id="m_5532476575628918290:1ja.11">Melo</span><br><br><div><span id="m_5532476575628918290:1ja.12">CEFET</span>/<span id="m_5532476575628918290:1ja.13">RJ</span> <span id="m_5532476575628918290:1ja.14">Uned</span> Nova <span id="m_5532476575628918290:1ja.15">Iguaçu</span><br><br></div></div></div>
</div></div>