FHIR Chat · Hapi 3.0.0 server searching with codes · implementers

Stream: implementers

Topic: Hapi 3.0.0 server searching with codes


view this post on Zulip Christopher Schuler (Sep 07 2017 at 21:11):

So I posted a question a while back in the hapi stream, but never got an answer. I'll try again here. Perhaps @James Agnew or someone else familiar with hapi will know the answer.

The issue is with a search involving a list of codes like the following:

<BASE>/Condition?code=http%3A%2F%2Fsnomed.info%2Fsct%7C109838007,http%3A%2F%2Fsnomed.info%2Fsct%7C1701000119104,http%3A%2F%2Fsnomed.info%2Fsct%7C187757001,http%3A%2F%2Fsnomed.info%2Fsct%7C187758006,http%3A%2F%2Fsnomed.info%2Fsct%7C447395005,http%3A%2F%2Fsnomed.info%2Fsct%7C269544008,http%3A%2F%2Fsnomed.info%2Fsct%7C285312008&patient=Patient-12214

That search causes my hapi server to complain with the following stack trace:

org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:526)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:150)
    at ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl$SearchTask.saveSearch(SearchCoordinatorSvcImpl.java:586)
    at ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl$SearchTask.call(SearchCoordinatorSvcImpl.java:444)
    at ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl$SearchTask.call(SearchCoordinatorSvcImpl.java:402)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    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:748)
Caused by: javax.persistence.RollbackException: Error while committing the transaction
    at org.hibernate.internal.ExceptionConverterImpl.convertCommitException(ExceptionConverterImpl.java:75)
    at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:71)
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517)
    ... 10 common frames omitted
Caused by: java.lang.NullPointerException: null
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeBatchElement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeLargeBatch(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeBatch(Unknown Source)
    at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
    at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
    at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:111)
    at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:97)
    at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:147)
    at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.executeBatch(JdbcCoordinatorImpl.java:206)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:618)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:463)
    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1435)
    at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:491)
    at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3201)
    at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2411)
    at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:467)
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:146)
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:220)
    at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
    ... 11 common frames omitted

However, if the code list has 5 codes or less, then it works fine.

My question is why does the search fail with more than 5 codes and how can I prevent that?

Thanks

view this post on Zulip James Agnew (Sep 07 2017 at 21:29):

Hi @Christopher Schuler , Bryn just pointed me to this :)

What version of HAPI are you using? I'm not able to reproduce this so I'm wondering if this is version specific or related to the data in your DB, or something else entirely?

The following works, for example:
http://fhirtest.uhn.ca/baseDstu3/Observation?code=http%3A%2F%2Fsnomed.info%2Fsct|109838007,http%3A%2F%2Fsnomed.info%2Fsct|1701000119104,http%3A%2F%2Fsnomed.info%2Fsct|187757001,http%3A%2F%2Fsnomed.info%2Fsct|187758006,http%3A%2F%2Fsnomed.info%2Fsct|447395005,http%3A%2F%2Fsnomed.info%2Fsct|269544008,http%3A%2F%2Fsnomed.info%2Fsct|285312008

view this post on Zulip Christopher Schuler (Sep 07 2017 at 21:30):

I am using HAPI 3.0.0-SNAPSHOT, but I also had the issue with 2.6 I believe.

view this post on Zulip James Agnew (Sep 07 2017 at 21:39):

just realized my example was for the wrong resource type.. this works too though: http://fhirtest.uhn.ca/baseDstu3/Condition?code=http%3A%2F%2Fsnomed.info%2Fsct|109838007,http%3A%2F%2Fsnomed.info%2Fsct|1701000119104,http%3A%2F%2Fsnomed.info%2Fsct|187757001,http%3A%2F%2Fsnomed.info%2Fsct|187758006,http%3A%2F%2Fsnomed.info%2Fsct|447395005,http%3A%2F%2Fsnomed.info%2Fsct|269544008,http%3A%2F%2Fsnomed.info%2Fsct|285312008&patient=Patient/12375

Any idea what the data looks like on your server that is matching? Or are there any more parts to that stack trace, or other stack traces nearby in the log?

view this post on Zulip Bryn Rhodes (Sep 07 2017 at 21:45):

The data should be in this test bundle:

view this post on Zulip Bryn Rhodes (Sep 07 2017 at 21:45):

http://build.fhir.org/ig/cqframework/payerextract/test-data.html

view this post on Zulip Christopher Schuler (Sep 07 2017 at 22:12):

Additional stack trace info:

ca.uhn.fhir.rest.server.exceptions.InternalErrorException: null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newInstance(BaseServerResponseException.java:301)
    at ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl.verifySearchHasntFailedOrThrowInternalErrorException(SearchCoordinatorSvcImpl.java:398)
    at ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider.size(PersistedJpaSearchFirstPageBundleProvider.java:71)
    at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:248)
    at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:136)
    at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:858)
    at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:1453)
    at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1429)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:524)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:748)

Last updated: Apr 12 2022 at 19:14 UTC