TheHive-Project / TheHive

TheHive: a Scalable, Open Source and Free Security Incident Response Platform
https://thehive-project.org
GNU Affero General Public License v3.0
3.43k stars 623 forks source link

[Bug] Migration to 4.1.0-1 from 4.0 #1860

Closed dtokkk closed 3 years ago

dtokkk commented 3 years ago

Request Type

Bug

Work Environment

Question Answer
OS version (server) RedHat 7
TheHive version / git hash 4.1.0-1
Package Type RPM
Database Storage Cassandra 3.11.7-1
Database Index ElasticSearch 6.8.4.-1

Problem Description

Error creating a new case: "Case creation CTRL adding this property for key _label and value Case violates a uniqueness constrain CaseNumber." The old cases disappeared. The case templates, the dashboards, and the custom fields are working fine (create, delete, update).

Steps to Reproduce

  1. yum install thehive4
  2. Configure the database index https://docs.thehive-project.org/thehive/operations/update/
  3. Restart the hive
  4. Create a case. The same error for a new Organisation.

Complementary information

2021-03-21 00:06:12,420 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-10 [0000008f|10903e97] An error occurs (Could not process individual retrieval call ), retrying (1) 2021-03-21 00:06:12,424 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-10 [0000008f|10903e97] An error occurs (Adding this property for key [_label] and value [Case] violates a uniqueness constraint [CaseNumber]), retrying (1) 2021-03-21 00:06:12,432 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-12 [0000008f|58bb3852] An error occurs (Could not process individual retrieval call ), retrying (1) 2021-03-21 00:06:12,435 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-12 [0000008f|10903e97] An error occurs (Adding this property for key [_label] and value [Case] violates a uniqueness constraint [CaseNumber]), retrying (2) 2021-03-21 00:06:12,873 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-12 [|2ccd3dfc] An error occurs (Could not process individual retrieval call ), retrying (1) 2021-03-21 00:06:12,877 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-12 [|] An error occurs (Adding this property for key [_label] and value [Case] violates a uniqueness constraint [CaseNumber]), retrying (3) 2021-03-21 00:06:13,782 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-12 [|0a213f0e] An error occurs (Could not process individual retrieval call ), retrying (1) 2021-03-21 00:06:13,785 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-12 [|] An error occurs (Adding this property for key [_label] and value [Case] violates a uniqueness constraint [CaseNumber]), retrying (4) 2021-03-21 00:06:14,931 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-11 [|27cadc65] An error occurs (Could not process individual retrieval call ), retrying (1) 2021-03-21 00:06:14,933 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-11 [|] An error occurs (Adding this property for key [_label] and value [Case] violates a uniqueness constraint [CaseNumber]), retrying (5) 2021-03-21 00:06:15,991 [WARN] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-11 [|38982269] An error occurs (Could not process individual retrieval call ), retrying (1) 2021-03-21 00:06:15,995 [WARN] from org.thp.scalligraph.ErrorHandler in application-akka.actor.default-dispatcher-10 [0000008f|] POST /api/case returned 400 org.thp.scalligraph.models.DatabaseException: Violation of database schema at org.thp.scalligraph.janus.JanusDatabase$$anonfun$1.applyOrElse(JanusDatabase.scala:267) at org.thp.scalligraph.janus.JanusDatabase$$anonfun$1.applyOrElse(JanusDatabase.scala:265) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38) at scala.util.Failure.recoverWith(Try.scala:236) at org.thp.scalligraph.janus.JanusDatabase.tryTransaction(JanusDatabase.scala:265) at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$authTransaction$1(Entrypoint.scala:77) at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$auth$1(Entrypoint.scala:86) at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$3(Entrypoint.scala:107) at org.scalactic.Good.fold(Or.scala:1229) at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$2(Entrypoint.scala:107) at org.thp.scalligraph.DiagnosticContext$.$anonfun$withRequest$2(ContextPropagatingDisptacher.scala:99) at org.thp.scalligraph.DiagnosticContext$.saveDiagnosticContext(ContextPropagatingDisptacher.scala:106) at org.thp.scalligraph.DiagnosticContext$.withRequest(ContextPropagatingDisptacher.scala:97) at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$1(Entrypoint.scala:107) at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.$anonfun$invokeBlock$2(SessionAuthSrv.scala:100) at scala.Option.fold(Option.scala:251) at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:98) at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:95) at play.api.mvc.ActionBuilder$$anon$10.$anonfun$invokeBlock$2(Action.scala:408) at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:441) at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:439) at play.api.mvc.ActionBuilder$$anon$10.invokeBlock(Action.scala:408) at play.api.mvc.ActionBuilder$$anon$10.invokeBlock(Action.scala:404) at play.api.mvc.ActionBuilder$$anon$9.apply(Action.scala:379) at play.api.mvc.Action.$anonfun$apply$4(Action.scala:82) at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:168) at scala.util.Try$.apply(Try.scala:213) at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:168) at scala.Function1.$anonfun$andThen$1(Function1.scala:57) at scala.Function1.$anonfun$andThen$1(Function1.scala:57) at scala.Function1.$anonfun$andThen$1(Function1.scala:57) at play.api.libs.streams.StrictAccumulator.run(Accumulator.scala:200) at play.core.server.AkkaHttpServer.$anonfun$runAction$4(AkkaHttpServer.scala:418) at akka.http.scaladsl.util.FastFuture$.strictTransform$1(FastFuture.scala:41) at akka.http.scaladsl.util.FastFuture$.$anonfun$transformWith$3(FastFuture.scala:51) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at org.thp.scalligraph.ContextPropagatingDisptacher$$anon$1.$anonfun$execute$2(ContextPropagatingDisptacher.scala:56) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at org.thp.scalligraph.DiagnosticContext$.$anonfun$withDiagnosticContext$2(ContextPropagatingDisptacher.scala:91) at org.thp.scalligraph.DiagnosticContext$.saveDiagnosticContext(ContextPropagatingDisptacher.scala:106) at org.thp.scalligraph.DiagnosticContext$.withDiagnosticContext(ContextPropagatingDisptacher.scala:89) at org.thp.scalligraph.DiagnosticContext$$anon$2.withContext(ContextPropagatingDisptacher.scala:74) at org.thp.scalligraph.ContextPropagatingDisptacher$$anon$1.$anonfun$execute$1(ContextPropagatingDisptacher.scala:56) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) Caused by: org.janusgraph.core.SchemaViolationException: Adding this property for key [_label] and value [Case] violates a uniqueness constraint [CaseNumber] at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.addProperty(StandardJanusGraphTx.java:832) at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.addProperty(StandardJanusGraphTx.java:754) at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.addProperty(StandardJanusGraphTx.java:750) at org.janusgraph.graphdb.vertices.AbstractVertex.property(AbstractVertex.java:152) at org.janusgraph.core.JanusGraphVertex.property(JanusGraphVertex.java:72) at org.janusgraph.core.JanusGraphVertex.property(JanusGraphVertex.java:33) at org.thp.scalligraph.models.SingleMapping.setProperty(Mapping.scala:189) at org.thp.scalligraph.janus.JanusDatabase.createVertex(JanusDatabase.scala:459) at org.thp.scalligraph.services.VertexSrv.createEntity(VertexSrv.scala:40) at org.thp.thehive.services.CaseSrv.createEntity(CaseSrv.scala:66) at org.thp.thehive.services.CaseSrv.$anonfun$create$4(CaseSrv.scala:83) at scala.util.Success.flatMap(Try.scala:251) at org.thp.thehive.services.CaseSrv.create(CaseSrv.scala:82) at org.thp.thehive.controllers.v0.CaseCtrl.$anonfun$create$11(CaseCtrl.scala:59) at scala.util.Success.flatMap(Try.scala:251) at org.thp.thehive.controllers.v0.CaseCtrl.$anonfun$create$9(CaseCtrl.scala:58) at scala.util.Success.flatMap(Try.scala:251) at org.thp.thehive.controllers.v0.CaseCtrl.$anonfun$create$6(CaseCtrl.scala:57) at scala.util.Success.flatMap(Try.scala:251) at org.thp.thehive.controllers.v0.CaseCtrl.$anonfun$create$4(CaseCtrl.scala:51) at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$authTransaction$2(Entrypoint.scala:77) at org.thp.scalligraph.janus.JanusDatabase.$anonfun$tryTransaction$10(JanusDatabase.scala:259) at scala.util.Try$.apply(Try.scala:213) at org.thp.scalligraph.janus.JanusDatabase.$anonfun$tryTransaction$8(JanusDatabase.scala:259) at org.thp.scalligraph.utils.DelayRetry$$anonfun$withTry$1.$anonfun$applyOrElse$8(Retry.scala:93) at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659) at scala.util.Success.$anonfun$map$1(Try.scala:255) at scala.util.Success.map(Try.scala:213) at scala.concurrent.Future.$anonfun$map$1(Future.scala:292) at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33) at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33) ... 14 common frames omitted

nadouani commented 3 years ago

Can you please share the report from the Administration > Platform Status page?

dtokkk commented 3 years ago

Platform-Status-Report-20210321-13_18-05_00.txt

In the data index status only the alert has status OK. I use the option "Reindex" and now all is showing status OK and all is working fine. Thank you so much.