dlz_bind9 has to count the number of times the plugin is 'created' by bind's plugin manager so it doesn't repeat setup. Logging doesn't reflect this reference counting logic properly and so messages like "samba_dlz: shutdown" can, confusingly, come up when the database connection has not actually been severed.
Note: I'm creating this bug for a patch that I've already written.
Fixed in master with 3713905f8b4baa56b1bf571f71009cd77ccda6eb for Samba 4.10.
Backport for 4.9 to be attached.
Created attachment 14749 [details]
backported patch for 4.9
To learn more about what is going on here, backporting the debug messages to 4.9 makes sense.