简体   繁体   English

InternalError:当前事务中止,命令被忽略,直到事务块结束

[英]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 造访: Pastie

InternalError: current transaction is aborted, commands ignored until end of transaction block InternalError:当前事务中止,命令被忽略,直到事务块结束

this is to a Postgre Database, using psycopg2 driver in web.py . 这是使用web.py psycopg2驱动程序的Postgre数据库。

However if I use threading.Thread instead of multiprocessing.Process I don't get this error. 但是,如果我使用threading.Thread而不是multiprocessing.Process ,则不会出现此错误。
Any idea how to fix this? 任何想法如何解决这个问题?

multiprocessing works (on UNIX systems) by forking the current process. 多处理通过分叉当前进程来工作(在UNIX系统上)。 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. 而是在子进程中创建一个新的数据库连接。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQLAlchemy + postgres:(InternalError)当前事务中止,命令被忽略,直到事务块结束 - SQLAlchemy + postgres : (InternalError) current transaction is aborted, commands ignored until end of transaction block django-当前事务中止,命令被忽略,直到事务块结束 - django - current transaction is aborted, commands ignored until end of transaction block DatabaseError:当前事务被中止,在事务块结束之前忽略命令? - DatabaseError: current transaction is aborted, commands ignored until end of transaction block? 错误:当前事务中止,创建新记录时命令被忽略,直到事务块结束 - Error: current transaction is aborted, commands ignored until end of transaction block while creating a new record DatabaseError:当前事务中止,命令被忽略,直到事务块结束-在隐身模式下,但正常情况下没有错误 - DatabaseError: current transaction is aborted, commands ignored until end of transaction block - in incognite mode but no error in normal 如何调试:内部错误当前事务被中止,命令被忽略直到事务块结束 - How to debug: Internal Error current transaction is aborted, commands ignored until end of transaction block 使用 Python 连接到 Redshift 数据 - 错误:当前事务被中止,命令被忽略,直到事务块结束 - Connecting to Redshift Data Using Python - Error: current transaction is aborted, commands ignored until end of transaction block django reg extension-当前事务中止,命令被忽略,直到事务块结束 - django reg extend - current transaction is aborted, commands ignored until end of transaction block psycopg2.errors.InFailedSqlTransaction:当前事务被中止,命令被忽略直到事务块结束 - psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block Django:通过添加m2m导致“当前事务中止,命令被忽略,直到事务块结束” - Django: Added m2m via through causes 'current transaction is aborted, commands ignored until end of transaction block'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM