fix bug:try to write the failed meesage to file,need lock first.
Merge remote-tracking branch 'origin/ssl' into ssl