8000 agent: run threads safely by assafgi · Pull Request #61 · weka/talker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

agent: run threads safely #61

New issue

Have a question about th 8000 is 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

Merged
merged 4 commits into from
Dec 22, 2019
Merged

agent: run threads safely #61

merged 4 commits into from
Dec 22, 2019

Conversation

assafgi
Copy link
Collaborator
@assafgi assafgi commented Dec 5, 2019

No description provided.

Copy link
Contributor
@doron-cohen doron-cohen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about a simple test to reproduce the bug we had?



class SafeThread(threading.Thread):
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make the name argument non optional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also I think all arguments should be keyword arguments to avoid confusion

< 8000 tr>
def run(self):
global first_exception_info
try:
if self._target:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and if not?

self._target(*self._args, **self._kwargs)
except:
exc_info = sys.exc_info()
logger.debug("exception in '%s'", self.name, exc_info=exc_info)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better log this to info so it will get to the machine's syslog

exc_info = sys.exc_info()
logger.debug("exception in '%s'", self.name, exc_info=exc_info)
if not first_exception_info:
first_exception_info = sys.exc_info()
Copy link
Contributor
8000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be wrapped with a lock?

Copy link
Contributor
@doron-cohen doron-cohen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets add a test and update changelog

8000
CHANGELOG.md Outdated
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- make all agent threads thread-safe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really a user facing change. maybe a bug fix

@assafgi assafgi merged commit 698e651 into master Dec 22, 2019
@assafgi assafgi deleted the 6A30 agent-thread-safe branch December 22, 2019 14:57
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
0