Thread arguments are passed as a dict of bytes

Bug #1816804 reported by Rodolfo Alonso
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.privsep
Fix Released
Undecided
Rodolfo Alonso

Bug Description

Python: 3+ (not 2.x)

When using PyCharm to debug, the arguments passed to [1] are stored in a dictionary populated with bytes instead of strings. When in [2] "record" is created and updated [3], the values contained in "msg[1]" are not updated in "record"

Example of msg (in [2]):
<class 'tuple'>: (6, {b'msg': b'privsep daemon starting', b'version': b'unknown', b'project': b'unknown', b'module': b'daemon', b'lineno': 552, b'threadName': b'MainThread', b'levelno': 20, b'msecs': 759.4039440155029, b'args': (), b'exc_text': None, b'relativeCreated': 385.4489326477051, b'pathname': b'/opt/stack/neutron/.tox/dsvm-functional/lib/python2.7/site-packages/oslo_privsep/daemon.py', b'extra_keys': (b'project', b'version'), b'exc_info': None, b'thread': 139699668739840, b'process': 17920, b'name': b'oslo.privsep.daemon', b'funcName': b'helper_main', b'created': 1550678921.759404, b'processName': b'MainProcess', b'filename': b'daemon.py', b'levelname': b'INFO'})

Error:
Exception in thread privsep_reader:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/stack/oslo.privsep/oslo_privsep/comm.py", line 133, in _reader_main
    self.out_of_band(data)
  File "/opt/stack/oslo.privsep/oslo_privsep/daemon.py", line 211, in out_of_band
    if LOG.isEnabledFor(record.levelno):
  File "/usr/lib/python3.5/logging/__init__.py", line 1646, in isEnabledFor
    if self.logger.manager.disable >= level:
TypeError: unorderable types: int() >= NoneType()

References:
[1] https://github.com/openstack/oslo.privsep/blob/130d7155c4dcbbf170a0210ac72e302538fb26e4/oslo_privsep/comm.py#L128
[2] https://github.com/openstack/oslo.privsep/blob/130d7155c4dcbbf170a0210ac72e302538fb26e4/oslo_privsep/daemon.py#L210
[3] https://github.com/python/cpython/blob/b5409dacc4885146a27d06482b346e55fa12d2ec/Lib/logging/__init__.py#L415

Changed in oslo.privsep:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.privsep (master)

Fix proposed to branch: master
Review: https://review.openstack.org/638216

Changed in oslo.privsep:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.privsep (master)

Reviewed: https://review.openstack.org/638216
Committed: https://git.openstack.org/cgit/openstack/oslo.privsep/commit/?id=c9cec8e87b0f8aaa08fb689fc950ca438e5977c3
Submitter: Zuul
Branch: master

commit c9cec8e87b0f8aaa08fb689fc950ca438e5977c3
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Wed Feb 20 16:40:44 2019 +0000

    Convert dict keys received in _ClientChannel from byte to str

    When executing in debug mode, the arguments passed to [1] are stored
    in a dictionary populated with bytes instead of strings. When in [2]
    "record" is created and updated [3], the values contained in "msg[1]"
    are not updated in "record"

    This patch converts all keys in byte format to string (Python 3).

    [1] https://github.com/openstack/oslo.privsep/blob/130d7155c4dcbbf170a0210ac72e302538fb26e4/oslo_privsep/comm.py#L128
    [2] https://github.com/openstack/oslo.privsep/blob/130d7155c4dcbbf170a0210ac72e302538fb26e4/oslo_privsep/daemon.py#L210
    [3] https://github.com/python/cpython/blob/b5409dacc4885146a27d06482b346e55fa12d2ec/Lib/logging/__init__.py#L415

    Change-Id: Idec9ecc9fcc8c5b6779e0194a16cd861c7895d7e
    Closes-Bug: #1816804

Changed in oslo.privsep:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.privsep 1.33.0

This issue was fixed in the openstack/oslo.privsep 1.33.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.