Unique Constraint Error when adding workflows via GitHub Apps
See original GitHub issueDescribe the bug In a local dev build, I’m getting a constraint error when workflows get added from one .dockstore.yml
Curiously, the workflows still end up showing up afterwards in My Workflows. I don’t know why it didn’t rollback.
To Reproduce Steps to reproduce the behavior:
- Fork https://github.com/coverbeck/viral-pipelines
- Do a push for branch dockstore-test (simulated in this case with a local build)
- See error
- Go to My Workflows, you’ll see many
<username>/viral-pipelines
workflows (the .dockstore.yml defines many)
Expected behavior Ideally, there should be no error.
If there is something legit that is causing the error (?), we should try to catch it in Java code instead of letting Postgres catch it.
Screenshots GitHub App Logs show both success and failure.
Additional context
I did this commit c877e35fdf3cbb9b8618b20983e88609bf9ea019.
Somewhat concerned there is something in my setup that is causing this.
127.0.0.1 - - [18/Oct/2021:15:44:37 +0000] "POST /workflows/github/release HTTP/1.1" 204 0 "http://localhost:4200/api/static/swagger-ui/index.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:93.0) Gecko/20100101 Firefox/93.0" 183997
WARN [2021-10-18 15:44:37,744] org.hibernate.engine.jdbc.spi.SqlExceptionHelper: SQL Error: 0, SQLState: 23505
ERROR [2021-10-18 15:44:37,744] org.hibernate.engine.jdbc.spi.SqlExceptionHelper: ERROR: duplicate key value violates unique constraint "full_workflow_name"→ Detail: Key (sourcecontrol, organization, repository, workflowname)=(github.com, coverbeck, viral-pipelines, align_and_count_multiple_report) already exists.
INFO [2021-10-18 15:44:37,901] io.dockstore.webservice.helpers.GitHubSourceCodeRepo: Performing GitHub release for repository: coverbeck/viral-pipelines, user: coverbeck, and git reference: refs/heads/dockstore-test failed. Attempt had a starting rate limit of 6356 and ending rate limit of 6343
ERROR [2021-10-18 15:44:37,914] io.dockstore.webservice.resources.AbstractWorkflowResource: User coverbeck: Unhandled error while handling push event for repository coverbeck/viral-pipelines and reference refs/heads/dockstore-test→org.hibernate.exception.ConstraintViolationException: could not execute statement
! org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "full_workflow_name"
! Detail: Key (sourcecontrol, organization, repository, workflowname)=(github.com, coverbeck, viral-pipelines, align_and_count_multiple_report) already exists.
! at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2552)
! at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2284)
! at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:322)
! at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
! at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
! at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
! at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130)
! at jdk.internal.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
! at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
! at java.base/java.lang.reflect.Method.invoke(Method.java:566)
! at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118)
! at com.sun.proxy.$Proxy195.executeUpdate(Unknown Source)
! at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
! ... 86 common frames omitted
! Causing: org.hibernate.exception.ConstraintViolationException: could not execute statement
! at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:109)
! at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
! at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
! at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
! at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200)
! at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3379)
! at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3906)
! at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:107)
! at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
! at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
! at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
! at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)
! at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:344)
! at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:57)
! at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
! at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1356)
! at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1436)
! at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1649)
! at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1617)
! ... 72 common frames omitted
! Causing: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
! at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
! at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1626)
! at org.hibernate.query.internal.AbstractProducedQuery.uniqueResult(AbstractProducedQuery.java:1659)
! at io.dropwizard.hibernate.AbstractDAO.uniqueResult(AbstractDAO.java:151)
! at io.dockstore.webservice.jdbi.WorkflowVersionDAO.getWorkflowVersionByWorkflowIdAndVersionName(WorkflowVersionDAO.java:49)
! at io.dockstore.webservice.resources.AbstractWorkflowResource.addDockstoreYmlVersionToWorkflow(AbstractWorkflowResource.java:615)
! at io.dockstore.webservice.resources.AbstractWorkflowResource.createBioWorkflowsAndVersionsFromDockstoreYml(AbstractWorkflowResource.java:481)
! at io.dockstore.webservice.resources.AbstractWorkflowResource.githubWebhookRelease(AbstractWorkflowResource.java:354)
┆Issue is synchronized with this Jira Story ┆friendlyId: DOCK-1952 ┆sprint: Backlog ┆taskType: Story
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
@denis-yuen Just tried with off commit 769b1bcaf9070831d9b97b03fcef2a6e846e0f0a on develop, and I got a 418, but I think that’s OK because it’s a code for the lambda.
Good news: there is no bug in the web server
Embarrassing news: I had invoked the endpoint via Swagger in the browser, and because the endpoint took a while to finish executing, either Swagger or the browser (I didn’t bother to figure out which) retried the endpoint.
Switched to curl and it works.