#14394 closed bug (fixed)

Regression when opening file - libroot/posix/malloc exception (BPrivate::superblock::getBlock():getNumAvailable() = 0)

Reported by: smallstepforman Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/libroot.so Version: R1/Development
Keywords: malloc exception Cc: jackburton
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

I'm working on a Video Editor, and after an update to the hrev 52254, when opening media files I get an exception:

/var/lib/buildbot/workers/haiku/haiku/src/system/libroot/posix/malloc/superblock.h:171:BPrivate::block * BPrivate::superblock::getBlock(): getNumAvailable() == 0

Steps to reproduce:

  • start video editor
  • open project which imports at a couple of video files (at least 2)
  • exception thrown when opening 2nd file

Haiku Rev 52201 (2018 Aug 09) Working fine (and several older releases)

Haiku Rev 52254 (2018 Aug 20) Error when opening file

The error was introduced between hrev 52201 and 52254

Attachments (7)

screenshot1.png (321.4 KB ) - added by smallstepforman 12 months ago.
Debugger output
screenshot2.png (247.0 KB ) - added by smallstepforman 12 months ago.
LD_PRELOAD=libroot_debug.so Medo
screenshot3.png (211.1 KB ) - added by smallstepforman 12 months ago.
MALLOC_DEBUG=g LD_PRELOAD=libroot_debug.so Medo
screenshot4.png (385.4 KB ) - added by smallstepforman 12 months ago.
screenshot of terminal
screenshot5.png (201.8 KB ) - added by smallstepforman 12 months ago.
hrev 52273
IMG-5979.JPG (740.7 KB ) - added by smallstepforman 12 months ago.
KDL when video player opens JPG
hrev52299.png (734.8 KB ) - added by smallstepforman 12 months ago.
hrev52299 - fixed

Change History (23)

by smallstepforman, 12 months ago

Attachment: screenshot1.png added

Debugger output

comment:1 by waddlesplash, 12 months ago

Please try running under libroot_debug (i.e. LD_PRELOAD=libroot_debug.so path/to/app...)) and see if you get a different crash. If you don't, try further using the guarded heap (MALLOC_DEBUG=g LD_PRELOAD...).

comment:2 by waddlesplash, 12 months ago

Cc: jackburton added

Hmm, actually this might have been caused by jackburton's changes, if it is a memory violation. CC'ing him.

comment:3 by jackburton, 12 months ago

These are the commits to AVCodecDecoder.cpp and AVFormatReader.cpp within these revisions:

commit 1d404e45f1a205215f9387dd764aa74cbc205c70 (tag: hrev52222) Author: JackBurton79 <stefano.ceccherini@…> Date: Tue Aug 14 14:43:30 2018 +0200

ffmpeg plugin: use avformat/codec_free_context() where applicable

commit 3bd0b6ec8105c293cb54e1e22e201ea2cbab5d44 (tag: hrev52206) Author: Adrien Destugues <pulkomandy@…> Date: Sat Aug 11 11:59:09 2018 +0200

ffmpeg: do not compute a duration for streaming streams.

Streaming means the stream is endless, so don't compute a duration.

ffmpeg computes an estimation using what it thinks is the file size, but is instead some internal buffer size from BAdapterIO.

Fixes second part of #14326.

commit e302fe32cf4b41823a6dc153ce49f2bff70a290b Author: Barrett17 <b.vitruvio@…> Date: Sat Aug 4 11:36:34 2018 +0200

AVCodecDecoder: Rename fContext to fCodecContext

commit 334b8f3f9c2dbea74ad5f289d0114f47d816619b Author: Barrett17 <b.vitruvio@…> Date: Fri Aug 3 16:36:30 2018 +0200

ffmpeg: Remove obsolete code

commit af8f2a39a0b49397b951192f8615f8ab95c356ef (tag: hrev52212) Author: Adrien Destugues <pulkomandy@…> Date: Sun Aug 12 09:49:36 2018 +0200

ffmpeg: do not compute duration for "mutable size" streams.

Fixes #14326 without breaking other things.

comment:4 by jackburton, 12 months ago

Since most of them are just style changes or unrelated changes, you could try reverting commit 1d404e45f1a205215f9387dd764aa74cbc205c70 and try again.

comment:5 by jackburton, 12 months ago

Of course, if encoding/muxing is involved we should analyze also commits done to AVCodecEncoder.cpp and AVFormatWriter.cpp (But I guess it's not, since the ticket is about opening video files).

comment:6 by smallstepforman, 12 months ago

I've downloaded some Haiku images to help identify where the bug appeared. hrev 52219 is the last good rev, and with 52230 the problem appears. Hope this helps narrow down the culprit.

comment:7 by smallstepforman, 12 months ago

Looking at the source commit log, the error is with one the following commits:

ffmpeg plugin: use avformat/codec_free_context() where applicable hrev52222 JackBurton79 10 days -3/+3

  • AVFormatWriter: free the context with the correct function hrev52221

Alternatively, since I boot Haiku from external USB2 hard disk

usb: support for retrieving full configuration descriptorshrev52223

One of these commits produces the error.

comment:8 by jackburton, 12 months ago

Could you try with hrev52272 ?

by smallstepforman, 12 months ago

Attachment: screenshot2.png added

LD_PRELOAD=libroot_debug.so Medo

by smallstepforman, 12 months ago

Attachment: screenshot3.png added

MALLOC_DEBUG=g LD_PRELOAD=libroot_debug.so Medo

by smallstepforman, 12 months ago

Attachment: screenshot4.png added

screenshot of terminal

comment:9 by smallstepforman, 12 months ago

jackburton, I will try hrev52272 as soon as a nightly is available, or on Monday (the latest) when I connect the laptop to a wired network (sorry, no wifi support from home).

comment:10 by smallstepforman, 12 months ago

Hi JackBurton. I've just tried the latest nightly image (hrev 52273), and the error still exists. See attached screenshot. The video decoding class I have hasn't changed during the last 18 months, it has worked flawlessly up until hrev hrev 52219, and the problem started from the hrev 52230. So something between these 2 hrevs causes the problem.

by smallstepforman, 12 months ago

Attachment: screenshot5.png added

hrev 52273

by smallstepforman, 12 months ago

Attachment: IMG-5979.JPG added

KDL when video player opens JPG

comment:11 by smallstepforman, 12 months ago

This is getting frustrating. Up to revision hrev 52219, everything works fine (going back at least 18 months), But from hrev 52230 I can even get a KDL (see attachment IMG-5979.JPG, KDL in 52254) when opening an image file in my editor. Since I boot Haiku from USB2 hard disk (via XHCI interface), maybe the issue is not related to JackBurtons fixes in ffmpeg and AV layer between revs 52219 and 52230. Maybe the error is due to hrev 52223, which alters the USB stack just enough to trigger my error on USB2 hard disk.

comment:12 by waddlesplash, 12 months ago

Don't add spaces between the hrev and the number, then we get links to those commits.

comment:13 by waddlesplash, 12 months ago

I recall that KDL has its own ticket, but I can't remember which one it was. At any rate, indeed, that may be related.

comment:14 by jackburton, 12 months ago

Could you try with hrev52291 or later ? I reverted the change on AVCodecDecoder.cpp.

by smallstepforman, 12 months ago

Attachment: hrev52299.png added

hrev52299 - fixed

comment:15 by smallstepforman, 12 months ago

Thx JackBurton, fixed in hrev52299 (see attached screenshot). You can close the issue.

comment:16 by waddlesplash, 12 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.