Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Kodi 18] Some python2 error in the log, possibly about the repo #1090

Open
pitsi opened this issue Dec 13, 2024 · 30 comments · May be fixed by elgatito/elementum#150
Open

[Kodi 18] Some python2 error in the log, possibly about the repo #1090

pitsi opened this issue Dec 13, 2024 · 30 comments · May be fixed by elgatito/elementum#150

Comments

@pitsi
Copy link

pitsi commented Dec 13, 2024

Expected Behavior

Hmmm... There should not be such an error in the log.

Current Behavior

The error below is shown in the log. However, elementum seems to work fine.

Possible Solution

No idea.

Steps to Reproduce (for bugs)

  1. Install elementum on a kodi 18 installation.
  2. Restart kodi for elementum to load.
  3. Notice the following in the log.

Context

The log

2024-12-13 09:32:53.970 T:140480434853632   ERROR: Traceback (most recent call last):
2024-12-13 09:32:53.970 T:140480434853632   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 599, in process_request_thread
2024-12-13 09:32:53.970 T:140480434853632   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
2024-12-13 09:32:53.970 T:140480434853632   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 655, in __init__
2024-12-13 09:32:53.972 T:140480434853632   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 342, in handle
2024-12-13 09:32:53.972 T:140480520120064  NOTICE: [plugin.video.elementum] INFO  main         ▶ func8            Updating Kodi add-on repositories...
2024-12-13 09:32:53.972 T:140480434853632   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 310, in handle_one_request
2024-12-13 09:32:53.972 T:140480434853632   ERROR:   File "/usr/lib/python2.7/socket.py", line 480, in readline
2024-12-13 09:32:53.972 T:140480434853632   ERROR: error: [Errno 104] Connection reset by peer

If it helps, since libreelec 9 is eol since a few years ago and has no support, I manually update it's certificates in order to keep some addons running properly. However, the error comes up even with the stock certificates.

Your Environment

  • Version used: 0.1.106
  • Environment name and version: kodi 18.9 on libreelec 9.2.6 x64
  • Operating System and version: Libreelec 6.2.6 x64
  • Link to Kodi debug log: (log is above)
@antonsoroko
Copy link

@pitsi not sure that this is elementum issue, it might be just a coincidence that you see elementum Golang notice message during generic Python error messages. There should be at least elementum python error messages.
Anyway, full log is needed, since this "part of log" is not useful at all.

@pitsi
Copy link
Author

pitsi commented Dec 14, 2024

Please allow a few days to clean up my installation from other addons and I will post the full log. Thank you :)

@pitsi
Copy link
Author

pitsi commented Dec 18, 2024

There you go. The error is on lines 623 to 629
kodi.log

@antonsoroko
Copy link

