Opened 5 years ago

Closed 2 years ago

#10898 closed bug (fixed)

[package_daemon] crash in Volume::HandleGetLocationInfoRequest()

Reported by: diver Owned by: bonefish
Priority: normal Milestone: R1
Component: Servers/package_daemon Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #11327, #12232, #13539
Has a Patch: yes Platform: All

Description

hrev47310, gcc2hybrid.

The crash happened after I have updated the system with pkgman update and started HaikuDepot.

Attachments (5)

package_daemon-197-debug-04-06-2014-17-52-59.report (24.8 KB) - added by diver 5 years ago.
package_daemon-416-debug-29-12-2014-20-19-25.report (25.7 KB) - added by puckipedia 5 years ago.
puckipedia - report
puckipedia_log (17.7 KB) - added by puckipedia 5 years ago.
puckipedia - logs of the currently active packages and uninstalled / installed packages
package_daemon-493-debug-16-01-2017-19-24-37.report (25.4 KB) - added by Premislaus 3 years ago.
Crash after pkgman finished update.
0001-package_daemon-fix-crash-on-system-update.patch (846 bytes) - added by throttle10 2 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 5 years ago by diver

Happened again in hrev47531. Also after pkgman update.

comment:2 Changed 5 years ago by diver

Happened again after pkgman update in hrev47748.

comment:3 Changed 5 years ago by diver

Blocking: 11327 added

Changed 5 years ago by puckipedia

puckipedia - report

Changed 5 years ago by puckipedia

Attachment: puckipedia_log added

puckipedia - logs of the currently active packages and uninstalled / installed packages

comment:4 Changed 5 years ago by puckipedia

Happend to me too, from hrev48541 to hrev48584. Added report + some logs.

comment:5 Changed 4 years ago by diver

Blocking: 12232 added

Changed 3 years ago by Premislaus

Crash after pkgman finished update.

comment:6 Changed 2 years ago by diver

Blocking: 13539 added

comment:7 Changed 2 years ago by throttle10

Has a Patch: set

comment:8 Changed 2 years ago by pulkomandy

I'm a bit confused by this patch. Maybe you could explain why it fixes the problem?

  • If isActive is true, we will get state == fActiveState when we get to the changed lines. If there is also fLatestState == fActiveState as your patch tests, then the operation results in no change for the latest package (fLatestState == state by transitivity). So, the whole operation should be skipped (no change count, no notification).
  • If isActive is false, it means the active state is unchanged, and the latest is being replaced. If the latest was the same as the active, then we can get into a problem (we will delete the active state while it is still referenced).

Being unfamiliar with the code, I don't know if such a situation is expected (latest state changes from "same as active" to "different from active", but active state remains the same). What are the circumstances that lead to this happening?

I find the code a bit hard to follow with all these conditions. Maybe I'm just a little tired today, however.

Overall, +1, but I'd appreciate additional explanations on what is going on (in ticket comments is ok - no need to update the patch itself)

comment:9 in reply to:  8 Changed 2 years ago by throttle10

This is the problem:

  • If isActive is false, it means the active state is unchanged, and the latest is being replaced. If the latest was the same as the active, then we can get into a problem (we will delete the active state while it is still referenced).

If we update system packages, isActive = false. package_daemon deletes fLatestState. If fActiveState == fLatestState, fActiveState = NULL. Next time iterating volume, package_daemon crashing, because it uses fActiveState for iterating volume (start HaikuDepot).

If we restart package_daemon, or reboot haiku, it's not reproduced.

And something more: if package_daemon uses fActiveState (!= fLatestState) before restart, maybe, updating, installing new packages useless. Need to check it..

P.S. sorry for my bad english.

Last edited 2 years ago by throttle10 (previous) (diff)

comment:10 Changed 2 years ago by throttle10

And something more: if package_daemon uses fActiveState (!= fLatestState) before restart, maybe, updating, installing new packages useless. Need to check it..

Looks like everything is good. After reboot new installed package exists.

comment:11 Changed 2 years ago by axeld

Patch looks good to me.

comment:12 Changed 2 years ago by waddlesplash

Resolution: fixed
Status: newclosed

Applied in hrev51233. Thanks!

Note: See TracTickets for help on using tickets.