質問編集履歴

2

タグを追加しました。

2021/03/22 16:51

投稿

amaama
amaama

スコア2

test CHANGED
File without changes
test CHANGED
File without changes

1

unicornのログを追記しました

2021/03/22 16:51

投稿

amaama
amaama

スコア2

test CHANGED
File without changes
test CHANGED
@@ -124,6 +124,156 @@
124
124
 
125
125
 
126
126
 
127
+ ### 下記追記部分
128
+
129
+
130
+
131
+ unicorn.logの内容は以下のようになっております。
132
+
133
+ - [ec2-user@ip-10-0-0-81 log]$ tail -n 30 unicorn.log
134
+
135
+ ```
136
+
137
+ I, [2021-03-22T01:36:31.355738 #4728] INFO -- : worker=1 ready
138
+
139
+ E, [2021-03-22T01:36:43.528233 #4725] ERROR -- : reaped #<Process::Status: pid 4728 SIGKILL (signal 9)> worker=1
140
+
141
+ I, [2021-03-22T01:36:43.594661 #4777] INFO -- : worker=1 ready
142
+
143
+ E, [2021-03-22T01:47:48.197174 #4725] ERROR -- : reaped #<Process::Status: pid 4777 SIGKILL (signal 9)> worker=1
144
+
145
+ I, [2021-03-22T01:47:48.225454 #4803] INFO -- : worker=1 ready
146
+
147
+ E, [2021-03-22T01:47:54.994849 #4725] ERROR -- : reaped #<Process::Status: pid 4727 SIGKILL (signal 9)> worker=0
148
+
149
+ I, [2021-03-22T01:47:55.045782 #4805] INFO -- : worker=0 ready
150
+
151
+ E, [2021-03-22T01:52:21.252333 #4725] ERROR -- : reaped #<Process::Status: pid 4805 SIGKILL (signal 9)> worker=0
152
+
153
+ I, [2021-03-22T01:52:21.322827 #4863] INFO -- : worker=0 ready
154
+
155
+ E, [2021-03-22T02:04:10.536030 #4725] ERROR -- : reaped #<Process::Status: pid 4803 SIGKILL (signal 9)> worker=1
156
+
157
+ I, [2021-03-22T02:04:10.608788 #4950] INFO -- : worker=1 ready
158
+
159
+ I, [2021-03-22T02:06:44.892695 #4725] INFO -- : reaped #<Process::Status: pid 4863 exit 0> worker=0
160
+
161
+ I, [2021-03-22T02:06:44.893436 #4725] INFO -- : reaped #<Process::Status: pid 4950 exit 0> worker=1
162
+
163
+ I, [2021-03-22T02:06:44.893516 #4725] INFO -- : master complete
164
+
165
+ I, [2021-03-22T02:07:07.224906 #5059] INFO -- : Refreshing Gem list
166
+
167
+ I, [2021-03-22T02:07:11.107302 #5059] INFO -- : unlinking existing socket=/var/www/rails/(アプリ名)/tmp/sockets/.unicorn.sock
168
+
169
+ I, [2021-03-22T02:07:11.107987 #5059] INFO -- : listening on addr=/var/www/rails/(アプリ名)/tmp/sockets/.unicorn.sock fd=9
170
+
171
+ I, [2021-03-22T02:07:11.290183 #5059] INFO -- : master process ready
172
+
173
+ I, [2021-03-22T02:07:11.293872 #5061] INFO -- : worker=0 ready
174
+
175
+ I, [2021-03-22T02:07:11.295568 #5062] INFO -- : worker=1 ready
176
+
177
+ E, [2021-03-22T02:07:32.888086 #5059] ERROR -- : reaped #<Process::Status: pid 5061 SIGKILL (signal 9)> worker=0
178
+
179
+ I, [2021-03-22T02:07:33.041187 #5065] INFO -- : worker=0 ready
180
+
181
+ E, [2021-03-22T02:07:39.725917 #5059] ERROR -- : reaped #<Process::Status: pid 5062 SIGKILL (signal 9)> worker=1
182
+
183
+ I, [2021-03-22T02:07:39.761959 #5067] INFO -- : worker=1 ready
184
+
185
+ E, [2021-03-22T02:18:41.130358 #5059] ERROR -- : reaped #<Process::Status: pid 5065 SIGKILL (signal 9)> worker=0
186
+
187
+ I, [2021-03-22T02:18:41.228471 #5095] INFO -- : worker=0 ready
188
+
189
+ E, [2021-03-22T02:19:22.778405 #5059] ERROR -- : reaped #<Process::Status: pid 5095 SIGKILL (signal 9)> worker=0
190
+
191
+ I, [2021-03-22T02:19:22.818928 #5099] INFO -- : worker=0 ready
192
+
193
+ E, [2021-03-22T02:19:29.499385 #5059] ERROR -- : reaped #<Process::Status: pid 5067 SIGKILL (signal 9)> worker=1
194
+
195
+ I, [2021-03-22T02:19:29.534852 #5101] INFO -- : worker=1 ready
196
+
197
+
198
+
199
+ ```
200
+
201
+ また、unicorn.conf.rbの内容は以下のようになっています。(timeoutの秒数部分だけ参考サイトから変更しました)
202
+
203
+
204
+
205
+ ```ここに言語を入力
206
+
207
+ # set lets
208
+
209
+ $worker = 2
210
+
211
+ $timeout = 300
212
+
213
+ $app_dir = "/var/www/rails/(アプリ名)"
214
+
215
+ $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir
216
+
217
+ $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir
218
+
219
+ $std_log = File.expand_path 'log/unicorn.log', $app_dir
220
+
221
+ # set config
222
+
223
+ worker_processes $worker
224
+
225
+ working_directory $app_dir
226
+
227
+ stderr_path $std_log
228
+
229
+ stdout_path $std_log
230
+
231
+ timeout $timeout
232
+
233
+ listen $listen
234
+
235
+ pid $pid
236
+
237
+ # loading booster
238
+
239
+ preload_app true
240
+
241
+ # before starting processes
242
+
243
+ before_fork do |server, worker|
244
+
245
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
246
+
247
+ old_pid = "#{server.config[:pid]}.oldbin"
248
+
249
+ if old_pid != server.pid
250
+
251
+ begin
252
+
253
+ Process.kill "QUIT", File.read(old_pid).to_i
254
+
255
+ rescue Errno::ENOENT, Errno::ESRCH
256
+
257
+ end
258
+
259
+ end
260
+
261
+ end
262
+
263
+ # after finishing processes
264
+
265
+ after_fork do |server, worker|
266
+
267
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
268
+
269
+ end
270
+
271
+
272
+
273
+ ```
274
+
275
+
276
+
127
277
  #試したこと
128
278
 
129
279
  ec2インスタンスの再起動、Unicornの再起動、Nginxの再起動、