DependencyTrack / dependency-track

Dependency-Track is an intelligent Component Analysis platform that allows organizations to identify and reduce risk in the software supply chain.
https://dependencytrack.org/
Apache License 2.0
2.59k stars 543 forks source link

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

Open ybelMekk opened 9 months ago

ybelMekk commented 9 months ago

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, apiserver/#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

msymons commented 9 months ago

With 4.11-SNAPSHOT, I am seeing something similar:

2023-12-11 15:25:50,762 INFO [BomUploadProcessingTask] Processing CycloneDX BOM uploaded to project: b900b6a8-f021-47d2-a390-7b56314e3dec
2023-12-11 15:25:52,644 WARN [Persist] Insert of object "org.dependencytrack.model.Component@46574d75" using statement "INSERT INTO "COMPONENT" ("AUTHOR","BLAKE2B_256","BLAKE2B_384","BLAKE2B_512","BLAKE3","CLASSIFIER","COPYRIGHT","CPE","DESCRIPTION","DIRECT_DEPENDENCIES","EXTENSION","EXTERNAL_REFERENCES","FILENAME","GROUP","INTERNAL","LAST_RISKSCORE","LICENSE","LICENSE_EXPRESSION","LICENSE_URL","MD5","NAME","TEXT","PARENT_COMPONENT_ID","PROJECT_ID","PUBLISHER","PURL","PURLCOORDINATES","LICENSE_ID","SHA1","SHA_256","SHA_384","SHA3_256","SHA3_384","SHA3_512","SHA_512","SUPPLIER","SWIDTAGID","UUID","VERSION") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" failed : ERROR: column "SUPPLIER" is of type bytea but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 634
2023-12-11 15:25:52,646 ERROR [BomUploadProcessingTask] Error while processing bom
javax.jdo.JDODataStoreException: Insert of object "org.dependencytrack.model.Component@46574d75" using statement "INSERT INTO "COMPONENT" ("AUTHOR","BLAKE2B_256","BLAKE2B_384","BLAKE2B_512","BLAKE3","CLASSIFIER","COPYRIGHT","CPE","DESCRIPTION","DIRECT_DEPENDENCIES","EXTENSION","EXTERNAL_REFERENCES","FILENAME","GROUP","INTERNAL","LAST_RISKSCORE","LICENSE","LICENSE_EXPRESSION","LICENSE_URL","MD5","NAME","TEXT","PARENT_COMPONENT_ID","PROJECT_ID","PUBLISHER","PURL","PURLCOORDINATES","LICENSE_ID","SHA1","SHA_256","SHA_384","SHA3_256","SHA3_384","SHA3_512","SHA_512","SUPPLIER","SWIDTAGID","UUID","VERSION") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" failed : ERROR: column "SUPPLIER" is of type bytea but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 634
    at org.datanucleus.api.jdo.JDOAdapter.getJDOExceptionForNucleusException(JDOAdapter.java:605)
    at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:702)
    at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:722)
    at alpine.persistence.AbstractAlpineQueryManager.persist(AbstractAlpineQueryManager.java:427)
    at org.dependencytrack.persistence.ComponentQueryManager.createComponent(ComponentQueryManager.java:341)
    at org.dependencytrack.persistence.QueryManager.createComponent(QueryManager.java:524)
    at org.dependencytrack.tasks.BomUploadProcessingTask.processComponent(BomUploadProcessingTask.java:250)
    at org.dependencytrack.tasks.BomUploadProcessingTask.inform(BomUploadProcessingTask.java:176)
    at alpine.event.framework.BaseEventService.lambda$publish$0(BaseEventService.java:110)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.postgresql.util.PSQLException: ERROR: column "SUPPLIER" is of type bytea but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 634
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
    at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:152)
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
    at org.datanucleus.store.rdbms.SQLController.executeStatementUpdate(SQLController.java:430)
    at org.datanucleus.store.rdbms.request.InsertRequest.execute(InsertRequest.java:520)
    at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObjectInTable(RDBMSPersistenceHandler.java:162)
    at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObject(RDBMSPersistenceHandler.java:138)
    at org.datanucleus.state.StateManagerImpl.internalMakePersistent(StateManagerImpl.java:4587)
    at org.datanucleus.state.StateManagerImpl.makePersistent(StateManagerImpl.java:4564)
    at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2014)
    at org.datanucleus.ExecutionContext.persistObjectInternal(ExecutionContext.java:320)
    at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:1862)
    at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1723)
    at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:697)
    ... 10 common frames omitted
