saltstack / saltstack/salt

Get UnicodeDecoderError after salt compiled

Open
#56,413 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending-discussion
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

Normal salt-minion is working OK.
Salt-minion is running on a MIPS board, so I have to decrease its size, then I compile salt to pyc files and delete all the py files.

But with this compiled version of salt, salt-minion will get such error when connecting to the salt-master which runs on a x64 ubuntu system.

[CRITICAL] Unexpected error while connecting to 192.168.1.2
Traceback (most recent call last):
  File "pyvenv/lib/python3.7/site-packages/salt/minion.py", line 1036, in _connect_minion
  File "pyvenv/lib/python3.7/site-packages/salt/ext/tornado/gen.py", line 1056, in run
  File "pyvenv/lib/python3.7/site-packages/salt/ext/tornado/concurrent.py", line 239, in result
  File "<string>", line 4, in raise_exc_info
  File "pyvenv/lib/python3.7/site-packages/salt/ext/tornado/gen.py", line 1064, in run
  File "pyvenv/lib/python3.7/site-packages/salt/minion.py", line 1234, in connect_master
  File "pyvenv/lib/python3.7/site-packages/salt/ext/tornado/gen.py", line 1056, in run
  File "pyvenv/lib/python3.7/site-packages/salt/ext/tornado/concurrent.py", line 239, in result
  File "<string>", line 4, in raise_exc_info
  File "pyvenv/lib/python3.7/site-packages/salt/ext/tornado/gen.py", line 309, in wrapper
  File "pyvenv/lib/python3.7/site-packages/salt/minion.py", line 754, in eval_master
  File "pyvenv/lib/python3.7/site-packages/salt/transport/client.py", line 185, in factory
  File "pyvenv/lib/python3.7/site-packages/salt/transport/zeromq.py", line 35, in <module>
  File "pyvenv/lib/python3.7/site-packages/salt/transport/mixins/auth.py", line 16, in <module>
  File "pyvenv/lib/python3.7/site-packages/salt/master.py", line 35, in <module>
  File "pyvenv/lib/python3.7/site-packages/salt/client/ssh/__init__.py", line 195, in <module>
  File "/codecs.py", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 12: invalid continuation byte
Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
compiling running on MIPS board

python3 -m compileall -b salt
Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
           Salt: 3000
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10.3
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.7.6 (default, Jan 06 2020, 16:47:09)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 18.1.1
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2
 
System Versions:
           dist:   
         locale: UTF-8
        machine: mips
        release: 4.14.162
         system: Linux
        version: Not Installed

I wonder why salt of py files is ok and of pyc files gets error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the import chain shown in the traceback, especially salt/client/ssh/init.py, salt/master.py, salt/transport/mixins/auth.py, and salt/transport/zeromq.py. Reproduce the Python 3.7 compiled-only deployment using python3 -m compileall -b salt, compare it with the working source deployment, and document a verified cause and regression coverage for the UnicodeDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.