Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-4066

When for any reason we can't manage to insert in DB a project measure or a measure data, the error doesn't provide any contextual information

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6
    • Component/s: Plugin API
    • Labels:
      None

      Description

      In such case, we'd like to know on which resource and metric we unsuccessfully tried to insert a measure.

      Example of meaningless error :

      	at org.sonar.jpa.session.JpaDatabaseSession.internalSave(JpaDatabaseSession.java:128)
      	at org.sonar.jpa.session.JpaDatabaseSession.save(JpaDatabaseSession.java:95)
      	at org.sonar.api.database.model.MeasureModel.save(MeasureModel.java:494)
      	at org.sonar.batch.index.MeasurePersister.saveMeasure(MeasurePersister.java:80)
      	at org.sonar.batch.index.DefaultPersistenceManager.saveMeasure(DefaultPersistenceManager.java:87)
      	at org.sonar.batch.index.DefaultIndex.addMeasure(DefaultIndex.java:175)
      	at org.sonar.batch.DefaultSensorContext.saveMeasure(DefaultSensorContext.java:122)
      	at org.sonar.plugins.cpd.SonarEngine.save(SonarEngine.java:202)
      	at org.sonar.plugins.cpd.SonarEngine.detect(SonarEngine.java:152)
      	at org.sonar.plugins.cpd.SonarEngine.analyse(SonarEngine.java:96)
      	at org.sonar.plugins.cpd.CpdSensor.analyse(CpdSensor.java:76)
      	at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
      	at org.sonar.batch.phases.Phases.execute(Phases.java:93)
      	at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:139)
      	at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      	at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:115)
      	at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:110)
      	at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:105)
      	at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      	at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:111)
      	at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      	at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:73)
      	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:60)
      	at org.sonar.maven.SonarMojo.execute(SonarMojo.java:150)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:227)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [org.sonar.api.database.model.MeasureData]
      	at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
      	at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)
      	at org.sonar.jpa.session.JpaDatabaseSession.internalSave(JpaDatabaseSession.java:122)
      	... 41 more
      Caused by: org.hibernate.exception.GenericJDBCException: could not insert: [org.sonar.api.database.model.MeasureData]
      	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
      	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
      	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      	at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2176)
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656)
      	at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
      	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
      	at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
      	at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
      	at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
      	at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
      	at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
      	at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
      	at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
      	at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:646)
      	at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:620)
      	at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:624)
      	at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)
      	... 42 more
      Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (21707508 > 10485760). You can change this value on the server by setting the max_allowed_packet' variable.
      	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3291)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1983)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
      	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      	at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
      	at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
      	... 57 more
      

        Attachments

          Activity

            People

            Assignee:
            henryju OLD - Julien HENRY
            Reporter:
            freddy.mallet Freddy Mallet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: