Open Bug 1957897 Opened 1 year ago Updated 1 year ago

static_assert(sizeof(*this) <= 512, "Exceeded expected size class") in ipc_channel_posix.cc fails if I undefine MOZ_CALLSTACK_DISABLED in BlockingResourceBase.h

Categories

(Core :: XPCOM, task)

task

Tracking

()

People

(Reporter: ishikawa, Unassigned)

Details

I am trying to fix TSAN issues in mozilla/comm/mailnews/imap/src/nsImapProtocol.cpp. Bug 1956408
It turns out that there are more issues than meets the eye initially.

So I wanted to enable the stack trace feature of monitor deadlock detection by undefining |MOZ_CALLSTTACK_DISABLED| in
https://searchfox.org/comm-central/source/mozilla/xpcom/threads/BlockingResourceBase.h#22

// NB: Comment this out to enable callstack tracking.
#  define MOZ_CALLSTACK_DISABLED

To my surprise, the local compilation failed due to the static_assert failure in
https://searchfox.org/comm-central/source/mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc#145

static_assert(sizeof(*this) <= 512, "Exceeded expected size class");

Obviously |sizeof(*this)| becomes larger than 512 with the additional array for storing stack info.

I can certainly increase 512 to 1024, etc. to get the compilation done, but I am not sure if that is the correct approach.

I can probably get the build done by decreasing the number 24 on the following line to something smaller.
https://searchfox.org/comm-central/source/mozilla/xpcom/threads/BlockingResourceBase.h#108

 static size_t const kAcquisitionStateStackSize = 24;

But that may not be quite useful for the purpose of figuring out where a monitor is entered twice (and finding the original entry point).

Any thought?

Has anyone compiled in the stack trace feature lately as a starter?

I forgot.
This is on linux.
I am using GCC gcc-14/g++-14 to compile C-C TB.
The exact error line I get is:

In file included from Unified_cpp_ipc_chromium1.cpp:74:
/NEW-SSD/NREF-COMM-CENTRAL/mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc: In member function ‘void IPC::Channel::ChannelImpl::Init(IPC::Channel::Mode)’:
/NEW-SSD/NREF-COMM-CENTRAL/mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc:146:31: error: static assertion failed: Exceeded expected size class
  146 |   static_assert(sizeof(*this) <= 512, "Exceeded expected size class");
      |                 ~~~~~~~~~~~~~~^~~~~~
/NEW-SSD/NREF-COMM-CENTRAL/mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc:146:31: note: the comparison reduces to ‘(736 <= 512)

The severity field is not set for this bug.
:nika, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(nika)

That assertion is just about not wanting to waste space, so the easiest workaround here would be to comment it out.

Type: defect → task
Flags: needinfo?(nika)
Summary: static_assert(sizeof(*this) <= 512, "Exceeded expected size class") in ipc_channel_posix.cc fails if I undefine MOZ_CALLSTACK_DISABLED in BlockingReesourceBase.h → static_assert(sizeof(*this) <= 512, "Exceeded expected size class") in ipc_channel_posix.cc fails if I undefine MOZ_CALLSTACK_DISABLED in BlockingResourceBase.h
You need to log in before you can comment on or make changes to this bug.