I got a reply from my colleague working on it, and it turns out we have changed the solution to this one:
- https://p11-glue.github.io/p11-glue/p11-kit.html
- https://p11-glue.github.io/p11-glue/p11-kit/manual/remoting.html
It has better code quality and documentation, and is much more stable.