DependencyTrack / DependencyTrack/dependency-track

Version 4.10.0 encounters difficulties when attempting to create projects if there are pre-existing projects from earlier versions.

Open
#3,291 5 comments 0 reactions 0 assignees View on GitHub
pending more information
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

### Current Behavior

I have a production instance currently running version 4.9.1.
After upgrading it to version 4.10.0, I encountered an issue while attempting to add a project, resulting in a 500: Uncaught internal server error. Upon reviewing the error logs, it appears that there is an issue related to the SUPPLIER field in the data model:

```
"@timestamp":"2023-12-11T13:34:27.64Z","@version":"1","message":"Insert of object \"org.dependencytrack.model.Project@60e8cf9c\" using statement \"INSERT INTO \"PROJECT\" (\"ACTIVE\",\"AUTHOR\",\"CLASSIFIER\",\"CPE\",\"DESCRIPTIO
N\",\"DIRECT_DEPENDENCIES\",\"EXTERNAL_REFERENCES\",\"GROUP\",\"LAST_BOM_IMPORTED\",\"LAST_BOM_IMPORTED_FORMAT\",\"LAST_RISKSCORE\",\"MANUFACTURER\",\"NAME\",\"PARENT_PROJECT_ID\",\"PUBLISHER\",\"PURL\",\"SUPPLIER\",\"SWIDTAGID\",
\"UUID\",\"VERSION\") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\" failed : ERROR: column \"SUPPLIER\" is of type bytea but expression is of type character varying\n Hint: You will need to rewrite or cast the expression.\n
Position: 356","logger_name":"DataNucleus.Datastore.Persist","thread_name":"qtp1499867659-529","level":"WARN","level_value":30000}
{"@timestamp":"2023-12-11T13:34:27.641Z","@version":"1","message":"ExecutionContext closed with active transaction, so rolling back the active transaction","logger_name":"DataNucleus.General","thread_name":"qtp1499867659-529","lev
el":"WARN","level_value":30000}
{"@timestamp":"2023-12-11T13:34:27.643Z","@version":"1","message":"Uncaught internal server error","logger_name":"alpine.server.resources.GlobalExceptionHandler","thread_name":"qtp1499867659-529","level":"ERROR","level_value":4000
0,"stack_trace":"javax.jdo.JDODataStoreException: Insert of object \"org.dependencytrack.model.Project@60e8cf9c\" using statement \"INSERT INTO \"PROJECT\" (\"ACTIVE\",\"AUTHOR\",\"CLASSIFIER\",\"CPE\",\"DESCRIPTION\",\"DIRECT_DEP
ENDENCIES\",\"EXTERNAL_REFERENCES\",\"GROUP\",\"LAST_BOM_IMPORTED\",\"LAST_BOM_IMPORTED_FORMAT\",\"LAST_RISKSCORE\",\"MANUFACTURER\",\"NAME\",\"PARENT_PROJECT_ID\",\"PUBLISHER\",\"PURL\",\"SUPPLIER\",\"SWIDTAGID\",\"UUID\",\"VERSI
ON\") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\" failed : ERROR: column \"SUPPLIER\" is of type bytea but expression is of type character varying\n Hint: You will need to rewrite or cast the expression.\n Position: 356\n
\tat org.datanucleus.api.jdo.JDOAdapter.getJDOExceptionForNucleusException(JDOAdapter.java:605)\n\tat org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:702)\n\tat org.datanucleus.api.jdo.JD
OPersistenceManager.makePersistent(JDOPersistenceManager.java:722)\n\tat alpine.persistence.AbstractAlpineQueryManager.persist(AbstractAlpineQueryManager.java:427)\n\tat org.dependencytrack.persistence.ProjectQueryManager.createPr
oject(ProjectQueryManager.java:505)\n\tat org.dependencytrack.persistence.QueryManager.createProject(QueryManager.java:431)\n\tat org.dependencytrack.resources.v1.ProjectResource.createProject(ProjectResource.java:254)\n\tat java.
base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)\n\tat java.base/java.lang.reflect.Method.invoke(Unknown Source)\n\tat org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.la
mbda$static$0(ResourceMethodInvocationHandlerFactory.java:52)\n\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146)\n\tat org.glassfish.jersey.se
.ServletHandler$Chain.doFilter(ServletHandler.java:1635)\n\tat alpine.server.filters.WhitelistUrlFilter.doFilter(WhitelistUrlFilter.java:166)\n\tat org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210)\n\tat org.e
clipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandle
r.java:131)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)\n\tat org.eclipse.jetty.server.handler.ScopedHandl
er.nextHandle(ScopedHandler.java:223)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)\n\tat org.eclip
se.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler
.java:484)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)\n\tat org.eclipse.jetty.server.handler.Conte
xtHandler.doScope(ContextHandler.java:1306)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)\n\tat org.eclips
e.jetty.server.Server.handle(Server.java:563)\n\tat org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)\n\tat org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)\n\tat org.eclip
se.jetty.server.HttpChannel.handle(HttpChannel.java:501)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.jav
a:314)\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)\n\tat org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)\n\tat org.eclipse.jetty.util.thread.strategy.AdaptiveExec
utionStrategy.runTask(AdaptiveExecutionStrategy.java:421)\n\tat org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)\n\tat org.eclipse.jetty.util.thread.strategy.Adaptive
ExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)\n\tat org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)\n\tat org.eclipse.jetty.util.thread.ReservedThreadExec
utor$ReservedThread.run(ReservedThreadExecutor.java:411)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.
java:1194)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)\n\tat java.base/java.lang.Thread.run(Unknown Source)\nCaused by: org.postgresql.util.PSQLException: ERROR: column \"SUPPLIER\"
is of type bytea but expression is of type character varying\n Hint: You will need to rewrite or cast the expression.\n Position: 356\n\tat org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:271
3)\n\tat org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)\n\tat org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)\n\tat org.postgresql.jdbc.PgStatement.executeInternal
(PgStatement.java:498)\n\tat org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)\n\tat org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)\n\tat org.postgresql.jdbc.PgPreparedStatement.
executeUpdate(PgPreparedStatement.java:152)\n\tat com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)\n\tat com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPrepa
redStatement.java)\n\tat org.datanucleus.store.rdbms.SQLController.executeStatementUpdate(SQLController.java:430)\n\tat org.datanucleus.store.rdbms.request.InsertRequest.execute(InsertRequest.java:520)\n\tat org.datanucleus.store.
rdbms.RDBMSPersistenceHandler.insertObjectInTable(RDBMSPersistenceHandler.java:162)\n\tat org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObject(RDBMSPersistenceHandler.java:138)\n\tat org.datanucleus.state.StateManagerI
mpl.internalMakePersistent(StateManagerImpl.java:4587)\n\tat org.datanucleus.state.StateManagerImpl.makePersistent(StateManagerImpl.java:4564)\n\tat org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.j
ava:2014)\n\tat org.datanucleus.ExecutionContext.persistObjectInternal(ExecutionContext.java:320)\n\tat org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:1862)\n\tat org.datanucleus.ExecutionContextI
mpl.persistObject(ExecutionContextImpl.java:1723)\n\tat org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:697)\n\t... 73 common frames omitted\n"}
```

