Skip to content

Commit d3a8626

Browse files
tests: suspected memory leak of 160-disable-init-by-lua.t when test with TEST_NGINX_CHECK_LEAK=1 because forgot to close the file. (#1877)
1 parent 14ef2cb commit d3a8626

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

t/160-disable-init-by-lua.t

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ my $http_config = <<_EOC_;
3333
end
3434
3535
assert(f:write(conf))
36+
f:close()
3637
3738
return conf_file
3839
end
@@ -85,6 +86,8 @@ __DATA__
8586
else
8687
ngx.log(ngx.WARN, out)
8788
end
89+
p:close()
90+
collectgarbage("collect")
8891
}
8992
}
9093
--- error_log
@@ -115,6 +118,7 @@ qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
115118
else
116119
ngx.log(ngx.WARN, out)
117120
end
121+
p:close()
118122
119123
local cmd = nginx .. " -p $TEST_NGINX_HTML_DIR -c " .. conf_file .. " -T"
120124
local p, err = io.popen(cmd)
@@ -130,6 +134,8 @@ qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
130134
else
131135
ngx.log(ngx.WARN, out)
132136
end
137+
p:close()
138+
collectgarbage("collect")
133139
}
134140
}
135141
--- error_log
@@ -171,6 +177,7 @@ qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
171177
else
172178
ngx.log(ngx.WARN, out)
173179
end
180+
p:close()
174181
175182
local cmd = nginx .. " -p $TEST_NGINX_HTML_DIR -c " .. conf_file .. " -T"
176183
local p, err = io.popen(cmd)
@@ -186,6 +193,8 @@ qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
186193
else
187194
ngx.log(ngx.WARN, out)
188195
end
196+
p:close()
197+
collectgarbage("collect")
189198
}
190199
}
191200
--- error_log

0 commit comments

Comments
 (0)