Open ybelMekk opened 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
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?
@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.
Thanks for reporting back @ybelMekk! Glad it's working again for you.
@msymons, any update from your side?
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.
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:
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
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