Profile Crash

  • Thanks for the new version! The LibreElec repo now works again.

    I am just having an issue that when I create a new profile and then I switch to that profile, kodi crashes.

    I remember having this issue before and as a workaround I just created the profile in my Android TV's Kodi and then backed it up and restored it into LibreElec's Kodi, but I don't know if this is an issue from LibreElec side that can be fixed?

    Here is the log:

    https://paste.libreelec.tv/cool-pigeon.log

    I also attached the crash log.

  • Ok I was able to work with Gemini Pro and it was able to find the possible cause and a possible fix. At least the workaround it suggested works and after that I can now login to the new profile. Here is the issue report:

    Issue: [RK3566] Kodi 22 Alpha3 Segfault on Profile Switch (SQLITE_MISUSE in CTextureDatabase) on Clean Install

    Environment:

    Hardware: Pine64 Quartz64 Model A

    OS: LibreELEC (chewitt) 12.90.1 13.0

    Kernel: Linux ARM 64-bit version 7.0.0

    Kodi Version: 22.0-ALPHA3 (21.90.703)

    Description:

    Kodi suffers a hard segmentation fault when attempting to switch to a newly created profile. This occurs on a completely clean, default installation with no third-party add-ons or custom skins installed.

    When switching to the new profile, Kodi appears to fail to cleanly release or establish locks on the core .db files. The new profile attempts to initialize and cache UI textures, receives an SQLITE_MISUSE (unable to open database file) error, and immediately segfaults while attempting to log the error via dbiplus::DbErrors.

    Subsequent attempts to log into the new profile result in a continuous crash loop because the profile's Textures14.db and Thumbnails directory are left in a corrupted/incomplete state from the initial crash.

    Steps to Reproduce:

    Start with a fresh, default installation of LibreELEC.

    Go to Settings > Profiles and create a new user profile.

    Attempt to switch to or log into the newly created profile.

    Kodi immediately crashes (Segmentation fault).

    Kodi is restarted by systemd, but selecting the new profile on the login screen results in an immediate segfault every time.

    Workaround:

    Stopping the kodi service via SSH, deleting /storage/.kodi/userdata/Database/Textures14.db, and wiping the /storage/.kodi/userdata/Thumbnails/ directory resolves the crash loop and allows the new profile to initialize successfully on the next boot.

    GDB Stack Trace (from kodi_crashlog):

    Possible Fix:

    Looking at the GDB stack trace, this appears to be a two-part issue tied to the profile teardown/startup sequence:

    1. The Root Cause (Race Condition): It seems CJobManager is not fully halting background tasks (specifically CTextureCacheJob) before the profile switch de-initializes the database connections. The background thread attempts to call CTextureDatabase::AddCachedTexture on a database connection that is either closed or in the process of being moved, resulting in the SQLITE_MISUSE error.
    2. The Segfault (Invalid Pointer in Logger): When dbiplus::SqliteDataset::exec catches the misuse error, it attempts to log it via dbiplus::DbErrors::DbErrors. The segfault inside vsnprintf suggests it is being passed a NULL pointer or an invalid memory address for the error string, crashing the application entirely rather than just logging the DB failure.

    Ensuring the cache jobs are blocked/flushed before database teardown, and sanitizing the DbErrors string arguments, should resolve the crash.

  • I've moved this into its own thread as it has nothing to do with RK development.

    As this is not an LE issue you should report the problem through the Kodi issue tracker (following the issue template else it will be auto-rejected and closed). NB: In recent years Team Kodi has been mulling a complete removal of profile support and then doing a ground-up reimplementation with a better overall design; the current one has too many problems. However it's a huge amount of work and so far nobody volunteered for the task, so it remains substandard.

  • Oh ok thanks for the information! I'll investigate and try to get into the code and see what I can do. If it's too much I'll report the issue. Thanks again!