@pitsi looks like you forgot to enable debug both in kodi and elementum :-(
there was a guide in template - http://elementum.surge.sh/contribute/log/

(disable debug after creating log to save some performance and disk space)

@pitsi
Copy link
Author

pitsi commented Dec 21, 2024

There you go.
kodi.log

Kodi's debug mode was enabled with --debug flag and I set elementum to debug more via settings > advanced > log > log level > debug.

@antonsoroko
Copy link

antonsoroko commented Dec 21, 2024

this is what i see in log

DEBUG: [repository.elementumorg] "GET /addons.xml HTTP/1.1" 200 -
DEBUG: ----------------------------------------
DEBUG: Exception happened during processing of request from
DEBUG: ('127.0.0.1', 39126)
ERROR: Traceback (most recent call last):
ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 599, in process_request_thread
ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 655, in __init__
ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 342, in handle
NOTICE: [plugin.video.elementum] INFO  main         ▶ func8            �[0mUpdating Kodi add-on repositories...
ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 310, in handle_one_request
ERROR:   File "/usr/lib/python2.7/socket.py", line 480, in readline
ERROR: error: [Errno 104] Connection reset by peer
DEBUG: ----------------------------------------

@antonsoroko
Copy link

@pitsi can you please open in your browser this address http://IP_OF_Libreelec:65223/addons.xml
or from libreelec terminal: curl http://127.0.0.1:65223/addons.xml
and then check

  1. that it gives you correct XML file (upload its content here)
  2. if in kodi.log you see the same error as before

@pitsi
Copy link
Author

pitsi commented Dec 21, 2024

When I run it either locally or remotely, it gives me this, which seems to be the structure of the elementum repo.
addons.txt

Now if you excuse me for today, I have to go rest :)

@pitsi
Copy link
Author

pitsi commented Dec 22, 2024

I missunderstood the second part of the question, sorry.
When runninng curl on that xml file (from my system) all I get is this
2024-12-22 07:30:15.371 T:140460060309248 DEBUG: [repository.elementumorg] "GET /addons.xml HTTP/1.1" 200 -

The problem is that I get no newer message in the log despite how many times I run curl, either locally or remotely, so teh above may be... just another elementum message in the log.

@antonsoroko
Copy link

@pitsi does this error somehow affects work of elementumorg repository? e.g. can you open the repository and install addons from it? (you can safely uninstall and reinstall "elementum context helper", for example)

@pitsi
Copy link
Author

pitsi commented Dec 22, 2024

Truth be told, I have not noticed it, because I do get the updates like usual. But I just tried what you suggested and it works as it should.

Disabling elementum executable from autostarting with kodi makes the error go away, obviously.

@antonsoroko
Copy link

@pitsi

Disabling elementum executable from autostarting with kodi makes the error go away, obviously.

On start elementum run "update all repos" internal kodi's command. Maybe there is some "race condition".

Can you please set "start delay" in elementum settings to 5 seconds? And see if you still see the error.

@pitsi
Copy link
Author

pitsi commented Dec 22, 2024

I gave it the full 180 seconds of delay, it did do it as you can see here

2024-12-22 20:10:28.097 T:140237233702656  NOTICE: [plugin.video.elementum] elementumd: sleeping 180 seconds before startup
2024-12-22 20:13:28.223 T:140237233702656  NOTICE: [plugin.video.elementum] elementumd: started process

but in the end nothing changed

2024-12-22 20:13:29.386 T:140237048375040   ERROR: Traceback (most recent call last):
2024-12-22 20:13:29.386 T:140237048375040   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 599, in process_request_thread
2024-12-22 20:13:29.386 T:140237048375040   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
2024-12-22 20:13:29.386 T:140237048375040   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 655, in __init__
2024-12-22 20:13:29.386 T:140237048375040   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 342, in handle
2024-12-22 20:13:29.386 T:140237048375040   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 310, in handle_one_request
2024-12-22 20:13:29.388 T:140237048375040   ERROR:   File "/usr/lib/python2.7/socket.py", line 480, in readline
2024-12-22 20:13:29.388 T:140237048375040   ERROR: error: [Errno 104] Connection reset by peer

Because I did not mention it earlier, I sometimes hear kodi's error sound on shutdown, but it does not stay open for long so as to show an error message and let me know why it happened. Could that be related to elementum?

@antonsoroko
Copy link

@pitsi

but it does not stay open for long so as to show an error message and let me know why it happened.

You can take a look into kodi.log.old file , it will have log from previous Kodi run.

@antonsoroko
Copy link

antonsoroko commented Dec 22, 2024

but in the end nothing changed

I do not know why this is happening on your system. It might be because of kodi 18 or old certificates or something else. Maybe @elgatito can say more.

Elementum repository is dynamic add-on that gets data from GitHub API , maybe those requests to GitHub API are failing for some reason. But hard to tell without a easy way to reproduce the issue locally.

As I understands the repo works for you, so it is not a blocker bug , but more like "inconvenient" bug.

@pitsi
Copy link
Author

pitsi commented Dec 23, 2024

I know about kodi.old.log (as well as about the "dynamic nature" of the elementum repository). The problem is that either it happens and I forget to check it the next time I boot, or I have to restart kodi while keeping le running. In both cases. the file gets replaced by a new one, which is useless.

As for the certificates, I know that the system will not get any further updates, so I update the certificates by hand, the way that is described here.
https://wiki.libreelec.tv/configuration/ssl-tls-certificates

Right now, my cecert.pem file is the one from November 26th, i.e. the latest one.

# cat .config/cacert.pem | head -5
##
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Tue Nov 26 13:58:25 2024 GMT
##

But all that may be wrong, because I have no way to know if the system did parse that file or is still using its original one from 2020

# cat /etc/ssl/cacert.pem.system | head -5
##
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sun May 31 07:36:09 2020 GMT
##

@pitsi
Copy link
Author

pitsi commented Dec 23, 2024

About this last bit. I totally missed the part of the instructions which says that the new file is appended to the old one. The new file is indeed appended and the resulted one contains both the old and the new one.

# cat /etc/ssl/cacert.pem | grep "Certificate data"
## Certificate data from Mozilla as of: Sun May 31 07:36:09 2020 GMT
## Certificate data from Mozilla as of: Tue Nov 26 13:58:25 2024 GMT

@antonsoroko
Copy link

antonsoroko commented Dec 23, 2024

i meant that the only way to see what is really happening is to add some debug code to https://github.com/ElementumOrg/repository.elementumorg/tree/master
i tried to read that code but i do not really see where to add debug to make it useful.

maybe @i96751414 can say something about this, since https://github.com/ElementumOrg/repository.elementumorg is just a fork of https://github.com/i96751414/repository.github

@pitsi
Copy link
Author

pitsi commented Jan 23, 2025

Does it help to say that when disabling elementum's autostart function the error does not snow up?

@i96751414
Copy link

The problem seems not to be related with the repo but instead the plugin calling addons.xml. For some reason it is closing the connection earlier than expected.

This is just a guess though

@pitsi
Copy link
Author

pitsi commented Jan 24, 2025

Is there a chance that the message comes up because the network is not available when the addon loads?

@i96751414
Copy link

No. That would be a different error. I think this is happening when the plugin runs UpdateRepositories from JSON RPC. But again, its just a guess as I am not able to test it

@antonsoroko
Copy link

@i96751414 as i mentioned above, on start elementum runs UpdateAddonRepos kodi's built-in function.
https://kodi.wiki/view/List_of_built-in_functions :
UpdateAddonRepos Triggers a forced update of enabled add-on repositories.

https://github.com/elgatito/elementum/blob/638d5c307b53763e752a698252ecb03de06e085a/main.go#L324
(in log you can see that repo already created, so creation of repo is skipped and code goes straight to UpdateAddonRepos)

so it is not elementum who requests /addons.xml but Kodi itself. (correct me if i am wrong)
and i think that for some reason repo drops this first connection from kodi.

interesting that now i see this error on my linux PC with both kodi 20 and 21 and even on device with android tv and with kodi 21.
but i do not see it in kodi.old.log that was few days ago.

i have a feeling that this might be because Github API sometimes blocks requests from "repository.github" addon to "hot" endpoints, and i guess elementum's github URLs are used often by users and that's why github can "rate limit" them.
@i96751414 is it possible to add some debug code to verify this theory?

@pitsi 2 questions:

  1. can you test this error on different day?
  2. can you test this error with different internet provider? maybe from other device (like mobile phone).
  3. i already asked above and you said that this error does not affect work of repo and elementum. have you noticed any other effects from this "line of text in log"?

@i96751414
Copy link

@antonsoroko Correct, UpdateAddonRepos is triggered via JSON RPC and its Kodi who handles that, so in practice it's Kodi doing the request to the repository.

Nevertheless, the error doesn't seem related at all with GitHub API or any outgoing requests from the virtual repository.

The below 2 lines in particular suggest that it is Kodi who is dropping the connection:

2024-12-22 20:13:29.388 T:140237048375040   ERROR:   File "/usr/lib/python2.7/socket.py", line 480, in readline
2024-12-22 20:13:29.388 T:140237048375040   ERROR: error: [Errno 104] Connection reset by peer

I would suggest installing the latest version of repository.github and see if it has the same behavior.

@pitsi
Copy link
Author

pitsi commented Jan 24, 2025

@antonsoroko
Answering your questions.

  1. I use that libreelec system daily, many times a day. It is like my very personal tv here!
  2. Sadly no. My neighbor, on whose wifi I can easily connect, is on the same isp as me and my phone number is on the same company too. If it helps, my router gives cloudflare's dns over dhcp to anything that does NOT use a static ip.
  3. Other than the error sound while the system shuts down, no.

@antonsoroko
Copy link

@pitsi

  1. Other than the error sound while the system shuts down, no.

i do not think this "error sound" is related to this error message. this is just error message in log file, it does not go to Kodi UI. and it is on start, not on stop.

we already discussed that - you need to create debug log file for this "shut down error sound". then we can try so see what is the reason. maybe it is not even connected to elementum.

@antonsoroko
Copy link

antonsoroko commented Jan 24, 2025

@pitsi so i found a root cause of this error message.
elementum actually does a test if repo is available, it opens repo url.
and if we do not read http response body (b/c we do not need it) then python server from repository.elementumorg is unhappy and prints error [Errno 104] Connection reset by peer in log.
i added read - no error. you can see the change in PR.
CC: @i96751414

it is not a real error and it affects nothing.
that's why you have not noticed any issue with repo or elementum. it was just a line in log file.
but thanks for filing a bug, anyway we made a small improvement :-)

