-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[BUG] salt-call pkg.install using proxy generates UnicodeDecodeError #60908
Comments
Seeing the same with 3003.3 (latest on Fedora) and a HTTP(S) proxy, although with a master. I'm not seeing an endless loop however, it just spams this message with thousands of lines in the logs causing rotations to occur multiple time per highstate. There is no functional issue for us, but we've had to place the salt-minion's logs in a blocklist on our log aggregator due to all the noise wasting our license quotas. |
Seeing it on How to reproduce (there might be a more straightforward way, I'm just mostly replicating what I'm running here for $reasons):
The result is: thousands of times this error repeated:
It works fine for non-binary files, e.g.: salt-call --local cp.get_url https://saltproject.io/wp-content/uploads/2020/12/main-logo.svg /tmp/main-logo.svg
local:
/tmp/main-logo.svg Version Report: Salt Version:
Salt: 3005
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.8.10 (default, Jun 22 2022, 20:18:18)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-88-generic
system: Linux
version: Ubuntu 20.04 focal |
After finding tornadoweb/tornado#1608 which was fixed in d7d9c467cda38f4c9352172ba7411edc29a85196, I followed the same approach and hot-fixed it here by doing this: diff --git a/usr/lib/python3/dist-packages/salt/ext/tornado/curl_httpclient.py.orig b/usr/lib/python3/dist-packages/salt/ext/tornado/curl_httpclient.py
index 8652343..6ef3349 100644
--- a/usr/lib/python3/dist-packages/salt/ext/tornado/curl_httpclient.py.orig
+++ b/usr/lib/python3/dist-packages/salt/ext/tornado/curl_httpclient.py
@@ -494,7 +494,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
def _curl_debug(self, debug_type, debug_msg):
debug_types = ('I', '<', '>', '<', '>')
- debug_msg = native_str(debug_msg)
+ debug_msg = native_str(debug_msg.decode('latin1'))
if debug_type == 0:
curl_log.debug('%s', debug_msg.strip())
elif debug_type in (1, 2): I'll have to look into making sure this fix is addressed properly upstream - will follow up here... |
As Salt ships a bundled Tornado |
Description
I'm testing a masterless Windows minion in an environment that must use a proxy to get out to the internet. During a
pkg.install
run, the minion attempts to download the package but it runs in to an unhandled exception for UnicodeDecodeError which ultimately results in an endless loop. Only when I kill the salt-call operation do I see the connection in the proxy logs.This behaviour is not seen with a masterless minion in a different environment that doesn't require a proxy.
Setup
Salt minion config (C:\salt\conf\minion.d\masterless.conf)
Test state to achieve a download of an installer (C:\Temp\packages\win\repo-ng\datadog-pkg.sls)
Debug output
Steps to Reproduce the behavior
This behaviour can be reproduced with any installer, no matter if it's hosted on S3 or not. I'm not able to test without using a proxy on EC2 but I have tested in a VMware environment that doesn't require a proxy, with the same minion config (minus proxy settings), states and packages copied over as is, and there is no issue.
Powershell is able to use wget to download installers from the internet using environment proxy settings.
Expected behavior
I expect Salt to be able to retrieve packages from the internet with proxy settings configured in the minion, just as it does without.
Versions Report
The text was updated successfully, but these errors were encountered: