generator-jhipster: Cassandra backend tests failures

Overview of the issue

In our CI, the backend tests with Cassandra failed regularly and randomly… It needs to be fixed.

See https://github.com/jhipster/generator-jhipster/runs/406645977 See the discussion in our mailing list: https://groups.google.com/forum/#!topic/jhipster-dev/DdPPWTlIk0c

Motivation for or Use Case

Here an extract of logs:

[ERROR] io.github.jhipster.sample.web.rest.UserResourceIT.testUserToUserDTO  Time elapsed: 5.8 s  <<< ERROR!
com.datastax.driver.core.exceptions.TransportException: [localhost/127.0.0.1:32771] Connection has been closed
	at io.github.jhipster.sample.web.rest.UserResourceIT.initTest(UserResourceIT.java:127)
Caused by: com.datastax.driver.core.exceptions.TransportException: [localhost/127.0.0.1:32771] Connection has been closed

[INFO] Running io.github.jhipster.sample.web.rest.errors.ExceptionTranslatorIT
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.359 s - in io.github.jhipster.sample.web.rest.errors.ExceptionTranslatorIT
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   UserResourceIT.createUser:149 Status expected:<201> but was:<500>
[ERROR] Errors: 
[ERROR]   CassTestServiceImplEntityResourceIT.initTest:270 » CassandraConnectionFailure ...
[ERROR]   CassTestServiceImplEntityResourceIT.initTest:270 » CassandraConnectionFailure ...
[ERROR]   CassTestServiceImplEntityResourceIT.initTest:270 » CassandraConnectionFailure ...
[ERROR]   CassTestServiceImplEntityResourceIT.initTest:270 » CassandraConnectionFailure ...
[ERROR]   CassTestServiceImplEntityResourceIT.initTest:270 » CassandraConnectionFailure ...
[ERROR]   UserResourceIT.initTest:127 » OperationTimedOut [localhost/127.0.0.1:32771] Ti...
[ERROR]   UserResourceIT.initTest:127 » Transport [localhost/127.0.0.1:32771] Connection...
[ERROR]   UserResourceIT.initTest:127 » OperationTimedOut [localhost/127.0.0.1:32771] Ti...
[INFO] 
[ERROR] Tests run: 150, Failures: 1, Errors: 8, Skipped: 0
Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)

Current master

JHipster configuration

Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
sample-react-cassandra-session-redis@0.0.1-SNAPSHOT /home/runner/app
└── generator-jhipster@6.6.0 

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "baseName": "sampleReactCassandraSessionRedis",
    "packageName": "io.github.jhipster.sample",
    "packageFolder": "io/github/jhipster/sample",
    "serverPort": "8080",
    "authenticationType": "session",
    "cacheProvider": "redis",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "cassandra",
    "devDatabaseType": "cassandra",
    "prodDatabaseType": "cassandra",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "rememberMeKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "react",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "testFrameworks": ["gatling", "protractor"],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["en", "fr"],
    "blueprints": [],
    "jhipsterVersion": "6.6.0",
    "creationTimestamp": 1579850992835
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity CassBankAccount {
  userId UUID,
  name String required,
  bankNumber Integer,
  agencyNumber Long,
  lastOperationDuration Float,
  meanOperationDuration Double,
  balance BigDecimal required,
  lastOperationDate Date,
  active Boolean,
  picture ByteBuffer required,
  operationsFile ByteBuffer,
  accountType AccountTypeEnum
}
entity CassTestEntity {
  stringField String,
  stringRequiredField String required,
  stringMinlengthField String minlength(0),
  stringMaxlengthField String maxlength(20),
  stringPatternField String pattern(/^[a-zA-Z0-9]*$/),
  integerField Integer,
  integerRequiredField Integer required,
  integerMinField Integer min(0),
  integerMaxField Integer max(100),
  longField Long,
  longRequiredField Long required,
  longMinField Long min(0),
  longMaxField Long max(100),
  floatField Float,
  floatRequiredField Float required,
  floatMinField Float min(0),
  floatMaxField Float max(100),
  doubleRequiredField Double required,
  doubleMinField Double min(0),
  doubleMaxField Double max(100),
  bigDecimalRequiredField BigDecimal required,
  bigDecimalMinField BigDecimal min(0),
  bigDecimalMaxField BigDecimal max(100),
  dateField Date,
  dateRequiredField Date required,
  zonedDateTimeField ZonedDateTime,
  zonedDateTimeRequiredField ZonedDateTime required,
  booleanField Boolean,
  booleanRequiredField Boolean required,
  picture ByteBuffer required,
  operationsFile ByteBuffer
}
entity CassTestMapstructEntity {
  stringField String,
  stringRequiredField String required,
  stringMinlengthField String minlength(0),
  stringMaxlengthField String maxlength(20),
  stringPatternField String pattern(/^[a-zA-Z0-9]*$/),
  integerField Integer,
  integerRequiredField Integer required,
  integerMinField Integer min(0),
  integerMaxField Integer max(100),
  longField Long,
  longRequiredField Long required,
  longMinField Long min(0),
  longMaxField Long max(100),
  floatField Float,
  floatRequiredField Float required,
  floatMinField Float min(0),
  floatMaxField Float max(100),
  doubleRequiredField Double required,
  doubleMinField Double min(0),
  doubleMaxField Double max(100),
  bigDecimalRequiredField BigDecimal required,
  bigDecimalMinField BigDecimal min(0),
  bigDecimalMaxField BigDecimal max(100),
  dateField Date,
  dateRequiredField Date required,
  zonedDateTimeField ZonedDateTime,
  zonedDateTimeRequiredField ZonedDateTime required,
  booleanField Boolean,
  booleanRequiredField Boolean required,
  picture ByteBuffer required,
  operationsFile ByteBuffer
}
entity CassTestServiceClassEntity {
  stringField String,
  stringRequiredField String required,
  stringMinlengthField String minlength(0),
  stringMaxlengthField String maxlength(20),
  stringPatternField String pattern(/^[a-zA-Z0-9]*$/),
  integerField Integer,
  integerRequiredField Integer required,
  integerMinField Integer min(0),
  integerMaxField Integer max(100),
  longField Long,
  longRequiredField Long required,
  longMinField Long min(0),
  longMaxField Long max(100),
  floatField Float,
  floatRequiredField Float required,
  floatMinField Float min(0),
  floatMaxField Float max(100),
  doubleRequiredField Double required,
  doubleMinField Double min(0),
  doubleMaxField Double max(100),
  bigDecimalRequiredField BigDecimal required,
  bigDecimalMinField BigDecimal min(0),
  bigDecimalMaxField BigDecimal max(100),
  dateField Date,
  dateRequiredField Date required,
  zonedDateTimeField ZonedDateTime,
  zonedDateTimeRequiredField ZonedDateTime required,
  booleanField Boolean,
  booleanRequiredField Boolean required,
  picture ByteBuffer required,
  operationsFile ByteBuffer
}
entity CassTestServiceImplEntity {
  stringField String,
  stringRequiredField String required,
  stringMinlengthField String minlength(0),
  stringMaxlengthField String maxlength(20),
  stringPatternField String pattern(/^[a-zA-Z0-9]*$/),
  integerField Integer,
  integerRequiredField Integer required,
  integerMinField Integer min(0),
  integerMaxField Integer max(100),
  longField Long,
  longRequiredField Long required,
  longMinField Long min(0),
  longMaxField Long max(100),
  floatField Float,
  floatRequiredField Float required,
  floatMinField Float min(0),
  floatMaxField Float max(100),
  doubleRequiredField Double required,
  doubleMinField Double min(0),
  doubleMaxField Double max(100),
  bigDecimalRequiredField BigDecimal required,
  bigDecimalMinField BigDecimal min(0),
  bigDecimalMaxField BigDecimal max(100),
  dateField Date,
  dateRequiredField Date required,
  zonedDateTimeField ZonedDateTime,
  zonedDateTimeRequiredField ZonedDateTime required,
  booleanField Boolean,
  booleanRequiredField Boolean required,
  picture ByteBuffer required,
  operationsFile ByteBuffer
}
enum AccountTypeEnum {
  STANDARD,
  PREMIUM
}

dto CassBankAccount, CassTestMapstructEntity with mapstruct
service CassBankAccount, CassTestMapstructEntity, CassTestServiceImplEntity with serviceImpl
service CassTestServiceClassEntity with serviceClass
angularSuffix CassBankAccount with mySuffix
filter CassTestServiceClassEntity, CassTestServiceImplEntity

Environment and Tools

openjdk version “11.0.6” 2020-01-14 LTS OpenJDK Runtime Environment Zulu11.37+17-CA (build 11.0.6+10-LTS) OpenJDK 64-Bit Server VM Zulu11.37+17-CA (build 11.0.6+10-LTS, mixed mode)

git version 2.25.0

node: v12.14.0

npm: 6.13.4

yarn: 1.21.1

Docker version 3.0.8, build 2355349d

docker-compose version 1.22.0, build f46880fe

INFO! Congratulations, JHipster execution is complete!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 28 (28 by maintainers)

Most upvoted comments

@SudharakaP don’t forget to claim the bounty, very well deserved

you used the same modified React.yml than I suggested (which I could rename to CrazyCassandraBug.yml) so it’s ok !!!

I’m becoming crazy with this ticket Thanks a lot for this deep analyze. If downgrading the cassandra-unit-spring dependencies resolve the issue, then let’s do it !

With this fix, I’ll be able to do a release !

Here some more tests, and it doesn’t change anything:

  • remove Redis from config for testing only Cassandra
  • play with PoolOptions
  • play with SocketOptions
  • remove --batch-mode
  • change sysctl values

@pascalgrimaud This is what I try to implement, using the CqlSession… but did not have enough knowledge to finalise it.

I remember having this kind of issue. To fix it, I used DURABLE_WRITES = false (instead of true), for the keyspace creation only for integration testing.

@SudharakaP : to help reproducing in the CI, you can use this https://github.com/pascalgrimaud/generator-jhipster/blob/cassandra-backend-tests/.github/workflows/react.yml#L48-L63

So no need to commit / push, each time you tried something.

Here my results:

I stop my investigation for today, and will maybe retry it later if I’m motivated enough with this issue…

@SudharakaP :

It is something related to our Continuous Integration, as I couldn’t reproduce locally

@SudharakaP : if it can help, it seems to be more stable with Azure, less failures there See https://dev.azure.com/hipster-labs/jhipster-daily-builds/_build?definitionId=11&_a=summary