Bug 260061 - www/firefox: coredumps after several seconds in WebRTC with cubeb OSS audio backend after commit "Fix for jitter when using the cubeb OSS audio backend"
Summary: www/firefox: coredumps after several seconds in WebRTC with cubeb OSS audio b...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-26 10:41 UTC by Vladimir Druzenko
Modified: 2021-12-16 12:09 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (gecko)


Attachments
Port patch. (2.53 KB, patch)
2021-11-26 16:22 UTC, Hans Petter Selasky
no flags Details | Diff
Port patch. (1.18 KB, patch)
2021-11-26 16:23 UTC, Hans Petter Selasky
no flags Details | Diff
Port patch. (1.73 KB, patch)
2021-11-26 16:32 UTC, Hans Petter Selasky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Druzenko freebsd_committer freebsd_triage 2021-11-26 10:41:32 UTC
12.2 amd64.
Firefox 94.0.2_2,2 with cubeb OSS audio backend.

After this commit:
https://cgit.freebsd.org/ports/commit/www/firefox?id=edb5049a2a71e555ffe37c58655a0ed9825d7dff

Connect to voice channel via WebRTC for example in Discord. Work fine for 20-30-40 seconds, then tab crashed and coredump wrote to disk.
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 10:54:59 UTC
Hi,

Do you happen to have the backtrace from the coredump?

