https://bugs.kde.org/show_bug.cgi?id=368907

--- Comment #38 from Mauro Carvalho Chehab <mchehab+...@kernel.org> ---
Created attachment 106506
  --> https://bugs.kde.org/attachment.cgi?id=106506&action=edit
Disable notifier if no data

(In reply to Jan Palus from comment #36)
> Looks like it's still the same, but I'm not really sure whether we are on
> the same page -- writeToPipe() is not looping. It is rather called a lot
> once the bug is triggered. I've made following small adjustment to its code:
> 
>  void DvbLiveViewInternal::writeToPipe()
>  {
> +  static int notEmptyCnt = 0;
> +  static int emptyCnt = 0;
> +  if (buffers.isEmpty()) {
> +    ++emptyCnt;
> +  } else {
> +    ++notEmptyCnt;
> +  }
> +    printf("empty: %d, not empty: %d\n", emptyCnt, notEmptyCnt);
>       while (!buffers.isEmpty()) {
>               const QByteArray &currentBuffer = buffers.at(0);
>               int bytesWritten = int(write(writeFd, currentBuffer.constData(),
> currentBuffer.size()));
> 
> That's output after 10 seconds "without bug":
> 
> empty: 0, not empty: 614
> 
> Now after bug is triggered empty counter skyrockets to some crazy value
> after 10 secs (and continues which is most probably the cause of high CPU
> usage):
> 
> empty: 5053133, not empty: 534
> 
> as if notifications about pipe being ready for writing were suddenly coming
> very very frequently

Ah, OK. Well, I guess all we need to do is to disable the notifier to solve
this issue. Still, I think that the first patch will make it more reliable.

Please test with both the previous patch and this one.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to