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

DaemonBase: object has no attribute 'syslog' #4034

Closed
jleveque opened this issue Jan 17, 2020 · 5 comments
Closed

DaemonBase: object has no attribute 'syslog' #4034

jleveque opened this issue Jan 17, 2020 · 5 comments
Labels

Comments

@jleveque
Copy link
Contributor

In the signal_handler() method, the DaemonBase class references member object "syslog", but it doesn't exist (see https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-daemon-base/sonic_daemon_base/daemon_base.py; lines 105, 107, 110, 113). Unsure if DaemonBase was intended to be derived from the Logger class, or if it was meant to instantiate a Logger member object and reference that instead.

pmon#supervisord: ledd Traceback (most recent call last):
pmon#supervisord: ledd   File "/usr/bin/ledd", line 118, in <module>
pmon#supervisord: ledd     main()
pmon#supervisord: ledd   File "/usr/bin/ledd", line 115, in main
pmon#supervisord: ledd     ledd.run()
pmon#supervisord: ledd   File "/usr/bin/ledd", line 90, in run
pmon#supervisord: ledd     (state, c) = sel.select(SELECT_TIMEOUT)
pmon#supervisord: ledd   File "/usr/lib/python2.7/dist-packages/swsscommon/swsscommon.py", line 808, in select
pmon#supervisord: ledd     return _swsscommon.Select_select(self, timeout)
pmon#supervisord: ledd   File "/usr/local/lib/python2.7/dist-packages/sonic_daemon_base/daemon_base.py", line 110, in signal_handler
pmon#supervisord: ledd     self.syslog.syslog(self.syslog.LOG_INFO, "Caught SIGTERM - exiting...")
pmon#supervisord: ledd AttributeError: 'DaemonLedd' object has no attribute 'syslog'
@jleveque
Copy link
Contributor Author

@stephenxs: Can you please look into this? It appears as though it was introduced by your PR #3281

@stephenxs
Copy link
Collaborator

@jleveque sure, will check it.

@msosyak
Copy link
Contributor

msosyak commented Jan 17, 2020

I guess that self. before syslog is redundant as syslog is a module imported, not a member of some class.

@stephenxs
Copy link
Collaborator

Hi @jleveque,
Originally syslog was a module imported in daemon_base.py, introducing an issue which was fixed in PR 3281. The PR was intended to introduce a logic to enforce class Logger is destroyed ahead of module syslog being destroyed by define module syslog as a member of class Logger. It has nothing to do with the DaemonBase class.
So I think @msosyak is right. The self. before syslog is redundant because syslog isn't a member of DaemonBase class.

@stephenxs
Copy link
Collaborator

Hi @jleveque , I create a draft PR to resolve this issue. can you take a look? # 4039

@lguohan lguohan closed this as completed Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants