matador
matador copied to clipboard
In multithread :terminate called after throwing an instance of 'matador::database_error' what(): Authentication plugin 'mysql_native_password' cannot be loaded: not initialized
i use persistence in multithead, debug it , it will stop there, persistence p(MYSQL_LINK); and give a msg
terminate called after throwing an instance of 'matador::database_error' what(): Authentication plugin 'mysql_native_password' cannot be loaded: not initialized
I'll take a look into it. You start a connection within a thread. You get this error when the thread terminates or starts?
before it ,another thread have run the codes for another table in the same db; persistence p(MYSQL_LINK);
I have replace persistence with query , only one persistence in the main thread. other thread use query.
With using only one persistence object is the correct way. Using multiple persistence objects on the same database will cause unspecified behavior. This is because every persistence object has an underlaying object_store which keeps the data loaded from the database.
Try to create just one persistence object and from that create multiple sessions and use them in your threads.
I think I'll write a kind of howto/advice using matador in a multithreded environment.
I try to use query with one global conn , in multithread , It will crash too, then I add mutex ,only one query can be run , It be normal. I don't know if Mulitpe seesions with on persistence in multithread run normally.