This issue does not occur when using a fresh instance of version 4.10.0, especially when there are no pre-existing projects in the database. I observed that the problem arises specifically when attempting to create projects in an environment that has been upgraded from version 4.9.1 to 4.10.0.

could be related to: [apiserver/#3090](https://github.com/DependencyTrack/dependency-track/pull/3090), [apiserver/#3179](https://github.com/DependencyTrack/dependency-track/pull/3179)

I think the error starts here: https://github.com/DependencyTrack/dependency-track/blob/e827c0b2f4e775b0b77ec428e43fb616311e4c86/src/main/java/org/dependencytrack/resources/v1/ProjectResource.java#L254

### Steps to Reproduce

1. Create projects with 4.9.1
2. Update to 4.10.0
3. Try to create projects
4. Rollback to 4.9.1, create projects works

### Expected Behavior

Projects created with no error

### Dependency-Track Version

4.10.0

### Dependency-Track Distribution

Container Image

### Database Server

PostgreSQL

### Database Server Version

15

### Browser

Google Chrome

### Checklist

- [X] I have read and understand the [contributing guidelines](https://github.com/DependencyTrack/dependency-track/blob/master/CONTRIBUTING.md#filing-issues)
- [X] I have checked the [existing issues](https://github.com/DependencyTrack/dependency-track/issues) for whether this defect was already reported

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.