2023-12-11 15:25:52,648 WARN [Retrieve] Search for object with id "org.dependencytrack.model.Project:255" using statement "SELECT 1 FROM "PROJECT" "A0" WHERE "A0"."ID" = ?" failed : ERROR: current transaction is aborted, commands ignored until end of transaction block
2023-12-11 15:25:52,649 WARN [General] ExecutionContext closed with active transaction, so rolling back the active transaction
2023-12-11 15:25:52,653 ERROR [LoggableUncaughtExceptionHandler] An unknown error occurred in an asynchronous event or notification thread
javax.jdo.JDODataStoreException: Search for object with id "org.dependencytrack.model.Project:255" using statement "SELECT 1 FROM "PROJECT" "A0" WHERE "A0"."ID" = ?" failed : ERROR: current transaction is aborted, commands ignored until end of transaction block
    at org.datanucleus.api.jdo.JDOAdapter.getJDOExceptionForNucleusException(JDOAdapter.java:605)
    at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1726)
    at alpine.persistence.AbstractAlpineQueryManager.detach(AbstractAlpineQueryManager.java:498)
    at org.dependencytrack.tasks.BomUploadProcessingTask.inform(BomUploadProcessingTask.java:228)
    at alpine.event.framework.BaseEventService.lambda$publish$0(BaseEventService.java:110)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
    at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:134)
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
    at org.datanucleus.store.rdbms.SQLController.executeStatementQuery(SQLController.java:548)
    at org.datanucleus.store.rdbms.request.LocateRequest.execute(LocateRequest.java:270)
    at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.locateObject(RDBMSPersistenceHandler.java:615)
    at org.datanucleus.state.StateManagerImpl.locate(StateManagerImpl.java:1278)
    at org.datanucleus.state.StateManagerImpl.validate(StateManagerImpl.java:5586)
    at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3446)
    at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:2928)
    at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1721)
    ... 6 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: column "SUPPLIER" is of type bytea but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 634
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
    at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:152)
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
    at org.datanucleus.store.rdbms.SQLController.executeStatementUpdate(SQLController.java:430)
    at org.datanucleus.store.rdbms.request.InsertRequest.execute(InsertRequest.java:520)
    at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObjectInTable(RDBMSPersistenceHandler.java:162)
    at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObject(RDBMSPersistenceHandler.java:138)
    at org.datanucleus.state.StateManagerImpl.internalMakePersistent(StateManagerImpl.java:4587)
    at org.datanucleus.state.StateManagerImpl.makePersistent(StateManagerImpl.java:4564)
    at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2014)
    at org.datanucleus.ExecutionContext.persistObjectInternal(ExecutionContext.java:320)
    at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:1862)
    at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1723)
    at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:697)
    at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:722)
    at alpine.persistence.AbstractAlpineQueryManager.persist(AbstractAlpineQueryManager.java:427)
    at org.dependencytrack.persistence.ComponentQueryManager.createComponent(ComponentQueryManager.java:341)
    at org.dependencytrack.persistence.QueryManager.createComponent(QueryManager.java:524)
    at org.dependencytrack.tasks.BomUploadProcessingTask.processComponent(BomUploadProcessingTask.java:250)
    at org.dependencytrack.tasks.BomUploadProcessingTask.inform(BomUploadProcessingTask.java:176)
    ... 4 common frames omitted
nscuro commented 9 months ago

Did you at some point deploy a snapshot image? There was a time window between https://github.com/DependencyTrack/dependency-track/pull/3090 and https://github.com/DependencyTrack/dependency-track/pull/3179 in which the SUPPLIER and MANUFACTURER columns indeed where of type BYTEA instead of TEXT. However, this was never released as a stable version.

@msymons I think the above is true for you as you're running a test instance that automatically pulls snapshot version if I'm not mistaken. You should be able to run the following SQL script to resolve this issue:

BEGIN;
UPDATE "COMPONENT" SET "SUPPLIER" = NULL WHERE "ID" > 0;
UPDATE "PROJECT" SET "MANUFACTURER" = NULL, "SUPPLIER" = NULL WHERE "ID" > 0;
ALTER TABLE "COMPONENT" ALTER COLUMN "SUPPLIER" SET DATA TYPE TEXT;
ALTER TABLE "PROJECT" ALTER COLUMN "MANUFACTURER" SET DATA TYPE TEXT;
ALTER TABLE "PROJECT" ALTER COLUMN "SUPPLIER" SET DATA TYPE TEXT;
COMMIT;

I just tested again, and the SUPPLIER and MANUFACTURER columns are correctly created with type TEXT for me, even when upgrading from 4.9.1 to 4.10.0. Uploading to an existing project works just fine both before and after the upgrade.

@ybelMekk Is there any chance you modified the original images, use a custom or modified PosgtreSQL JDBC driver, or any other kind of modification? Can you please double-check if the images you're using to test are indeed the officially released ones?

ybelMekk commented 9 months ago

@nscuro seems like hit the spot 🔪 ,we tried out a snapshot.. We migrated to a new database, and everything is functioning as expected, without the need for any cleanup. Thanks for that 😄 . For me, you can close this one.

nscuro commented 9 months ago

Thanks for reporting back @ybelMekk! Glad it's working again for you.

@msymons, any update from your side?

msymons commented 7 months ago

No problems that I have seen... but this has been difficult to check as my K8s system is not retaining logs and so every SNAPSHOT build results in a fresh log.