meta_element insertion can cause archiving errors in XNAT when archiving many studies at once

Description

When you send several small studies to XNAT's CSTORE receiver sequentially without delay, XNAT tends to encounter errors. In particular, I sent around 1000 studies, and around 10 ended up in "Error" state in the prearchive instead of autoarchiving correctly. The most common way this manifests which we’re tackling in 1.8.8 is shown in the screenshot.

Environment

None

QA Notes

None

Attachments

1
  • 21 Apr 2022, 10:23 PM

Activity

Show:

Charlie Moore April 13, 2023 at 8:35 PM

I’ve been spamming my XNAT with sessions over and over today and haven’t seen this once, so I’m cautiously optimistic we’re good to go slightly smiling face

Charlie Moore April 5, 2023 at 5:53 PM

If you start up XNAT on a fresh database now, you get this pretty scary-looking message in configuration.log from these changes:

2023-04-05 12:46:13,638 [taskScheduler-1] ERROR org.nrg.xnat.initialization.InitializingTasksExecutor - An error occurred while running the task Initialize all caches that implement the Initializing interface., 1 incomplete tasks found. org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT xdat_meta_element_id, element_name FROM xdat_meta_element WHERE element_name IN ()]; nested exception is org.postgresql.util.PSQLException: ERROR: syntax error at or near ")" Position: 89 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:230) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:654) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:688) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:715) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:765) at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:192) at org.nrg.xnat.services.cache.DefaultCacheManager.initializeXdatMetaElements(DefaultCacheManager.java:346) at org.nrg.xnat.services.cache.DefaultCacheManager.initialize(DefaultCacheManager.java:129) at org.nrg.xnat.initialization.tasks.InitializeCachesTask.processUninitializedCaches(InitializeCachesTask.java:92) at org.nrg.xnat.initialization.tasks.InitializeCachesTask.callImpl(InitializeCachesTask.java:50) at org.nrg.xnat.initialization.tasks.AbstractInitializingTask.call(AbstractInitializingTask.java:31) at org.nrg.xnat.initialization.tasks.AbstractInitializingTask.call(AbstractInitializingTask.java:18) at org.nrg.xnat.initialization.InitializingTasksExecutor$CheckTasks.runTask(InitializingTasksExecutor.java:61) at org.nrg.xnat.task.AbstractXnatRunnable.run(AbstractXnatRunnable.java:33) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near ")" Position: 89 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2510) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2245) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:311) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:447) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:368) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:159) at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:109) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:696) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:638) ... 20 common frames omitted
Flagged
Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Due date

Product Team

Core

Start date

Sprint

Fix versions

Priority

More fields

Zendesk Support

Clockify

Created April 21, 2022 at 10:22 PM
Updated October 11, 2023 at 2:54 PM
Resolved April 6, 2023 at 3:24 PM