Komet / MediaElch

Media Manager for Kodi
https://mediaelch.github.io/mediaelch-doc/about.html
GNU Lesser General Public License v3.0
842 stars 94 forks source link

Movie Scanning Does not work | MediaElch freezes #1326

Closed nkatsidis closed 3 years ago

nkatsidis commented 3 years ago

Windows 10.. Downloaded latest 2.8.12 latest and 2.8.13

My movies are on network.. When i run Mediaelch movie window is blank. Trying to do a new scan but program crashed...

Bitsauger commented 3 years ago

On Linux via App-image 2.8.12 the same... the same behaviour as 2.8.10 before.

The Movies are on a Network Share, by pressing "Filme neu laden" the App crashed. maybe the Title could be changed, not only for Windows.

nkatsidis commented 3 years ago

i must update my report...

i left mediaelch running... and although it displayed Program not responding in Windows.. Scanning was completed normally .....

but ofc this requires fixing :)

bugwelle commented 3 years ago

Hi,

thank you for reporting this issue.

@nkatsidis How long does it normally take for MediaElch to finish scraping your movies?

@Bitsauger Does MediaElch really crash, i.e. the app closes, or does it just not respond?

In v2.8.12 I fixed a crash in MediaElch. However, that also had the side effect that MediaElch may not seem responding.
Please let me know whether MediaElch really crashes or just not responds. In the latter case, I know how I could fix it. In the former, I need more information.

Bitsauger commented 3 years ago

@bugwelle

I loaded the Appimage and started again. Now after a short Freeze it worked as it should. The problem is that not all Network shares were mounted and it looks like the App stops working. See Picture.

When all Shares are connected it works faster... but on 2.8.6 there was no freeze or notification, if not all shares were connect.

(I have more than one share with Movies, so when for example only one is mounted, the following message will appear.)

me

bugwelle commented 3 years ago

The problem is that not all Network shares were mounted and it looks like the App stops working.

Thanks. That may help to debug this issue.

bugwelle commented 3 years ago

Hi,

I've prepared a possible fix in #1331.

Could you please test this version?

It isn't faster than the current version, but MediaElch should not freeze anymore.

Please let me know if:

Thanks.


@bell07 You helped to debug a crash in v2.8.8 and v2.8.10. Could you test #1331, please? :-) I tested it on macOS and Kubuntu 20.04 with ASAN enabled. No crash, no freezing, etc. If it works for you, then I'm sure that I haven't missed (yet another) race condition.

Regards,

Andre

bell07 commented 3 years ago

Tried the 3064aea9aa14e05721a7b1aad6f684cd814dfb84 with your file-searcher branch. MediaElch is hanging on start with never ending File scanner popup "Searching for movies...(1/2)" Full console output is:

