简体   繁体   中英

InternalError: current transaction is aborted, commands ignored until end of transaction block

I'm getting this error when doing database calls in a sub process using multiprocessing library.

Visit : Pastie

InternalError: current transaction is aborted, commands ignored until end of transaction block

this is to a Postgre Database, using psycopg2 driver in web.py .

However if I use threading.Thread instead of multiprocessing.Process I don't get this error.
Any idea how to fix this?

multiprocessing works (on UNIX systems) by forking the current process. If you have an existing database connection, this will leave the two processes (the current one and the new one) with the same database connection. Trying to use it from both is bad. Create a new database connection in the child process instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM