Open JJAM2014 opened 2 years ago
Errror Lanch app.jar as a docker FROM adoptopenjdk/openjdk12-openj9
What is the error?
I would appreciate if you could share a sample application.
Dear grails team
Method below worked with grails 4.x and groovy 2.x. However, Righ now this method are not working with grails 5.x and groovy 3.x the sorteDimensions list contains a number of domain entities and I think that this will launh many queries, however, before there were not many queris with groovy 2.x
def batchInsertTable(def tableName, sortedDimensions, batchData) {
if (batchData) {
def columnNames = sortedDimensions*.code.join(",")
String insertInto = "INSERT INTO ${tableName} ( ${columnNames} )"
def rows = batchData.collect { rowData ->
def valueArray = []
sortedDimensions.eachWithIndex { **Dimension** dim, int i ->
valueArray.add(castVariableDimension(dim, rowData[i]))
}
"(" + valueArray.join(",") + ")"
}
String values = " VALUES " + rows.join(", ")
String sqlScript = insertInto + " " + values
def db = new Sql(dataSource)
db.execute(sqlScript as String)
}
}
The sortedDimensions list containing domain entities but this example is transformed to a list of Dts. Because it is assumed that the high traffic of queries made to the Dimension table each time it is traversed is what causes the docker to crash.
method used after migration
void batchInsertTable(def tableName, sortedDimensions, batchData) {
List sortedDimensionsDto = []
sortedDimensions.each{ sortedDimension ->
DimensionDto sortedDimensionDto = new DimensionDto()
sortedDimensionDto.code = sortedDimension.code
sortedDimensionDto.dataType = sortedDimension.dataType.code
sortedDimensionsDto.add(sortedDimensionDto)
}
if (batchData) {
def columnNames = sortedDimensions*.code.join(",")
String insertInto = "INSERT INTO ${tableName} ( ${columnNames} )"
def rows = batchData.collect { rowData ->
def valueArray = []
sortedDimensionsDto.eachWithIndex { DimensionDto dim, int i ->
valueArray.add(castVariableDimension(dim, rowData[i]))
}
"(" + valueArray.join(",") + ")"
}
String values = " VALUES " + rows.join(", ")
String sqlScript = insertInto + " " + values
def db = new Sql(dataSource)
db.execute(sqlScript)
}
}
The question is , can the groovy 2.x mode of operation be simulated in groovy 3.x to continue using domain entities in the loops , or will it have to be refactored ?
very thanks in advance
best regards
José
@JJAM2014 Can you share any information about what error is happening?
Dear Jeff, The Error is that docker stops working when execute this method. So, I have only javacore dump file. best regards José
Expected Behavior
The application is in grails 4 version and works on a docker with this docker file
When I have migrated the application to version 5 it should continue to work
Actual Behaviour
The problem comes because when a query with many inserts is made from
docker stops working with grails version 5 and groovy 3.0.7
However, if the JAR is launched java -jar app.jar inside a docker from ubuntu image for instance, there will be not problem when a query is made.
Steps To Reproduce
Inside App with many inserts def db = new Sql(dataSource) b.executeInsert(sqlScript)
Errror Lanch app.jar as a docker FROM adoptopenjdk/openjdk12-openj9
OK Launch app.jar inside docker with linux image
Environment Information
DOCKER EKS JDK 11 grailsVersion=5.1.7 grailsGradlePluginVersion=5.1.3 groovyVersion=3.0.7 gorm.version=7.2.1 org.gradle.daemon=true org.gradle.parallel=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
Example Application
No response
Version
5