you can use this test build plugin.video.elementum-v0.1.106-fix-issue-1090.linux_x64.zip (i used it on my linux desktop).
or if you do not want to use it then you can temporary enable "Skip searching for installed Elementum repository" option in elementum's settings (so it will Not reinstall/reenable repo if repo is uninstalled/disabled, but also it will not check if repo is available). choice is yours.


about that "error sound" - i wrote above. if in log file you will see something about elementum or if disabling elementum will remove this "error sound" in 100% cases - then create new issue. otherwise - it is not because of elementum.

@i96751414
Copy link

One side note: I am all for open source and sharing stuff, but the way you are managing a "fork" is just messy. Why didn't you simply create a fork and then performed modifications as required?

@antonsoroko
Copy link

@i96751414

One side note: I am all for open source and sharing stuff, but the way you are managing a "fork" is just messy. Why didn't you simply create a fork and then performed modifications as required?

this is question to @elgatito . i am also confused why it is done this way, considering that all other repos are done as forks. but since it is not a fork i had to manually update it.

@pitsi
Copy link
Author

pitsi commented Jan 25, 2025

we already discussed that - you need to create debug log file for this "shut down error sound". then we can try so see what is the reason. maybe it is not even connected to elementum.

About this bit. I have no problem getting a debug log. The real problem is that I have to use kodi with debug enabled, which adds some extra cpu usage, before shutting it down. And I have to do it many times, until I hear the sound.
Right now though, with youtube's api being complete garbage for the last couple of weeks, the log will be 98% youtube trash and 2% stuff from other addons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants