I will post the info I get so far in case some one interested
Now I can narrow down the problem to: when use unicorn, object within Scheduler::Defer.later block will lost their instance_variables
a = "1"
a.instance_variable_set('@a', 1)
Rails.logger.error(a.instance_values) # => {"a"=>1}
Scheduler::Defer.later("Create Upload") do
Rails.logger.error(a.instance_values) # => nothing
end
If I start a console by rails c and run above code, the result is as expected,
after switch to thin, image upload works
unicorn also not work on my development machine, which is ubuntu, but the result is a little bit different: the instance_varialbes remains, but the tempfile is show closed, call path on that return nil
{"tempfile"=>#<Tempfile: (closed)>, "original_filename"=>"favicons.png", "content_type"=>"image/png", "headers"=>"Content-Disposition: form-data; name=\"files[]\"; filename=\"favicons.png\"\r\nContent-Type: image/png\r\n"}