Keep agent lanes alive after controller response failures
This commit is contained in:
@@ -12,6 +12,7 @@ import contextlib
|
||||
from datetime import datetime, timezone
|
||||
import math
|
||||
import hashlib
|
||||
import http.client
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
@@ -32,7 +33,7 @@ import urllib.parse
|
||||
import urllib.request
|
||||
import uuid
|
||||
|
||||
VERSION = "1.5.1"
|
||||
VERSION = "1.5.2"
|
||||
LABEL = "io.electric-cherry"
|
||||
MAX_FILE = 32 * 1024 * 1024
|
||||
MANIFEST_MAX_ENTRIES = 10000
|
||||
@@ -1099,7 +1100,7 @@ class Agent:
|
||||
raise AgentError("Controller redirects are not allowed")
|
||||
with urllib.request.build_opener(NoRedirect()).open(req, timeout=35) as response:
|
||||
return json.load(response)
|
||||
except (OSError, ValueError):
|
||||
except (OSError, ValueError, http.client.HTTPException):
|
||||
raise AgentError("Controller request failed") from None
|
||||
|
||||
def cpu_usage_percent(self):
|
||||
@@ -2354,6 +2355,8 @@ class Agent:
|
||||
self.heartbeat()
|
||||
except (AgentError, OSError, ValueError):
|
||||
pass
|
||||
except Exception as err:
|
||||
print(f"Heartbeat recovered from {type(err).__name__}", file=sys.stderr)
|
||||
|
||||
@staticmethod
|
||||
def read_operation(operation):
|
||||
@@ -2421,6 +2424,9 @@ class Agent:
|
||||
self.stopping.wait(0.25)
|
||||
except (AgentError, OSError, ValueError, KeyError, sqlite3.Error):
|
||||
self.stopping.wait(3)
|
||||
except Exception as err:
|
||||
print(f"{lane} lane recovered from {type(err).__name__}", file=sys.stderr)
|
||||
self.stopping.wait(3)
|
||||
finally:
|
||||
journal.close()
|
||||
|
||||
@@ -2475,6 +2481,9 @@ class Agent:
|
||||
break
|
||||
except (AgentError, OSError, ValueError):
|
||||
self.stopping.wait(3)
|
||||
except Exception as err:
|
||||
print(f"Initial heartbeat recovered from {type(err).__name__}", file=sys.stderr)
|
||||
self.stopping.wait(3)
|
||||
heartbeats = threading.Thread(target=self.heartbeat_loop, daemon=True)
|
||||
heartbeats.start()
|
||||
# Preserve two concurrent health checks even while files are being read.
|
||||
@@ -2488,6 +2497,8 @@ class Agent:
|
||||
except (AgentError, OSError, ValueError, KeyError):
|
||||
# Logs deliberately omit URLs, tokens, payloads and raw errors.
|
||||
print("Host controller contact unavailable; existing containers continue running", file=sys.stderr)
|
||||
except Exception as err:
|
||||
print(f"Write lane recovered from {type(err).__name__}", file=sys.stderr)
|
||||
self.stopping.wait(0.25 if completed else 3)
|
||||
for reader in readers:
|
||||
reader.join(timeout=2)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.2",
|
||||
"protocolVersion": 1,
|
||||
"platform": "debian-amd64",
|
||||
"sha256": "67003980127327d07144041d0c17b8adaa0d466b30b0ebf7508a80efd5cf6481",
|
||||
"sha256": "6e6a10a96f2392bf7595665bdff5b1b086d3446d5c43bd5770955aeebce9aa1d",
|
||||
"updaterProtocolVersion": 1,
|
||||
"updaterSha256": "066bb896726600ece9ce72697ce523c9a707cc9a621505931ba0892dec59d3c8"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user