Cherries from master for 3.6.x

Preparations for upgrading 3.6.x to include some recent changes in master.
Its purpose is as a start-point for reviewing what we want in 3.6.x.
This includes everything I've accepted into master except:
* @markburgess's branch (#1895)
* d23fee8997 @jooooooon's fix-timing-option (#1899), a fix to Mark's changes

and, of course, lots of merge commits.