Skip to content

Commit

Permalink
5.8.5 add debug log.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-X-Net committed Oct 26, 2023
1 parent e422731 commit 2c0965a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
5 changes: 3 additions & 2 deletions code/default/lib/noarch/front_base/http1.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ def work_loop(self):
self.last_send_time = time_now
self.last_recv_time = time_now

if self.processed_tasks > self.config.http1_max_process_tasks or self.is_life_end():
self.close("lift end")
life_end_reason = self.is_life_end()
if life_end_reason:
self.close("life_end:" + life_end_reason)
return

def request_task(self, task):
Expand Down
17 changes: 11 additions & 6 deletions code/default/lib/noarch/front_base/http_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,19 @@ def get_host(self, task_host):
def is_life_end(self):
now = time.time()
if now > self.life_end_time:
return True
return "life_end_time"
elif now - self.last_recv_time > 230:
return True
return "last_recv_time"
elif self.continue_fail_tasks > self.config.dispather_worker_max_continue_fail:
return True
return "continue_fail"
elif self.processed_tasks > self.config.http2_max_process_tasks:
return True
elif self.version == "1.1" and now - self.last_recv_time > self.config.http1_idle_time:
return True
return "processed_tasks"
elif self.version == "1.1":
if self.processed_tasks > self.config.http1_max_process_tasks:
return "http1 max_process_tasks"
elif now - self.last_recv_time > self.config.http1_idle_time:
return "http1 last_recv_time"
else:
return False
else:
return False
3 changes: 2 additions & 1 deletion code/default/lib/noarch/front_base/http_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ def _remove_life_end_workers(self):
to_close.append(worker)

for worker in to_close:
worker.close("life end")
reason = worker.is_life_end()
worker.close("life end:" + reason)
if worker in self.workers:
try:
self.workers.remove(worker)
Expand Down
4 changes: 2 additions & 2 deletions code/default/lib/noarch/simple_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def recv(self, to_read=8192, timeout=30.0):
try:
return self.sock.recv(to_read)
except (BlockingIOError, socket.error) as e:
if e.errno in [2, 11, 35, 10035]:
if e.errno in [2, 11, 35, 60, 10035]:
time_left = end_time - time.time()
if time_left < 0:
break
Expand Down Expand Up @@ -315,7 +315,7 @@ def _read_size(self, read_len, timeout):
try:
nbytes = self.sock.recv_into(view[out_len:], to_read)
except (BlockingIOError, socket.error) as e:
if e.errno in [2, 11, 35, 10035]:
if e.errno in [2, 11, 35, 60, 10035]:
time_left = start_time + timeout - time.time()
if time_left < 0:
raise socket.timeout
Expand Down
2 changes: 1 addition & 1 deletion code/default/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.4
5.8.5
2 changes: 1 addition & 1 deletion code/default/x_tunnel/local/seley_front/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, fn):
# http1
self.set_var("http1_first_ping_wait", 0)
self.set_var("http1_ping_interval", 0)
self.set_var("http1_idle_time", 240)
self.set_var("http1_idle_time", 230)
self.set_var("http1_max_process_tasks", 999999)
self.set_var("http2_max_process_tasks", 999999)
self.set_var("http2_status_to_close", [404])
Expand Down

0 comments on commit 2c0965a

Please sign in to comment.