Grails
  1. Grails
  2. GRAILS-8409

ConcurrentModificationException after upgrade from 2.0 RC1 to RC2 on start

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-RC2
    • Fix Version/s: 2.0-RC3
    • Component/s: None
    • Labels:
      None
    • Environment:
      Win7 64 Bit
      Latest STS
      Java 7 and latest Java 6 tried

      Description

      Hi,
      my application worked on RC1, it does not however on RC2.
      In addition to upgrading i did the following things:

      • Testing on JDK7 and latest JDK6
      • all variations of run-app, interactive mode first, run-war, prod run-war
      • no-reloading switch
      • updated to newest RC2 Spring dependencies (someone forgot to put that in grails core dependencies)
      • test on ressources 1.1.1 and 1.1.2-SNAPSHOT (due to the fix with springsecurity core)
      • some small modifications of the domain model according to what i see while debugging before it leaves into code areas without sources
      • creating an empty plugin and installing the same plugins to rule out it has something to do with conflicting plugins
      • cleared out ivy caches and other generated files

      Interestingly sometime the server starts (app does not) even though exceptions occurs.

      The exception is happening somewhere in code I cannot see. I tried to install the missing code with the eclipse-scripts (great, i didnt know of its existence before) and the new refresh-... option in grails 2.x - i guess its generated code. If so, how do i add this to STS?

      1. stacktrace.log
        41 kB
        Andre
      2. stacktrace.log
        31 kB
        Andre
      3. stacktraceConsole.txt
        17 kB
        Andre

        Activity

        Hide
        Andre added a comment -

        looking at the code where it occurs i see that we do the if condition check, i doubt the collection would be modified by that and then we have the bindSubClass that doesnt directly have access to the collection. Does it mean some other thread modifies this?

        FYI the class that is being bound her has 18 subclasses inheriting from it

        for (GrailsDomainClass sub : subClasses) {
        if (sub.getClazz().getSuperclass().equals(domainClass.getClazz()))

        { bindSubClass(sub, parent, mappings, sessionFactoryBeanName); }

        }

        so how can it occur that we, while iterating, modify the subClasses Collection (from somewhere else?) little bit difficult to understand as I see the code for the first time.

        Show
        Andre added a comment - looking at the code where it occurs i see that we do the if condition check, i doubt the collection would be modified by that and then we have the bindSubClass that doesnt directly have access to the collection. Does it mean some other thread modifies this? FYI the class that is being bound her has 18 subclasses inheriting from it for (GrailsDomainClass sub : subClasses) { if (sub.getClazz().getSuperclass().equals(domainClass.getClazz())) { bindSubClass(sub, parent, mappings, sessionFactoryBeanName); } } so how can it occur that we, while iterating, modify the subClasses Collection (from somewhere else?) little bit difficult to understand as I see the code for the first time.
        Hide
        Graeme Rocher added a comment -

        It would help if you attach an example that reproduces the issue, but we will investigate

        Show
        Graeme Rocher added a comment - It would help if you attach an example that reproduces the issue, but we will investigate
        Hide
        Andre added a comment -

        Unfortunately i havent been able to isolate it yet, i would have to attach the whole project, which i cant. I brought the number of subclasses down to 5, that's not it. Next time i got time to debug, i ll try to monitor all accesses to this hashmap. For now i have to downgrade to rc1

        Show
        Andre added a comment - Unfortunately i havent been able to isolate it yet, i would have to attach the whole project, which i cant. I brought the number of subclasses down to 5, that's not it. Next time i got time to debug, i ll try to monitor all accesses to this hashmap. For now i have to downgrade to rc1
        Hide
        Patraphong Sukhonpitumart added a comment -

        We ran into this issue too.

        I've attached a cut down version of our project, "testproject.zip". We suspect that the error has something to do with the unique constraint defined in DeductionReturnRequest. When we remove the constraint, the project starts BUT it seems Grails generates a wrong database schema resulting in the [deduction_return_request] table not being created. In our full version of the project, the faulty schema affects not only domain classes with unique constraints but others too.

        Show
        Patraphong Sukhonpitumart added a comment - We ran into this issue too. I've attached a cut down version of our project, "testproject.zip". We suspect that the error has something to do with the unique constraint defined in DeductionReturnRequest. When we remove the constraint, the project starts BUT it seems Grails generates a wrong database schema resulting in the [deduction_return_request] table not being created. In our full version of the project, the faulty schema affects not only domain classes with unique constraints but others too.
        Hide
        Graeme Rocher added a comment -

        @Patraphong - I don't see how your issue is related. You're getting that error because you're using tablePerSubclass and trying to apply a unique constraint on child where the column is in a different table. Something that is not, as far as I am aware, supported yet. Raise a separate feature request for that.

        Show
        Graeme Rocher added a comment - @Patraphong - I don't see how your issue is related. You're getting that error because you're using tablePerSubclass and trying to apply a unique constraint on child where the column is in a different table. Something that is not, as far as I am aware, supported yet. Raise a separate feature request for that.
        Hide
        Graeme Rocher added a comment -

        I believe this should be resolved by this commit:

        https://github.com/grails/grails-core/commit/ee71cb114e56bd8b1648d647d3b3c4eec4d32420

        However, without an example I cannot verify. If you can test when RC3 is out then I can close this issue.

        Show
        Graeme Rocher added a comment - I believe this should be resolved by this commit: https://github.com/grails/grails-core/commit/ee71cb114e56bd8b1648d647d3b3c4eec4d32420 However, without an example I cannot verify. If you can test when RC3 is out then I can close this issue.
        Hide
        Andre added a comment -

        Unfortunately it didnt fix it, i downloaded the latest snaphot from Hudson and patached GrailsDomainBinder classes and source.

        At this time i have even simplified the domain model considerably hoping it would go away, it did not.
        Please not this did not occur in RC1.

        i ll attach a new stacktrace

        Show
        Andre added a comment - Unfortunately it didnt fix it, i downloaded the latest snaphot from Hudson and patached GrailsDomainBinder classes and source. At this time i have even simplified the domain model considerably hoping it would go away, it did not. Please not this did not occur in RC1. i ll attach a new stacktrace
        Hide
        Graeme Rocher added a comment -

        You'll need to attach an example that reproduces the problem then I'm afraid

        Show
        Graeme Rocher added a comment - You'll need to attach an example that reproduces the problem then I'm afraid

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Andre
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development