Facing "prepared statement already exists" with Asterisk realtime ODBC

I’m facing the issue where this error shows up in Asterisk from time to time, and until I restart Asterisk, it just stops registering peers or do anything that requires ODBC access. Here’s exact error message:

10/12/2017 7:40:29 AM[Oct 12 11:40:29] WARNING[66141]: res_odbc.c:459 ast_odbc_print_errors: SQL Execute returned an error: HY000: ERROR: prepared statement “_PLAN0x7fbd4c00db10” already exists;

I’m using Asterisk 13.8-cert4, with PJSIP 1.5.5, and PJSIP is configured with realtime ODBC using PostgreSQL 9.5. Asterisk and PostgreSQL are running inside Docker containers. There are two instances of Asterisk/PostgreSQL pairs running, with each Asterisk connecting to it’s own database. Asterisks are not aware of each other, but PostgreSQL are being replicated in a masters/slave configuration using this image: https://hub.docker.com/r/danieldent/postgres-replication/

At this point, my best guess is it’s happening because of replication, but I’m not sure at this point. I will try stopping one of the Asterisk, and post the results here. I appreciate your response on this guys.


I don’t think I’ve seen this come up on the issue tracker or anywhere else. It is likely the result of your environment with the replication.