title: An unexpected change occurred after the parameter value was passed
body: <p>Runtime: lua 5.1 with openresty 1.17.8.2 compiled under x86_64.</p>
  <p>When I excute code as follow, a strange error happened:</p>
  <pre><code>-- code.lua
  local function _render_ini_file(agent_gen, uid, instance_data)
      local context = {}
      return agent_gen._render(agent_gen, 'realnode_ini', context, _get_realnode_ini_file(uid))
  end
  
  -- agent_gen.lua
  local function _render(self, category, context, file)
      ngx_log(ngx_NOTICE, 'Render ', category, ' to ', file)
      return file_ex.write(file, self.renders[category].render(context))
  end
  
  -- file_ex.lua
  function _M.write(filename, content, append)
      ngx_log(ngx_ERR, 'write filename: ', filename)
      local is_exist = libc_ex.file_exist(filename)
      local mode = append and 'a+' or 'w'
      local file, err = io.open(filename, mode)
      if not file then
          return _log_and_return_err('Failed to open ' .. filename .. ' for write: ' .. err)
      end
      if not is_exist then
          libc_ex.chmod(filename, libc_ex.S_IRWUSER)
      end
  
      local ok, err = file:write(content)
      if not ok then
          file:close()
          return _log_and_return_err('Failed to write ' .. filename .. ': ' .. err)
      end
      file:close()
      ngx_log(ngx_INFO, 'Write file ', filename, ' successful')
      return true
  end
  </code></pre>
  <p>And logs as follow:</p>
  <pre><code>[notice] 25539#0: *16220 [lua] agent_gen.lua:45: _render_ini_file(): Render realnode_ini to /config/realnode.ini, context: ngx.timer
  [error] 25539#0: *16220 [lua] file_ex.lua:42: _render_ini_file(): write filename: /config/realnode.ini, context: ngx.timer
  [error] 25539#0: *16220 [lua] file_ex.lua:42: write(): write filename: /config/, context: ngx.timer
  </code></pre>
  <p>It looks like the value of string chanded itself when parameter passing. In addition, the logs at the error level are printed twice.
  Any idea?</p>