bayserver-docker-cgi 3.0.2 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 026b08fd6b265203501cda3e9e9773fe454e6fdf976ebeee9b61213e64f9c6fa
4
- data.tar.gz: 218a642cb48c9dbe00c2c4a61168149d6d1299bc2633af532c978b0564ccaa5a
3
+ metadata.gz: 88a5c98d0a6278bc4939b376cfbca8567cef41fa4095f269bd4dcfe9d5d30664
4
+ data.tar.gz: a4a582dceedf85fe208d011f2b06124dd177a8c660a04533e888af7a920d73de
5
5
  SHA512:
6
- metadata.gz: 4df74f7890b2d04f99fdf77c5d5dfef52a5fe92701be2b9973ae03b5e9e24637a712258456ef4288ae526962d2a00137c145394456c2a876b4017eaba0cced57
7
- data.tar.gz: f1b03d78cd01ac5ff46ec8e7bc0bda82c3df6b4958168f4f3b4378d1fbc7f706bf0f31a6da7725a700570f6ba7011c4eb1796cae88d24a97d09c776c592e84be
6
+ metadata.gz: e9edb6724864c83d9ebd92b552de1caec5088564398e23c80ee3907646418c10d0f0ed6cbd641171656741e25ac08c00752482cd24534801d0c3255de664f910
7
+ data.tar.gz: 6c45895c8be3db7d8cc5935a283d123b206031d82c8be72bb61da12deea45466462469e16038c1c68234b9f9f3f60f42a980c7baa62a4e4be5453e0126fcddff
@@ -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
 
@@ -185,7 +199,7 @@ module Baykit
185
199
  RudderState.new(@std_out_rd, out_tp)
186
200
  )
187
201
 
188
- ship_id = @tour.ship.ship_id
202
+ ship_id = out_ship.ship_id
189
203
  @tour.res.set_consume_listener do |len, resume|
190
204
  if resume
191
205
  out_ship.resume_read(ship_id)
@@ -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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michisuke-P
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-17 00:00:00.000000000 Z
11
+ date: 2025-01-27 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.5
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.5
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.
@@ -45,7 +45,7 @@ homepage: https://baykit.yokohama
45
45
  licenses:
46
46
  - MIT
47
47
  metadata: {}
48
- post_install_message:
48
+ post_install_message:
49
49
  rdoc_options: []
50
50
  require_paths:
51
51
  - lib
@@ -60,8 +60,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  requirements: []
63
- rubygems_version: 3.1.6
64
- signing_key:
63
+ rubygems_version: 3.4.19
64
+ signing_key:
65
65
  specification_version: 4
66
66
  summary: AJP docker of BayServer
67
67
  test_files: []