Kodi Community Forum

Full Version: High advancedsettings/cache/memorysize causes "Could not connect to repository"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Due to my bad WiFi connection, I chose very high values for the cache/memorysize in the advancedsettings of 3GB, which I found empirically to fill the complete RAM of my machine in video streams.
I now discovered, that this causes the error message "Could not connect to repository" whenever I try to open an addon repository, which I installed from zip previously.
When opening the repository, I get the error log
Code:
2019-07-21 11:26:44.978 T:140200971208448   DEBUG: CAddonDatabase: SELECT repo.id FROM repo .. took 1 ms
2019-07-21 11:26:44.978 T:140200971208448   DEBUG: CAddonDatabase: no valid repository matching 'repository.marcelveldt'
2019-07-21 11:26:44.978 T:140202008225536   DEBUG: CRepositoryUpdateJob[repository.marcelveldt] checking for updates.
2019-07-21 11:26:44.978 T:140202008225536   DEBUG: CFileCache::Open - opening <marcelveldt/repository.marcelveldt/master/addons.xml.md5> using cache
2019-07-21 11:26:44.978 T:140202008225536   DEBUG: CurlFile::Open(0x7f833806c300) https://raw.githubusercontent.com/marcelveldt/repository.marcelveldt/master/addons.xml.md5
2019-07-21 11:26:44.979 T:140202008225536    INFO: easy_acquire - Created session to https://raw.githubusercontent.com
2019-07-21 11:26:45.076 T:140203075889536   DEBUG: ------ Window Init (DialogBusy.xml) ------
2019-07-21 11:26:45.079 T:140202008225536   DEBUG: Curl::Debug - TEXT:   Trying 151.101.112.133...
2019-07-21 11:26:45.096 T:140202008225536   DEBUG: Curl::Debug - TEXT: Connected to raw.githubusercontent.com (151.101.112.133) port 443 (#0)
2019-07-21 11:26:45.096 T:140202008225536   DEBUG: Curl::Debug - TEXT: ALPN, offering http/1.1
....
2019-07-21 11:26:45.157 T:140202008225536   DEBUG: Curl::Debug - HEADER_IN: Expires: Sun, 21 Jul 2019 09:31:45 GMT
2019-07-21 11:26:45.157 T:140202008225536   DEBUG: Curl::Debug - HEADER_IN: Source-Age: 70
2019-07-21 11:26:45.157 T:140202008225536   DEBUG: Curl::Debug - TEXT: Connection #0 to host raw.githubusercontent.com left intact
2019-07-21 11:26:45.157 T:140202008225536   ERROR: Open - Unhandled exception
2019-07-21 11:26:45.157 T:140202008225536   ERROR: Open - Error opening https://raw.githubusercontent.com/marcelveldt/repository.marcelveldt/master/addons.xml.md5
2019-07-21 11:26:45.157 T:140202008225536   ERROR: CRepository: failed read 'https://raw.githubusercontent.com/marcelveldt/repository.marcelveldt/master/addons.xml.md5'
2019-07-21 11:26:45.167 T:140202008225536   DEBUG: CRepositoryUpdater: done.
Without the buffer settings. There is no error and the repository can be opened:
Code:
2019-07-21 11:28:01.359 T:140370556176128 DEBUG: Curl::Debug - HEADER_IN: Source-Age: 146
2019-07-21 11:28:01.360 T:140370556176128 DEBUG: Curl::Debug - TEXT: Connection #0 to host raw.githubusercontent.com left intact
2019-07-21 11:28:01.360 T:140369193838336 DEBUG: Thread FileCache start, auto delete: false
2019-07-21 11:28:01.361 T:140369193838336 INFO: CFileCache::Process - Source read didn't return any data! Hit eof(?)
Links to logs: With big buffer and with error; with default buffer without error.

It seems, that the command CFileCache::Open - opening <.../addons.xml.md5> using cache tries to use the 3GB cache for the 1KB file and then crashes perhaps due to memory allocation errors.
I am now wondering: Is this a bug or some part of a feature? In my understanding, loading and installing of addons/repositories should be independent of cache sizes for watching videos.
Unfortunately, the whole video buffering and size of the buffer memory seems to be highly dependent on the operating system and not very well documented. This makes it difficult to select the appropriate values. Debugging this problem took me hours because I first suspected wrong versions of python dependencies from python-pip and the problem does not seem related to the cache settings in the first place.

If it matters: I use Kodi 18.3 on Ubuntu 16.04 with Kernel 4.7.0-040700-generic with the debian and pip packages of July 2019.
I have 3.2GB of RAM available of the physical 4GB in total, because it is shared with the graphics chip of the AMD A6-6400K APU.
I put this on the Linux board since I suspect it to be Linux-specific, but did not test other OS.
If you set the cache to 3GB you will need at least 9GB of RAM in total.

See: https://kodi.wiki/view/HOW-TO:Modify_the...e_settings

Note: For the memory size set here, Kodi will require 3x the amount of RAM to be free. Setting this too high might cause Kodi to crash if it can't get enough RAM.

So I'm wondering why Kodi doesn't crash at all if I see that:
(2019-07-21, 22:06)schapplm Wrote: [ -> ]I have 3.2GB of RAM available of the physical 4GB in total,
I tried different settings and found out, that for 3GB memorysize in the advancedsettings, I get 1.35GB of cache and Kodi takes 1.6GB of memory. So the option behaved completely different than described in the wiki and I decided to use the high settings, since they worked well.
Until now, I did not find a satisfying answer to how the cache behaves and the issue with the curl function also seems weird.
There is not much discussion about the cache settings. The last posts in one thread regarding that matter were:
(2017-09-12, 18:49)Jeffers24 Wrote: [ -> ]So how is Kodi using the cache setting in the advancedsettings.xml?
(2017-09-12, 21:48)ashlar Wrote: [ -> ]Apparently nobody knows... Big Grin