Mixture model is difficult to inference, there are quite a few discussion on this discourse, e.g. Properly sampling mixture models
Also note that the Dirichlet process mixture example need some update, it is generally a hard problem - I would change the inference to ADVI and check the model fitting very carefully (as the result is generally biased).