[GSoC 2024] Fixing the crashing | Haiku Project

Alright, I have the fix! Turns out the run loop was failing to process some messages.

Here’s the rabbit trail that I had to follow to figure out the problem. No, debugging is fortunately not usually this long and complicated. Feel free to skim it, since it’s probably very difficult to actually understand.

  • Website is not drawn on screen
  • Because BackingStore::incorporateUpdate is unimplemented
  • Because SharedMemory::map is not implemented correctly
  • Because it isn’t called from anywhere
  • Because ShareableBitmap::create(Handle&&, SharedMemory::Protection) isn’t called from anywhere
  • Because BackingStore::incorporateUpdate isn’t called
  • Because DrawingAreaProxyCoordinatedGraphics::update isn’t called
  • Because Messages::DrawingAreaProxy::Update is never sent
  • Because DrawingArea::display isn’t called
  • Because DrawingAreaCoordinatedGraphics::displayTimerFired isn’t called
  • Because DrawingAreaCoordinatedGraphics is never constructed
  • Because DrawingArea::create isn’t called
  • Because WebPage::WebPage isn’t called
  • Because WebProcess::createWebPage isn’t called
  • Because Messages::WebProcess::CreateWebPage is never received
  • Because Connection::dispatchMessage is not receiving the message
  • Because WebProcess is stuck waiting for a network process connection
  • Because Messages::WebProcessProxy::GetNetworkProcessConnection is not being processed
  • Because the ‘loop’ message is never sent to MiniBrowser.
  • Because it was perceived to already be processing incoming messages, so no attempt at waking it up was made
  • Because m_handler->Looper() is null
  • Because the handler needs to be attached during RunLoop’s construction.

Now imagine if a compiler could just give you a stack trace like that at the very beginning? First line is the symptom, middle lines narrow down why the symptom is happening, and the last line states the bug that needs to be fixed.

Now, with that fixed, I see what @PulkoMandy meant by saying that IPC needs to be fixed. Now that the messages are flowing, I see that the current implementation of IPC has some problems with creating a connection between the NetworkProcess and WebProcess, among perhaps other things. To address these bugs, I’ll probably need to address how I will fundamentally approach message passing, whether with BLoopers, ports, or UNIX domain sockets. I’ll be writing a blog post with more details, once I figure out exactly what the problem is and what some ways of approaching it are.

25 Likes