Deadlock error when using HAProxy with Maria Galera Cluster

Hi Experts,

I use HaProxy as load-balancing for Galera Cluster (2-3 node). And I get a error "Deadlock found when trying to get lock; try restarting transaction" when insert/update through HaProxy to Galera Nodes.

How I fix this errors.

Thanks so much!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It is not possible that galera cluster finds deadlocks on its own. Please post clashing SQL update statements/transactions, as they will clash on any setup.
ldvhaiAuthor Commented:
Sorry for late, It's OK with galera cluster . But if I use HAProxy, I get Deadlock error like this post:

Avoiding Deadlocks in Galera - Set up HAProxy for single-node writes and multi-node reads

So, if I config HA like above, what's my app config need to connect to DB ?
You need to wrap 4 dependent updates in a transaction even for single concurrently accessed database.
galera+haproxy just adds some time jitter and aggravates problem originally in your SQL code that you refuse to share.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ldvhaiAuthor Commented:

Sorry for my late, in my country are the Tết holidays, so I'm busy with some works and can't reply soon.

I test galera cluster with mysql-proxy in command-line, it's seem OK. I think Galera Cluster fixed transaction itself.

Thanks for your help!!
You need to fix SQL, otherwise it will keep returning.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.