We have had unavailable shares from deleted ldap users hang in the database, this is resolved by deleting old ldap users manually and if needed deleting invalid shares from the database.
I would first upgrade to 18.0.4, it could be a fixed bug.
To see if it is the same issue we have try the following on your server.
sudo -u www-data php occ ldap:show-remnants
sudo -u www-data php occ user:delete uidhere
In the database
select * from oc_share where uid_owner="deleteduseruidhere"
And delete any entry that shows up, be careful