DeDupe errors when Individuals have Membership (by relationship)
We have had a similar problem - https://gist.githubusercontent.com/deepak-srivastava/e3a440023621cd4ecbde3904f9b27d2c/raw/7d2e854aa4ad7a8f00d87581dca729623d5ba687/bto-membership-by-relationship-error.log

Seems like method createRelatedMemberships(&amp;$params, &amp;$dao, $reset = FALSE) in loop sometimes resets $params.
The while loop at the end of the function seems to be the cause. Don't see why anything from queue should reset it. 

Have developed a patch - https://github.com/deepak-srivastava/civicrm-core/commit/96fba9b2533b45d9baaef8b0f7ea43bc85ae0ee9

Seems to be working so far. We 'll test it a bit more, and if ok submit a PR to core. 
Meanwhile would you be able to confirm if the patch works for you?