2021-05-16 20:27:05.401 DEBUG [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/settings/AdvancedSettingsXmlReader.cpp:23] | Loading advanced settings from: FilePath("/home/user/.local/share/kvibes/MediaElch/advancedsettings.xml")
2021-05-16 20:27:05.403  WARN [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/settings/AdvancedSettingsXmlReader.cpp:33] | [AdvancedSettings] advancedsettings.xml not found at  "/home/user/.local/share/kvibes/MediaElch/advancedsettings.xml"
2021-05-16 20:27:05.403 DEBUG [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/settings/Settings.cpp:82] | Advanced settings:
    locale:                  German (Germany)
    debugLog:                false
    logFile:                 
    forceCache:              false
    stylesheet:              <bundled>
    sortTokens:              Der, Die, Das, The, Le, La, Les, Un, Une, Des
    movieFilters:            *.mkv, *.mk3d, *.avi, *.mpg, *.mpeg, *.mp4, *.m2ts, *.disc, *.m4v, *.strm, *.dat, *.flv, *.vob, *.ts, *.iso, *.ogg, *.ogm, *.rmvb, *.img, *.wmv, *.mov, *.divx, VIDEO_TS.IFO, *.webm, index.bdmv, *.wtv
    concertFilters:          *.mkv, *.mk3d, *.avi, *.mpg, *.mpeg, *.mp4, *.m2ts, *.disc, *.m4v, *.strm, *.dat, *.flv, *.vob, *.ts, *.iso, *.ogg, *.ogm, *.rmvb, *.img, *.wmv, *.mov, *.divx, VIDEO_TS.IFO, *.webm, index.bdmv, *.wtv
    tvShowFilters:           *.mkv, *.mk3d, *.avi, *.mpg, *.mpeg, *.mp4, *.m2ts, *.disc, *.m4v, *.strm, *.dat, *.flv, *.vob, *.ts, *.iso, *.ogg, *.ogm, *.rmvb, *.img, *.wmv, *.mov, *.divx, VIDEO_TS.IFO, *.webm, index.bdmv, *.wtv
    subtitleFilters:         *.idx, *.sub, *.srr, *.srt, *.ass, *.ttml
    genreMappings:           
    audioCodecMappings:      
        aac lc: aac
        mpa1l2: mp2
        mpa1l3: mp3
    videoCodecMappings:      
        avc: h264
        v_mpeg4/iso/avc: h264
    certificationMappings:   
    studioMappings:          
    countryMappings:         
    writeThumbUrlsToNfo:     true
    episodeThumb dimensions: 
        width:               400
        height:              300
    bookletCut:              2
    useFirstStudioOnly:      false
    exclude patterns:        

2021-05-16 20:27:05.435  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/globals/ScraperManager.cpp:139] | [TvScraper] Initializing "TMDb TV"
2021-05-16 20:27:05.436  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/globals/ScraperManager.cpp:139] | [TvScraper] Initializing "TheTvDb"
2021-05-16 20:27:05.436  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/globals/ScraperManager.cpp:139] | [TvScraper] Initializing "IMDb TV"
2021-05-16 20:27:05.436  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/globals/ScraperManager.cpp:139] | [TvScraper] Initializing "TVmaze"
2021-05-16 20:27:06.532  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/ui/imports/DownloadsWidget.cpp:83] | [DownloadsWidget] Start scanning for imports/downloads. Start Timer.
2021-05-16 20:27:07.025  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/ui/main/MainWindow.cpp:76] | MediaElch version "2.8.13-dev" starting up
2021-05-16 20:27:07.459  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/globals/ScraperManager.cpp:142] | [TvScraper] Initialized: "IMDb TV"
2021-05-16 20:27:07.465  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/ui/imports/DownloadsWidget.cpp:474] | [DownloadsWidget] Scanning for imports/downloads took: 933 ms
2021-05-16 20:27:07.465  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/ui/imports/DownloadsWidget.cpp:492] | [DownloadsWidget] Updating imports/downloads lists: 0 ms
2021-05-16 20:27:07.470 DEBUG [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/tv_shows/TvShowFileSearcher.cpp:40] | [TvShowFileSearcher] Adding TV show directory "/home/user/Videos/Serien"
2021-05-16 20:27:07.764  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/movies/file_searcher/MovieFileSearcher.cpp:55] | [Movies] Start reloading movies from cache
2021-05-16 20:27:07.765 DEBUG [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/scrapers/concert/tmdb/TmdbConcert.cpp:314] | TMDb base url: "http://image.tmdb.org/t/p/"
2021-05-16 20:27:07.766  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/globals/ScraperManager.cpp:142] | [TvScraper] Initialized: "TMDb TV"
2021-05-16 20:27:07.966 DEBUG [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/scrapers/tv_show/thetvdb/TheTvDbApi.cpp:51] | [TheTvDbApi] Received JSON web token
2021-05-16 20:27:07.966  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/globals/ScraperManager.cpp:142] | [TvScraper] Initialized: "TheTvDb"
bugwelle commented 3 years ago

Thank you very much! This helps a lot. I'm a bit surprised that nothing happens. Maybe a deadlock or an issue with signals/slots. But at least no crash 😅

Can you abort the file searcher? (escape key)

How many hardware threads does your CPU have? :)

bell07 commented 3 years ago

I can stop the searcher using escape key, but get the same issue if I click to reload:

