1

I've found a strange issue when saving or updating several objects in Grails with MongoDB. Currently I'm using Grails 2.2.3 and MongoDB plugin 1.3.0.

The problem seems to be that the instances of MiUsuario are never GC neither when I manually call the GC. In our main application we don't make batch updates, but when doing load tests (with JMeter and monitoring JVM with Java VisualVM) this problem causes memory filling and Tomcat stops responding.

I've created a small new application to show the problem.

A simple domain object:

class MiUsuario {
    ObjectId id
    String nickName
}

My controller:

import pruebasrendimiento.Prueba

class MiUsuarioController {
    def doLogin(String privateKey, String id){
        MiUsuario user = MiUsuario.get(id)
        user.nickName = new Random().nextInt().toString()
        user.save(failOnError:true)
        render 'ok'
    }
}

My BuildConfig (Just the dependencies and plugins part):

    dependencies {
    }
    plugins {
    //      runtime ":hibernate:$grailsVersion" 
            runtime ":jquery:1.8.3"
            runtime ":resources:1.2"
            build ":tomcat:$grailsVersion"
    //      runtime ":database-migration:1.3.2"
    //      compile ':cache:1.0.1'
        runtime ":mongodb:1.3.0"
    }

I've also tried something that Burt said a long time ago (http://burtbeckwith.com/blog/?p=73), but DomainClassGrailsPlugin.PROPERTY_INSTANCE_MAP.get().clear() doesn't make any difference. And the other option that's said in that page, RequestContextHolder.resetRequestAttributes(), gives me an exception.

1 Answer 1

1

I had similar problem and it solves upgrading to grails 2.3.1. Try it.

1
  • I'll try and let you know
    – Eylen
    Oct 30, 2013 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.