Skip to content

Conversation

@pglombardo
Copy link
Contributor

If the Python garbage collector is disabled, we were assuming the initialisation of a variable causing the following:

Traceback (most recent call last):
  File "/Users/pglombardo/.pyenv/versions/3.7.2/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/Users/pglombardo/.pyenv/versions/3.7.2/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/pglombardo/Projects/instana/python-sensor/instana/meter.py", line 149, in collect_and_report
    self.process()
  File "/Users/pglombardo/Projects/instana/python-sensor/instana/meter.py", line 161, in process
    cm = self.collect_metrics()
  File "/Users/pglombardo/Projects/instana/python-sensor/instana/meter.py", line 310, in collect_metrics
    gc=g)
UnboundLocalError: local variable 'g' referenced before assignment

This PR fixes the logic when the GC is disabled and adds more safety to that function (collect_metrics);

@pglombardo pglombardo merged commit f7000d1 into master Mar 8, 2019
@pglombardo pglombardo deleted the fix-when-gc-disabled branch March 8, 2019 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants