bayserver-docker-cgi 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 026b08fd6b265203501cda3e9e9773fe454e6fdf976ebeee9b61213e64f9c6fa
4
- data.tar.gz: 218a642cb48c9dbe00c2c4a61168149d6d1299bc2633af532c978b0564ccaa5a
3
+ metadata.gz: f70194757e9c4347167411f22f25db380b4805795646ca94d862523b359e3a56
4
+ data.tar.gz: f308a4b899c6911f1ca487377acffd532072433b9b9856ec28d17e25ff58f2a9
5
5
  SHA512:
6
- metadata.gz: 4df74f7890b2d04f99fdf77c5d5dfef52a5fe92701be2b9973ae03b5e9e24637a712258456ef4288ae526962d2a00137c145394456c2a876b4017eaba0cced57
7
- data.tar.gz: f1b03d78cd01ac5ff46ec8e7bc0bda82c3df6b4958168f4f3b4378d1fbc7f706bf0f31a6da7725a700570f6ba7011c4eb1796cae88d24a97d09c776c592e84be
6
+ metadata.gz: 0b4158f7da8f7576632fdf8d3df6e91581e10c43dd4de08ffd5f01aae9357fe6a3260c9ab6b89202f7e2d340c9f8d653d39c12e45ad18bf58578d4d8f994a154
7
+ data.tar.gz: 7fbc50159631dc800b67a4b1e14296b17ae87104913d81304f7d942bb74d7808a1f9826ec9c597ec2e436c111a855b02a63eae479276a64618d81f316ad6e778
@@ -164,11 +164,11 @@ module Baykit
164
164
  end
165
165
 
166
166
  def sub_process_count
167
- return @process_count -= 1
167
+ @process_count -= 1
168
168
  end
169
169
 
170
170
  def sub_wait_count
171
- return @wait_count -= 1
171
+ @wait_count -= 1
172
172
  end
173
173
  end
174
174
  end
@@ -38,14 +38,20 @@ module Baykit
38
38
  attr :last_access
39
39
  attr_accessor :multiplexer
40
40
  attr :env
41
+ attr :buffers
41
42
 
42
43
  def initialize(cgi_docker, tur, env)
43
44
  @cgi_docker = cgi_docker
44
45
  @tour = tur
45
46
  @tour_id = tur.tour_id
46
47
  @env = env
48
+ @pid = 0
49
+ @std_in_rd = nil
50
+ @std_out_rd = nil
51
+ @std_err_rd = nil
47
52
  @std_out_closed = true
48
53
  @std_err_closed = true
54
+ @buffers = []
49
55
  end
50
56
 
51
57
  ######################################################
@@ -64,9 +70,12 @@ module Baykit
64
70
  def on_read_req_content(tur, buf, start, len, &callback)
65
71
  BayLog.debug("%s CGI:onReadReqContent: len=%d", tur, len)
66
72
 
67
- wrote_len = @std_in_rd.write(buf[start, len])
68
- BayLog.debug("%s CGI:onReadReqContent: wrote=%d", tur, wrote_len)
69
- tur.req.consumed(Tour::TOUR_ID_NOCHECK, len, &callback)
73
+ if @pid != 0
74
+ write_to_std_in(tur, buf, start, len, &callback)
75
+ else
76
+ # postponed
77
+ @buffers << [buf[start, len].dup, callback]
78
+ end
70
79
  access()
71
80
  end
72
81
 
@@ -135,6 +144,11 @@ module Baykit
135
144
  @std_err_rd = IORudder.new(std_err[0])
136
145
  BayLog.debug("#{@tour} PID: #{pid}")
137
146
 
147
+ @buffers.each do |pair|
148
+ BayLog.debug("%s write postponed data: len=%d", @tour, pair[0].length)
149
+ write_to_std_in(@tour, pair[0], 0, pair[0].length, &pair[1])
150
+ end
151
+
138
152
  @std_out_closed = false
139
153
  @std_err_closed = false
140
154
 
@@ -233,6 +247,12 @@ module Baykit
233
247
  return duration_sec > @cgi_docker.timeout_sec
234
248
  end
235
249
 
250
+ def write_to_std_in(tur, buf, start, len, &callback)
251
+ wrote_len = @std_in_rd.write(buf[start, len])
252
+ BayLog.debug("%s CGI:onReadReqContent: wrote=%d", tur, wrote_len)
253
+ tur.req.consumed(Tour::TOUR_ID_NOCHECK, len, &callback)
254
+ end
255
+
236
256
  def process_finished()
237
257
  BayLog.debug("%s CGI Process finished: pid=%s", @tour, @pid)
238
258
 
@@ -57,17 +57,17 @@ module Baykit
57
57
  end
58
58
 
59
59
  def notify_eof()
60
- BayLog.debug("agt#%d CGI stderr EOF\\(^o^)/", @agent_id)
60
+ BayLog.debug("%s CGI stderr EOF\\(^o^)/ tur=%s", self, @tour)
61
61
  return NextSocketAction::CLOSE
62
62
  end
63
63
 
64
64
  def notify_close()
65
- BayLog.debug("agt#%d CGI stderr notifyClose", @agent_id)
65
+ BayLog.debug("%s CGI stderr notifyClose tur=%s", self, @tour)
66
66
  @handler.std_err_closed()
67
67
  end
68
68
 
69
69
  def check_timeout(duration_sec)
70
- BayLog.debug("%s stderr Check timeout: dur=%d", @tour, duration_sec)
70
+ BayLog.debug("%s stderr Check timeout: tur=%s dur=%d", self, @tour, duration_sec)
71
71
  return @handler.timed_out()
72
72
  end
73
73
 
@@ -57,7 +57,7 @@ module Baykit
57
57
 
58
58
  def notify_read(buf)
59
59
  @file_wrote_len += buf.length
60
- BayLog.trace("%s read file %d bytes: total=%d", self, buf.length, @file_wrote_len)
60
+ BayLog.debug("%s on read (len=%d total=%d)", self, buf.length, @file_wrote_len)
61
61
 
62
62
  pos = 0
63
63
  if @header_reading
@@ -132,25 +132,25 @@ module Baykit
132
132
  end
133
133
 
134
134
  def notify_error(e)
135
- BayLog.debug_e(e, "%s CGI notifyError", self)
135
+ BayLog.debug_e(e, "%s CGI notifyError tur=%s", self, @tour)
136
136
  end
137
137
 
138
138
  def notify_eof()
139
- BayLog.debug("%s stdout EOF(^o^)", @tour)
139
+ BayLog.debug("%s stdout EOF(^o^) tur=%s", self, @tour)
140
140
  return NextSocketAction::CLOSE
141
141
  end
142
142
 
143
143
  def notify_close()
144
- BayLog.debug("%s stdout notifyClose", @tour)
144
+ BayLog.debug("%s stdout notifyClose tur=%s", self, @tour)
145
145
  @handler.std_out_closed()
146
146
  end
147
147
 
148
148
  def check_timeout(duration_sec)
149
- BayLog.debug("%s Check StdOut timeout: dur=%d", @tour, duration_sec)
149
+ BayLog.debug("%s Check StdOut timeout: tur=%s dur=%d", self, @tour, duration_sec)
150
150
 
151
151
  if @handler.timed_out()
152
152
  # Kill cgi process instead of handing timeout
153
- BayLog.warn("%s Kill process!: %d", @tour, @handler.pid)
153
+ BayLog.warn("%s Process timed out! Kill process!: tur=%s pid=%d", self, @tour, @handler.pid)
154
154
  Process.kill("KILL", @handler.pid)
155
155
  return true
156
156
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bayserver-docker-cgi
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michisuke-P
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-17 00:00:00.000000000 Z
11
+ date: 2024-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bayserver-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.2
19
+ version: 3.0.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.2
26
+ version: 3.0.3
27
27
  description: BayServer is one of the high-speed web servers. It operates as a single-threaded,
28
28
  asynchronous server, which makes it exceptionally fast. It also supports multi-core
29
29
  processors, harnessing the full potential of the CPU's capabilities.