--HPS
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 11:20:43 UTC
I've reproduced the issue and will look into it.
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2021-11-26 11:30:07 UTC
(In reply to Hans Petter Selasky from comment #2)
Without debug information not so interesting:
(gdb) bt
#0  0x000000080bcb21c7 in  () at /usr/local/lib/firefox/libxul.so
#1  0x000000080bcb1ac8 in  () at /usr/local/lib/firefox/libxul.so
#2  0x000000080ba5002a in  () at /usr/local/lib/firefox/libxul.so
#3  0x000000080ba4fd1f in  () at /usr/local/lib/firefox/libxul.so
#4  0x000000080ba50c53 in  () at /usr/local/lib/firefox/libxul.so
#5  0x000000080bc82d68 in  () at /usr/local/lib/firefox/libxul.so
#6  0x000000080bc8b57b in  () at /usr/local/lib/firefox/libxul.so
#7  0x00000008094c654e in  () at /usr/local/lib/firefox/libxul.so
#8  0x00000008094b1941 in  () at /usr/local/lib/firefox/libxul.so
#9  0x00000008094b0969 in  () at /usr/local/lib/firefox/libxul.so
#10 0x00000008094c8dc7 in  () at /usr/local/lib/firefox/libxul.so
#11 0x00000008094bc206 in  () at /usr/local/lib/firefox/libxul.so
#12 0x00000008094c07b9 in  () at /usr/local/lib/firefox/libxul.so
#13 0x0000000809901e48 in  () at /usr/local/lib/firefox/libxul.so
#14 0x00000008098b92a6 in  () at /usr/local/lib/firefox/libxul.so
#15 0x000000080ba84266 in  () at /usr/local/lib/firefox/libxul.so
#16 0x000000080c8b9057 in  () at /usr/local/lib/firefox/libxul.so
#17 0x00000008098b92a6 in  () at /usr/local/lib/firefox/libxul.so
#18 0x000000080c8b8e88 in  () at /usr/local/lib/firefox/libxul.so
#19 0x0000000001046f19 in  ()
#20 0x0000000001046982 in _start ()

P.S. Compiling 94.0.2_3,2 without this patch.
Comment 4 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 11:39:53 UTC
From a first look it doesn't look related to the cubeb OSS patches.

I'm currently compiling Firefox w/ debugging to get the exact location of the crash.
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2021-11-26 11:44:40 UTC
(In reply to Hans Petter Selasky from comment #4)
But it work fine before this patch.
Comment 6 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 11:49:27 UTC
Hi,

There was a version update at the same time this patch was added.

Let's see what the debug build says.

We need this patch for OSS and it will be in upstream eventually.

This issue needs to be ironed unfortunately!

--HPS
Comment 7 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 11:50:59 UTC
BTW: I'm hselasky in Discord, if you want to test eventually.
Comment 8 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 14:19:50 UTC
Hi,

Here is the backtrace:

(gdb) bt
#0  RefPtr<mozilla::ipc::RefCountedMonitor>::operator->() const (this=0x3a6000003a700010)
    at /usr/img/freebsd.ports/www/firefox/work/.build/dist/include/mozilla/RefPtr.h:314
#1  mozilla::ipc::PortLink::OnPortStatusChanged() (this=0x8115ef440)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/glue/MessageLink.cpp:168
#2  0x000000080774fac9 in mozilla::ipc::PortLink::PortObserverThunk::OnPortStatusChanged() (this=0x815f6fea0)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/glue/MessageLink.cpp:47
#3  0x00000008077419ff in mozilla::ipc::NodeController::PortStatusChanged(mojo::core::ports::PortRef const&)
    (this=0x81181a100, aPortRef=...) at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/glue/NodeController.cpp:347
#4  0x00000008076dcf8d in mojo::core::ports::Node::OnUserMessage(mozilla::UniquePtr<mojo::core::ports::UserMessageEvent, mozilla::DefaultDelete<mojo::core::ports::UserMessageEvent> >) (this=<optimized out>, message=...)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/mojo/core/ports/node.cc:574
#5  0x00000008076dc484 in mojo::core::ports::Node::AcceptEvent(mozilla::UniquePtr<mojo::core::ports::Event, mozilla::DefaultDelete<mojo::core::ports::Event> >) (this=0x8115ef440, event=...)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/mojo/core/ports/node.cc:409
#6  0x0000000807742279 in mozilla::ipc::NodeController::OnEventMessage(mojo::core::ports::NodeName const&, mozilla::UniquePtr<IPC::Message, mozilla::DefaultDelete<IPC::Message> >) (this=<optimized out>, aFromNode=..., aMessage=...)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/glue/NodeController.cpp:402
#7  0x000000080773e536 in mozilla::ipc::NodeChannel::OnMessageReceived(IPC::Message&&) (this=<optimized out>, aMessage=...)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/glue/NodeChannel.cpp:260
#8  0x00000008076cdb3b in IPC::Channel::ChannelImpl::ProcessIncomingMessages() (this=this@entry=0x81181c000)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/chrome/common/ipc_channel_posix.cc:553
#9  0x00000008076ce7ef in IPC::Channel::ChannelImpl::OnFileCanReadWithoutBlocking(int) (this=0x81181c000, fd=5)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/chrome/common/ipc_channel_posix.cc:822
#10 0x00000008076b3d18 in base::MessagePumpLibevent::OnLibeventNotification(int, short, void*)
    (fd=3, flags=2, context=0x81181c000)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/base/message_pump_libevent.cc:249
#11 0x00000008110f62b1 in  () at /usr/local/lib/libevent-2.1.so.7
#12 0x00000008110f209c in event_base_loop () at /usr/local/lib/libevent-2.1.so.7
#13 0x00000008076b43e3 in base::MessagePumpLibevent::Run(base::MessagePump::Delegate*)
--Type <RET> for more, q to quit, c to continue without paging--
    (this=0x811808000, delegate=0x7fffdfffde28)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/base/message_pump_libevent.cc:353
#14 0x00000008076b0b45 in MessageLoop::RunHandler() (this=0x8115ef440)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/base/message_loop.cc:324
#15 MessageLoop::Run() (this=0x8115ef440)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/base/message_loop.cc:306
#16 0x00000008076c90ed in base::Thread::ThreadMain() (this=0x8039bbdc0)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/base/thread.cc:187
#17 0x00000008076bbd5a in ThreadFunc(void*) (closure=0x8115ef440)
    at /usr/img/freebsd.ports/www/firefox/work/firefox-94.0.2/ipc/chromium/src/base/platform_thread_posix.cc:40
#18 0x000000080129100c in thread_start (curthread=0x8016df200) at /usr/img/freebsd.12/lib/libthr/thread/thr_create.c:292
#19 0x0000000000000000 in  ()
Comment 9 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 15:28:49 UTC
/usr/img/freebsd.ports/www/firefox/work/.build/dist/include/mozilla/RefPtr.h:314

  T* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN {
    MOZ_ASSERT(mRawPtr != nullptr,
               "You can't dereference a NULL RefPtr with operator->().");
^^^
    return get();
  }
Comment 10 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 15:36:01 UTC
I can also confirm that reverting the cubeb OSS patch "fixes" the issue.

--HPS
Comment 11 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 16:22:32 UTC
Created attachment 229742 [details]
Port patch.

Does this patch fix the issue?
Comment 12 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 16:23:31 UTC
Created attachment 229743 [details]
Port patch.

Now correct patch.
Comment 13 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 16:32:26 UTC
Created attachment 229744 [details]
Port patch.

One more time. Fixed patch metadata.
Comment 14 commit-hook freebsd_committer freebsd_triage 2021-11-26 17:08:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2504309ac5764c583a6c78aebc95caf0983771b2

commit 2504309ac5764c583a6c78aebc95caf0983771b2
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-11-26 17:04:20 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-11-26 17:05:58 +0000

    www/firefox: Revert "Fix for jitter when using the cubeb OSS audio backend."

    This reverts commit edb5049a2a71e555ffe37c58655a0ed9825d7dff until a proper
    solution is found.

    PR:          260061
    Approved by: pi (implicit)

 www/firefox/Makefile                               |   2 +-
 .../patch-media_libcubeb_src_cubeb__oss.c (gone)   | 341 ---------------------
 2 files changed, 1 insertion(+), 342 deletions(-)
Comment 15 Hans Petter Selasky freebsd_committer freebsd_triage 2021-11-26 19:49:10 UTC
Closing issue for now.
Comment 16 commit-hook freebsd_committer freebsd_triage 2021-12-16 12:07:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=abed228812efb91cc436eb0a6d750803396fc43c

commit abed228812efb91cc436eb0a6d750803396fc43c
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-11-24 10:11:34 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-12-16 12:04:49 +0000

    www/firefox: Fix for jitter when using the cubeb OSS audio backend.

    Cherry-pick the following five changes from Mozilla's cubeb.git:
    b690782c19728ee7a5675237b0b30249f4e1bf5e
    8da61ef32d386ffd5f00f025578d4429523ca45b
    1099a3007817fa34c1f91e4710ec046021147bed
    5b0b7f6bf7c7a874abcb31de8dd386f147bab539
    773f16b7ea308392c05be3e290163d1f636e6024

    The need for this patch will eventually go away.

    PR:             260061
    Discussed with: jbeich@ and khng@
    Obtained from:  https://github.com/mozilla/cubeb.git
    Approved by: pi (implicit)

 www/firefox/Makefile                               |   2 +-
 .../patch-media_libcubeb_src_cubeb__oss.c (new)    | 365 +++++++++++++++++++++
 2 files changed, 366 insertions(+), 1 deletion(-)
Comment 17 Hans Petter Selasky freebsd_committer freebsd_triage 2021-12-16 12:09:27 UTC
I hope the new patch will not cause any problems. Tested over here for a long time in various use-cases.

--HPS