2021-05-16 21:11:11.669  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/movies/file_searcher/MovieFileSearcher.cpp:55] | [Movies] Start reloading movies from disk
2021-05-16 21:11:11.674  INFO [/var/tmp/portage/media-video/mediaelch-9999/work/mediaelch-9999/src/movies/file_searcher/MovieDirectorySearcher.cpp:70] | [Movie] Scanning directory: "/home/user/Videos/Filme"

Tested on AMD A8-7600 Radeon R with 4 cores without Hyper-Threading.

Maybe interessting, if I leave the Mediaelch, I get the next messages: ``` ==12836==ERROR: LeakSanitizer: detected memory leaks Indirect leak of 352 byte(s) in 4 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a6ff78 in QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) (/usr/lib64/libQt5Core.so.5+0x26ff78) Indirect leak of 311 byte(s) in 5 object(s) allocated from: #0 0x7f62399545ff in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xac5ff) #1 0x7f62368d2190 in QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags) (/usr/lib64/libQt5Core.so.5+0xd2190) Indirect leak of 160 byte(s) in 1 object(s) allocated from: #0 0x7f62399545ff in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xac5ff) #1 0x7f6236a6d94c in QObjectPrivate::addConnection(int, QObjectPrivate::Connection*) (/usr/lib64/libQt5Core.so.5+0x26d94c) Indirect leak of 152 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f62369a4012 in QDir::QDir(QString const&) (/usr/lib64/libQt5Core.so.5+0x1a4012) #2 0x7f62384a75e2 (/usr/lib64/liblibmediaelch.so+0x11175e2) #3 0x7f62384a82b3 in DirectorySettings::loadSettings() (/usr/lib64/liblibmediaelch.so+0x11182b3) #4 0x7f62384badf1 in Settings::loadSettings() (/usr/lib64/liblibmediaelch.so+0x112adf1) #5 0x7f6238ab63c9 in SettingsWindow::loadSettings() (/usr/lib64/liblibmediaelch.so+0x17263c9) #6 0x7f6238ab4ed8 in SettingsWindow::SettingsWindow(QWidget*) (/usr/lib64/liblibmediaelch.so+0x1724ed8) #7 0x7f6238976fad in MainWindow::MainWindow(QWidget*) (/usr/lib64/liblibmediaelch.so+0x15e6fad) #8 0x55c7a3746efd in main (/usr/bin/MediaElch+0xeefd) #9 0x7f623646be5c in __libc_start_main (/lib64/libc.so.6+0x23e5c) Indirect leak of 120 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f62368c63b1 (/usr/lib64/libQt5Core.so.5+0xc63b1) Indirect leak of 88 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a76b9c in QObject::QObject(QObject*) (/usr/lib64/libQt5Core.so.5+0x276b9c) #2 0x7f62381f336d in mediaelch::MovieDatabaseLoader::MovieDatabaseLoader(SettingsDir, mediaelch::MovieLoaderStore&, QObject*) (/usr/lib64/liblibmediaelch.so+0xe6336d) #3 0x7f62381f189d in mediaelch::MovieFileSearcher::loadNext() (/usr/lib64/liblibmediaelch.so+0xe6189d) #4 0x7f62381f0912 in mediaelch::MovieFileSearcher::reload(bool) (/usr/lib64/liblibmediaelch.so+0xe60912) #5 0x7f623896d15d in FileScannerDialog::onStartMovieScannerCache() (/usr/lib64/liblibmediaelch.so+0x15dd15d) #6 0x7f6238975011 in QtPrivate::FunctorCall, QtPrivate::List<>, void, void (FileScannerDialog::*)()>::call(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e5011) #7 0x7f6238974e37 in void QtPrivate::FunctionPointer::call, void>(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e4e37) #8 0x7f62389743b5 in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/usr/lib64/liblibmediaelch.so+0x15e43b5) #9 0x7f6236a712d4 in QObject::event(QEvent*) (/usr/lib64/libQt5Core.so.5+0x2712d4) #10 0x7f6236e72ede in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib64/libQt5Widgets.so.5+0x162ede) Indirect leak of 64 byte(s) in 2 object(s) allocated from: #0 0x7f62399545ff in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xac5ff) #1 0x7f623690040f in QListData::detach_grow(int*, int) (/usr/lib64/libQt5Core.so.5+0x10040f) Indirect leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f62381f1852 in mediaelch::MovieFileSearcher::loadNext() (/usr/lib64/liblibmediaelch.so+0xe61852) #2 0x7f62381f0912 in mediaelch::MovieFileSearcher::reload(bool) (/usr/lib64/liblibmediaelch.so+0xe60912) #3 0x7f62389==12836==ERROR: LeakSanitizer: detected memory leaks Indirect leak of 352 byte(s) in 4 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a6ff78 in QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) (/usr/lib64/libQt5Core.so.5+0x26ff78) Indirect leak of 311 byte(s) in 5 object(s) allocated from: #0 0x7f62399545ff in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xac5ff) #1 0x7f62368d2190 in QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags) (/usr/lib64/libQt5Core.so.5+0xd2190) Indirect leak of 160 byte(s) in 1 object(s) allocated from: #0 0x7f62399545ff in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xac5ff) #1 0x7f6236a6d94c in QObjectPrivate::addConnection(int, QObjectPrivate::Connection*) (/usr/lib64/libQt5Core.so.5+0x26d94c) Indirect leak of 152 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f62369a4012 in QDir::QDir(QString const&) (/usr/lib64/libQt5Core.so.5+0x1a4012) #2 0x7f62384a75e2 (/usr/lib64/liblibmediaelch.so+0x11175e2) #3 0x7f62384a82b3 in DirectorySettings::loadSettings() (/usr/lib64/liblibmediaelch.so+0x11182b3) #4 0x7f62384badf1 in Settings::loadSettings() (/usr/lib64/liblibmediaelch.so+0x112adf1) #5 0x7f6238ab63c9 in SettingsWindow::loadSettings() (/usr/lib64/liblibmediaelch.so+0x17263c9) #6 0x7f6238ab4ed8 in SettingsWindow::SettingsWindow(QWidget*) (/usr/lib64/liblibmediaelch.so+0x1724ed8) #7 0x7f6238976fad in MainWindow::MainWindow(QWidget*) (/usr/lib64/liblibmediaelch.so+0x15e6fad) #8 0x55c7a3746efd in main (/usr/bin/MediaElch+0xeefd) #9 0x7f623646be5c in __libc_start_main (/lib64/libc.so.6+0x23e5c) Indirect leak of 120 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f62368c63b1 (/usr/lib64/libQt5Core.so.5+0xc63b1) Indirect leak of 88 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a76b9c in QObject::QObject(QObject*) (/usr/lib64/libQt5Core.so.5+0x276b9c) #2 0x7f62381f336d in mediaelch::MovieDatabaseLoader::MovieDatabaseLoader(SettingsDir, mediaelch::MovieLoaderStore&, QObject*) (/usr/lib64/liblibmediaelch.so+0xe6336d) #3 0x7f62381f189d in mediaelch::MovieFileSearcher::loadNext() (/usr/lib64/liblibmediaelch.so+0xe6189d) #4 0x7f62381f0912 in mediaelch::MovieFileSearcher::reload(bool) (/usr/lib64/liblibmediaelch.so+0xe60912) #5 0x7f623896d15d in FileScannerDialog::onStartMovieScannerCache() (/usr/lib64/liblibmediaelch.so+0x15dd15d) #6 0x7f6238975011 in QtPrivate::FunctorCall, QtPrivate::List<>, void, void (FileScannerDialog::*)()>::call(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e5011) #7 0x7f6238974e37 in void QtPrivate::FunctionPointer::call, void>(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e4e37) #8 0x7f62389743b5 in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/usr/lib64/liblibmediaelch.so+0x15e43b5) #9 0x7f6236a712d4 in QObject::event(QEvent*) (/usr/lib64/libQt5Core.so.5+0x2712d4) #10 0x7f6236e72ede in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib64/libQt5Widgets.so.5+0x162ede) Indirect leak of 64 byte(s) in 2 object(s) allocated from: #0 0x7f62399545ff in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xac5ff) #1 0x7f623690040f in QListData::detach_grow(int*, int) (/usr/lib64/libQt5Core.so.5+0x10040f) Indirect leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f62381f1852 in mediaelch::MovieFileSearcher::loadNext() (/usr/lib64/liblibmediaelch.so+0xe61852) #2 0x7f62381f0912 in mediaelch::MovieFileSearcher::reload(bool) (/usr/lib64/liblibmediaelch.so+0xe60912) #3 0x7f623896d15d in FileScannerDialog::onStartMovieScannerCache() (/usr/lib64/liblibmediaelch.so+0x15dd15d) #4 0x7f6238975011 in QtPrivate::FunctorCall, QtPrivate::List<>, void, void (FileScannerDialog::*)()>::call(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e5011) #5 0x7f6238974e37 in void QtPrivate::FunctionPointer::call, void>(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e4e37) #6 0x7f62389743b5 in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/usr/lib64/liblibmediaelch.so+0x15e43b5) #7 0x7f6236a712d4 in QObject::event(QEvent*) (/usr/lib64/libQt5Core.so.5+0x2712d4) #8 0x7f6236e72ede in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib64/libQt5Widgets.so.5+0x162ede) Indirect leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a6d8bb in QObjectPrivate::addConnection(int, QObjectPrivate::Connection*) (/usr/lib64/libQt5Core.so.5+0x26d8bb) Indirect leak of 24 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a6e54b in QObject::deleteLater() (/usr/lib64/libQt5Core.so.5+0x26e54b) #2 0x7f62381f5e0b in QtPrivate::FunctorCall, QtPrivate::List, void, void (mediaelch::MovieFileSearcher::*)(mediaelch::MovieLoader*)>::call(void (mediaelch::MovieFileSearcher::*)(mediaelch::MovieLoader*), mediaelch::MovieFileSearcher*, void**) (/usr/lib64/liblibmediaelch.so+0xe65e0b) #3 0x7f62381f5741 in void QtPrivate::FunctionPointer::call, void>(void (mediaelch::MovieFileSearcher::*)(mediaelch::MovieLoader*), mediaelch::MovieFileSearcher*, void**) (/usr/lib64/liblibmediaelch.so+0xe65741) #4 0x7f62381f4ccd in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/usr/lib64/liblibmediaelch.so+0xe64ccd) #5 0x7f6236a712d4 in QObject::event(QEvent*) (/usr/lib64/libQt5Core.so.5+0x2712d4) #6 0x7f6236e72ede in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib64/libQt5Widgets.so.5+0x162ede) Indirect leak of 16 byte(s) in 2 object(s) allocated from: #0 0x7f62399560af in operator new[](unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xae0af) #1 0x7f6236a6cfeb (/usr/lib64/libQt5Core.so.5+0x26cfeb) #2 0x7f6214c366ef () Indirect leak of 16 byte(s) in 1 object(s) allocated from: #0 0x7f62399560af in operator new[](unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xae0af) #1 0x7f6236a6cfeb (/usr/lib64/libQt5Core.so.5+0x26cfeb) #2 0x7f6214c3669f () Indirect leak of 12 byte(s) in 1 object(s) allocated from: #0 0x7f62399560af in operator new[](unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xae0af) #1 0x7f6236a6cfeb (/usr/lib64/libQt5Core.so.5+0x26cfeb) #2 0x7f6214c366bf () SUMMARY: AddressSanitizer: 1403 byte(s) leaked in 22 allocation(s). ```6d15d in FileScannerDialog::onStartMovieScannerCache() (/usr/lib64/liblibmediaelch.so+0x15dd15d) #4 0x7f6238975011 in QtPrivate::FunctorCall, QtPrivate::List<>, void, void (FileScannerDialog::*)()>::call(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e5011) #5 0x7f6238974e37 in void QtPrivate::FunctionPointer::call, void>(void (FileScannerDialog::*)(), FileScannerDialog*, void**) (/usr/lib64/liblibmediaelch.so+0x15e4e37) #6 0x7f62389743b5 in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/usr/lib64/liblibmediaelch.so+0x15e43b5) #7 0x7f6236a712d4 in QObject::event(QEvent*) (/usr/lib64/libQt5Core.so.5+0x2712d4) #8 0x7f6236e72ede in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib64/libQt5Widgets.so.5+0x162ede) Indirect leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a6d8bb in QObjectPrivate::addConnection(int, QObjectPrivate::Connection*) (/usr/lib64/libQt5Core.so.5+0x26d8bb) Indirect leak of 24 byte(s) in 1 object(s) allocated from: #0 0x7f6239955f47 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xadf47) #1 0x7f6236a6e54b in QObject::deleteLater() (/usr/lib64/libQt5Core.so.5+0x26e54b) #2 0x7f62381f5e0b in QtPrivate::FunctorCall, QtPrivate::List, void, void (mediaelch::MovieFileSearcher::*)(mediaelch::MovieLoader*)>::call(void (mediaelch::MovieFileSearcher::*)(mediaelch::MovieLoader*), mediaelch::MovieFileSearcher*, void**) (/usr/lib64/liblibmediaelch.so+0xe65e0b) #3 0x7f62381f5741 in void QtPrivate::FunctionPointer::call, void>(void (mediaelch::MovieFileSearcher::*)(mediaelch::MovieLoader*), mediaelch::MovieFileSearcher*, void**) (/usr/lib64/liblibmediaelch.so+0xe65741) #4 0x7f62381f4ccd in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/usr/lib64/liblibmediaelch.so+0xe64ccd) #5 0x7f6236a712d4 in QObject::event(QEvent*) (/usr/lib64/libQt5Core.so.5+0x2712d4) #6 0x7f6236e72ede in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib64/libQt5Widgets.so.5+0x162ede) Indirect leak of 16 byte(s) in 2 object(s) allocated from: #0 0x7f62399560af in operator new[](unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xae0af) #1 0x7f6236a6cfeb (/usr/lib64/libQt5Core.so.5+0x26cfeb) #2 0x7f6214c366ef () Indirect leak of 16 byte(s) in 1 object(s) allocated from: #0 0x7f62399560af in operator new[](unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xae0af) #1 0x7f6236a6cfeb (/usr/lib64/libQt5Core.so.5+0x26cfeb) #2 0x7f6214c3669f () Indirect leak of 12 byte(s) in 1 object(s) allocated from: #0 0x7f62399560af in operator new[](unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libasan.so.6+0xae0af) #1 0x7f6236a6cfeb (/usr/lib64/libQt5Core.so.5+0x26cfeb) #2 0x7f6214c366bf () SUMMARY: AddressSanitizer: 1403 byte(s) leaked in 22 allocation(s). ```
bugwelle commented 3 years ago

OK, thanks! Seems I was not careful enough... I should really avoid last minute changes. Those leaks didn't arise when I tested it on my Linux machine.

bugwelle commented 3 years ago

Ok, my coding was correct but I forgot to initialize an std:.atomic_bool. And without setting it explicitly to false on construction, it's value is undefined (i.e. depends on the platform and what's in memory already).

I reproduced the issue in a virtual machine. #1331 now contains the fixed state.

@bell07 Thank you for testing MediaElch. Could you give https://github.com/Komet/MediaElch/commit/d9e3c29fcf4ffe2bbf698fa039d0afbb94e21efb one last shot? :-) I'm now pretty sure that it works and is thread safe.

bell07 commented 3 years ago

Tried the last commit. Now all is fine ;-). The initial load and reload does work, for movies and shows. No memory leaks messages on exit.

bugwelle commented 3 years ago

Great!

Wow, no memory leaks? At least I get a few that aren't MediaElch's fault (some in a system font loader, some in QMLEngine).

I'll merge #1331 . Thank you very much for testing it. :-)