Crowd Crashes Due to 'PSQLException: ERROR: prepared statement "S_1" does not exist'
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
Crowd crashes or can't be started due to the following error:
1
PSQLException: ERROR: prepared statement "S_1" does not exist
Cause
PgBouncer is used in transaction mode by default for all PostgreSQL connections, which breaks JDBC's default PREPARED STATEMENT handling.
Resolution
The ?prepareThreshold=0 argument must be used on Crowd string connection configured in the crowd.cfg.xml file located under <crowd-home>/crowd.cfg.xml. Example:
1
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/dbname?prepareThreshold=0</property>
This will show on the starting Crowd logs:
1
jdbcUrl -> jdbc:postgresql://localhost:5432/dbname?prepareThreshold=0, properties -> {user=******, password=******} ],
If the issue persists after setting the parameter, you'll need to update the PostgreSQL JDBC4 driver used to 9.3 or newer due to this PgSQL bug: http://pgbouncer.projects.pgfoundry.org/doc/faq.html#_disabling_prepared_statements_in_jdbc
JDBC4 download link: https://jdbc.postgresql.org/download.html
Move the driver to <crowd-install>/apache-tomcat/lib and make sure to remove older JDBC driver from that directory before restarting your Crowd instance.
ℹ️ This procedure should work with other Atlassian tools that present this issue too.
Was this helpful?