Merged
Conversation
Contributor
|
This may be papering over an issue with the core agent. Since the socket is already connected, communication with the core agent should be very fast. It's possible the core agent is blocked somewhere it shouldn't be. @cschneid |
Contributor
Author
|
Agree it's papering over an issue, but after debugging on Slack we don't seem to have found a cause? @cschneid what do you think about merging this? |
Both @naohiro-t and I have seen the socket time out during startup only to reconnect shortly after: ``` 2019-08-30T09:25:10+0100 DEBUG Parsing Core Agent manifest path: /tmp/scout_apm_core/scout_apm_core-v1.1.8-x86_64-apple-darwin/manifest.json 2019-08-30T09:25:10+0100 DEBUG Core Agent manifest json: {u'core_agent_version': u'1.1.8', u'core_agent_binary': u'core-agent', u'version': u'1.1.8', u'core_agent_binary_sha256': u'2896f584cb373c596164805510531a34b29e4eb34a13685edd4c6df364161414'} [2019-08-30T08:25:10][core_agent][INFO] Initializing logger with log level: Info 2019-08-30T09:25:11+0100 DEBUG CoreAgentSocket thread exception: timeout('timed out',) Traceback (most recent call last): File "/Users/chainz/Documents/Projects/scout_apm_python/src/scout_apm/core/socket.py", line 105, in run result = self._send(body) File "/Users/chainz/Documents/Projects/scout_apm_python/src/scout_apm/core/socket.py", line 174, in _send self._read_response() File "/Users/chainz/Documents/Projects/scout_apm_python/src/scout_apm/core/socket.py", line 184, in _read_response raw_size = self.socket.recv(4) timeout: timed out 2019-08-30T09:25:11+0100 DEBUG CoreAgentSocket thread stopped. 2019-08-30T09:25:11+0100 DEBUG CoreAgentSocket attempt 1, connecting to /tmp/scout_apm_core/scout_apm_core-v1.1.8-x86_64-apple-darwin/scout-agent.sock, PID: 90625, Thread: <CoreAgentSocket(Thread-1, started daemon 123145439891456)> 2019-08-30T09:25:11+0100 DEBUG Monkey patched SQL 2019-08-30T09:25:11+0100 DEBUG CoreAgentSocket is connected ``` A bump up to a 3 second timeout seems to fix it - at least on my machine. I guess the biggest risk of a too-fast timeout is continually reconnecting and re-registering when a server is low on CPU cycles, which would amplify the CPU usage of the library/agent. A longer timeout seems appropriate and unlikely to cause problems because this happens in a background thread.
74688f2 to
c1b55b6
Compare
Contributor
Author
|
Merged after discussion on Slack - there may still be some sticking points in the core agent as @cschneid said. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both @naohiro-t and I have seen the socket time out during startup only to reconnect shortly after:
A bump up to a 3 second timeout seems to fix it - at least on my machine.
I guess the biggest risk of a too-fast timeout is continually reconnecting and re-registering when a server is low on CPU cycles, which would amplify the CPU usage of the library/agent. A longer timeout seems appropriate and unlikely to cause problems because this happens in a background thread.