arkOScloud / core

arkOS core system management libraries
GNU General Public License v3.0
61 stars 13 forks source link

SystemError: <class 'random.Random'> returned a result with an error set #20

Open matrob opened 7 years ago

matrob commented 7 years ago

arkOS 0.8.3 on RaspberryPI Original

[root@arkos ~]# systemctl status krakend
* krakend.service - arkOS Kraken/Genesis
   Loaded: loaded (/usr/lib/systemd/system/krakend.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2017-01-11 20:53:26 CET; 1 weeks 5 days ago
  Process: 222 ExecStart=/usr/bin/krakend -d (code=exited, status=1/FAILURE)

Jan 11 20:53:26 arkos krakend[222]:     from .utils import *
Jan 11 20:53:26 arkos krakend[222]:   File "/usr/lib/python3.6/site-packages/arkos/utilities/utils.py", line 14, in <module>
Jan 11 20:53:26 arkos krakend[222]:     import random
Jan 11 20:53:26 arkos krakend[222]:   File "/usr/lib/python3.6/random.py", line 742, in <module>
Jan 11 20:53:26 arkos krakend[222]:     _inst = Random()
Jan 11 20:53:26 arkos krakend[222]: SystemError: <class 'random.Random'> returned a result with an error set
Jan 11 20:53:26 arkos systemd[1]: krakend.service: Control process exited, code=exited status=1
Jan 11 20:53:26 arkos systemd[1]: Failed to start arkOS Kraken/Genesis.
Jan 11 20:53:26 arkos systemd[1]: krakend.service: Unit entered failed state.
Jan 11 20:53:26 arkos systemd[1]: krakend.service: Failed with result 'exit-code'.
pomarec commented 7 years ago

Same here on VPS (installed from archlinux script). If I perform systemctl restart krakend it launches the krakend successfuly though.

peakwinter commented 7 years ago

This appears to be an issue after the update to Python 3.6. I will do more research into what is causing it and push a fix ASAP.

Thanks for reporting!

pomarec commented 7 years ago

A bit more info in this log (ressource unavailable). I probably don't know what i'm talking about but i guess the service is launched too soon at boot. It might be tweaked in the service configuration, I will have a look.

Jan 25 13:17:46 scw-ccd219 krakend[3360]: BlockingIOError: [Errno 11] Resource temporarily unavailable
Jan 25 13:17:46 scw-ccd219 krakend[3360]: The above exception was the direct cause of the following exception:
Jan 25 13:17:46 scw-ccd219 krakend[3360]: Traceback (most recent call last):
Jan 25 13:17:46 scw-ccd219 krakend[3360]:   File "/usr/bin/krakend", line 8, in <module>
Jan 25 13:17:46 scw-ccd219 krakend[3360]:     from arkos.daemon import Daemon
Jan 25 13:17:46 scw-ccd219 krakend[3360]:   File "/usr/lib/python3.6/site-packages/arkos/__init__.py", line 12, in <module>
Jan 25 13:17:46 scw-ccd219 krakend[3360]:     from arkos import configs
Jan 25 13:17:46 scw-ccd219 krakend[3360]:   File "/usr/lib/python3.6/site-packages/arkos/configs.py", line 14, in <module>
Jan 25 13:17:46 scw-ccd219 krakend[3360]:     from arkos.utilities.errors import ConfigurationError
Jan 25 13:17:46 scw-ccd219 krakend[3360]:   File "/usr/lib/python3.6/site-packages/arkos/utilities/__init__.py", line 11, in <module>
Jan 25 13:17:46 scw-ccd219 krakend[3360]:     from .utils import *
Jan 25 13:17:46 scw-ccd219 krakend[3360]:   File "/usr/lib/python3.6/site-packages/arkos/utilities/utils.py", line 14, in <module>
Jan 25 13:17:46 scw-ccd219 krakend[3360]:     import random
Jan 25 13:17:46 scw-ccd219 krakend[3360]:   File "/usr/lib/python3.6/random.py", line 742, in <module>
Jan 25 13:17:46 scw-ccd219 krakend[3360]:     _inst = Random()
Jan 25 13:17:46 scw-ccd219 krakend[3360]: SystemError: <class 'random.Random'> returned a result with an error set
peakwinter commented 7 years ago

Yes, it's a strange error that other projects are encountering as well...

pomarec commented 7 years ago

Aparently a bug in python 3.6. Do you know how to install "master branch" of python with pacman ?

peakwinter commented 7 years ago

Python 3.6 is already the master version of pacman in the Arch Linux libraries. Old versions can be installed using the AUR but I wouldn't recommend that as you'll have to update all of your modules and system-installed packages in the same manner, which would be a pain... Anyway, stuff like this makes me look forward to adding Debian support soon ;)

pomarec commented 7 years ago

I don't really know what Debian support involves but it sounds like a good idea. I think newcomers are more confortable with Ubuntu than Archlinux. About the current issue, should we just wait for archlinux to integrate the last version of python3.6 that contain the fix and then pacman -Syu ?

peakwinter commented 7 years ago

If that fix is indeed the cause of this issue, then yes that's probably the best course of action. I will look to see if there's anything better I can do in the meantime.

pomarec commented 7 years ago

New situation, few seconds after power up, same bug :

curl -s https://pkg.arkos.io/resources/install_arch.py | sudo python
BlockingIOError: [Errno 11] Resource temporarily unavailable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 12, in <module>
  File "/usr/lib/python3.6/urllib/request.py", line 88, in <module>
    import http.client
  File "/usr/lib/python3.6/http/client.py", line 71, in <module>
    import email.parser
  File "/usr/lib/python3.6/email/parser.py", line 12, in <module>
    from email.feedparser import FeedParser, BytesFeedParser
  File "/usr/lib/python3.6/email/feedparser.py", line 27, in <module>
    from email._policybase import compat32
  File "/usr/lib/python3.6/email/_policybase.py", line 9, in <module>
    from email.utils import _has_surrogates
  File "/usr/lib/python3.6/email/utils.py", line 28, in <module>
    import random
  File "/usr/lib/python3.6/random.py", line 742, in <module>
    _inst = Random()
SystemError: <class 'random.Random'> returned a result with an error set
peakwinter commented 7 years ago

Hopefully 3.6.1 comes out soon... this is a very annoying bug!

matrob commented 7 years ago

3.6.1 schedule

Expected:

3.6.1 candidate: 2017-02-27
3.6.1 final: 2017-03-13
peakwinter commented 7 years ago

The first release candidate is out, will see if we can get a new version by the end of the month...