Opened 5 years ago

Closed 4 years ago

#11982 closed bug (fixed)

[Tracker] crashes in BCompressionAlgorithm::BAbstractInputStream::Read

Reported by: vidrep Owned by: waddlesplash
Priority: normal Milestone: R1/beta1
Component: Applications/Tracker Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #12039, #12264
Has a Patch: no Platform: All

Description

hrev49046 x86_gcc2 I was navigating the folders on an old BeOS R5 installation CD when the tracker crashed. Attached is a debug report and syslog.

Attachments (8)

Tracker-485-debug-17-04-2015-15-27-01.report (24.4 KB ) - added by vidrep 5 years ago.
syslog (65.9 KB ) - added by vidrep 5 years ago.
Tracker-486-debug-29-05-2015-11-29-30.report (11.4 KB ) - added by vidrep 4 years ago.
syslog.2 (89.7 KB ) - added by vidrep 4 years ago.
previous_syslog (124.0 KB ) - added by vidrep 4 years ago.
StyledEdit-1058-debug-29-05-2015-21-26-49.report (14.3 KB ) - added by Janus 4 years ago.
Tracker-492-debug-23-08-2015-23-00-51.report (84.3 KB ) - added by vidrep 4 years ago.
Tracker-492-debug-23-08-2015-23-01-22.report (84.4 KB ) - added by vidrep 4 years ago.

Download all attachments as: .zip

Change History (30)

by vidrep, 5 years ago

Attachment: syslog added

comment:1 by anevilyak, 5 years ago

Is this by any chance reproducible? If so, can you narrow it down to e.g. a particular folder on the CD?

comment:2 by vidrep, 5 years ago

At the time I was looking for the sample movies. You know the ones...where the Be employees are throwing their monitors off the roof. I'll try to see if the error is reproducible and report back later.

comment:3 by diver, 5 years ago

Summary: Tracker crash while navigating CDROM[Tracker] crashes in BCompressionAlgorithm::BAbstractInputStream::Read

comment:4 by diver, 5 years ago

Blocking: 12039 added

comment:5 by diver, 4 years ago

Milestone: UnscheduledR1/beta1

Happens too often. Should be fixed before beta.

comment:6 by vidrep, 4 years ago

Updated to hrev49210 x86_gcc2, using "pkgman full-sync". After reboot CPU showing 100% and no mouse function. After 6 reboots, finally got "normal" Desktop with functional mouse and keyboard, but then tracker crashed. Relaunched Tracker from Team Monitor, but it crashed 2 more times. Previously it was only crashing when navigating a CD, but now is crashing after booting. I have attached all three debug reports in case they might provide a clue as to the problem.

comment:7 by vidrep, 4 years ago

Attached syslog as well just in case it can provide useful information.

by vidrep, 4 years ago

Attachment: syslog.2 added

by vidrep, 4 years ago

Attachment: previous_syslog added

comment:8 by Janus, 4 years ago

It is reproducible in the Terminal with

StyledEdit /boot/home/Desk/fakefile

It is almost systematic.

comment:9 by diver, 4 years ago

Blocking: 11971 added

comment:10 by waddlesplash, 4 years ago

Owner: changed from axeld to waddlesplash
Status: newin-progress

Compiling libbe in debug mode stops the problem from happening :/ Trying a single-file debug info next.

comment:11 by waddlesplash, 4 years ago

Blocking: 11971 removed

(In #11971) @Diver, no, these are two separate tickets. Read the entire ticket history again.

comment:12 by waddlesplash, 4 years ago

Actually, this is really weird. The problem doesn't happen with any libbe except for the system's libbe, and I'm compiling the same hrev that the system libbe is on...

comment:13 by waddlesplash, 4 years ago

OK, scratch that. It's actually a race condition of some sort, and I was triggering it in a slightly different way. I can actually reproduce it (but it's going to be really hard to get it into Debugger like this...)

comment:14 by waddlesplash, 4 years ago

I managed to crash it there, but for some reason Debugger isn't saving the crash report with the debug information, so there's no source in it ... ? Anyway, the crash is occuring on this line. fInput has a value that looks real, but upon further inspection, appears to either be deleted or never initialized.

I see no reason in that thread that indicates this is a race condition, but looking at the main thread, it appears that the main thread is in the cleanup sections just before quitting. Since the crashed thread is the add poses thread (from a BFilePanel instance), it's very likely the BFilePanel this thread was for has been deleted, and thus this is really a use-after-free.

Nothing in the parameters / used variables of BAbstractInputStream look wrong, so this is the fault of Tracker's AddPosesTask for not stopping the thread when the object was deleted. Looking at Tracker's PoseView.cpp, the addPosesThread is started but never stopped, which confirms this.

I'm not sure what the correct solution is from here, though. How should the addPosesThread know to stop?

comment:15 by waddlesplash, 4 years ago

Blocking: 12264 added

comment:16 by pulkomandy, 4 years ago

The addPosesThread locks a BMessenger at each iteration, and if that fails, throws an exception that makes it exit the loop. However, this only works if the PoseView is destructed with the looper locked. That would make sure the thread stops running before the destruction starts. This should probably be done where the PoseView destructor is called, probably inside the window destructor?

in reply to:  16 comment:17 by anevilyak, 4 years ago

Replying to pulkomandy:

The addPosesThread locks a BMessenger at each iteration, and if that fails, throws an exception that makes it exit the loop. However, this only works if the PoseView is destructed with the looper locked. That would make sure the thread stops running before the destruction starts. This should probably be done where the PoseView destructor is called, probably inside the window destructor?

I don't see the problem with the mentioned code. All calls that it makes to the PoseView itself occur while it holds the lock, during which it shouldn't be possible for the view to be removed/destroyed, as that's normally only done on a directory switch or window close, both of which by definition happen with the looper locked, as they're done in the message loop. If someone's deleting the view without locking the looper, then that's a bigger problem, but has nothing to do with the AddPoses thread.

comment:18 by mmlr, 4 years ago

See #12072. I'm pretty sure these are caused the same regression. I am still unsure how to best fix the issue described there. Ideally the container would be a BReferenceable, but since it inherits from public classes, retrofitting that isn't really practical.

comment:19 by mmlr, 4 years ago

The first and last stack trace look like #12072 and would be fixed in hrev49526. I'm not sure what to make of the other stack traces though.

comment:20 by vidrep, 4 years ago

Tracker crashed again today with hrev49573 x86_gcc2. Open directory (all zip files) Window->select all File->Get Info Crash two times before I could restart Desktop from Team Monitor. 2 debug reports attached

comment:21 by waddlesplash, 4 years ago

Totally unrelated. Please file a new ticket.

comment:22 by diver, 4 years ago

Resolution: fixed
Status: in-progressclosed

Also for the crash in attachment:Tracker-486-debug-29-05-2015-11-29-30.report​. The current one is fixed.

Note: See TracTickets for help on using tickets.