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

Possible ActiveRecord::JDBCError if DB language is not english (or date format is incorrect)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.6.6
    • Fix Version/s: 6.3
    • Component/s: Database
    • Labels:

      Description

      Although SonarQube does not require the database language to be 'English', the underlying Ruby on Rails framework (present in SonarQube versions below 6.3) may have requirements/expectations of its own especially with respect to Date formats.

      Observed stacktrace:

      2017.06.15 10:24:21 ERROR web[o.s.s.ui.JRubyFacade] Fail to render: http://sonar-host/dashboards/create
      ActiveRecord::JDBCError: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.: INSERT INTO [dashboards] ([user_id], [name], [description], [column_layout], [shared], [created_at], [updated_at], [is_global]) VALUES(1, N'aaa', N'', N'50%-50%', 0, '2017-06-15 10:24:21', '2017-06-15 10:24:21', 1)
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:222:in `insert_sql'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:195:in `jdbc_insert'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/query_cache.rb:26:in `insert_with_query_dirty'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/base.rb:2967:in `create'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/timestamp.rb:53:in `create_with_timestamps'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/callbacks.rb:266:in `create_with_callbacks'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/base.rb:2933:in `create_or_update'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/callbacks.rb:250:in `create_or_update_with_callbacks'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/base.rb:2583:in `save'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/validations.rb:1089:in `save_with_validation'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/dirty.rb:79:in `save_with_dirty'
      	org/jruby/RubyKernel.java:2227:in `send'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/transactions.rb:182:in `transaction'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/transactions.rb:196:in `save_with_transactions'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/transactions.rb:196:in `save_with_transactions'
      	/opt/sonarqube/latest/web/WEB-INF/app/controllers/dashboards_controller.rb:65:in `create'
      	org/jruby/RubyKernel.java:2223:in `send'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:1333:in `perform_action'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:617:in `call_filters'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/core_ext/benchmark.rb:17:in `ms'
      	jar:file:/opt/sonarqube/latest/lib/server/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:308:in `realtime'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/core_ext/benchmark.rb:17:in `ms'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/flash.rb:151:in `perform_action_with_flash'
      	org/jruby/RubyKernel.java:2223:in `send'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:532:in `process'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:606:in `process_with_filters'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:391:in `process'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:386:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/routing/route_set.rb:450:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:87:in `dispatch'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:85:in `dispatch'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:121:in `_call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
      	org/jruby/RubyProc.java:290:in `call'
      	org/jruby/RubyProc.java:224:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:29:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:9:in `cache'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:28:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/config/environment.rb:67:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/string_coercion.rb:25:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/rack-1.1.6/lib/rack/head.rb:9:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/rack-1.1.6/lib/rack/methodoverride.rb:24:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/params_parser.rb:15:in `call'
      	file:/opt/sonarqube/latest/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/session_store.rb:70:in `context'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/rack-1.1.6/lib/rack/session/abstract/id.rb:58:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/failsafe.rb:26:in `call'
      	/opt/sonarqube/latest/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:106:in `call'
      	file:/opt/sonarqube/latest/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:34:in `serve_rails'
      	file:/opt/sonarqube/latest/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:39:in `call'
      	file:/opt/sonarqube/latest/lib/server/jruby-rack-1.1.13.2.jar!/rack/handler/servlet.rb:22:in `call'
      

      Solution: make sure that the database uses English language setting and corresponding date time format

      Note: de-facto resolved since SonarQube 6.3 with the removal of Ruby on Rails dependency

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nicolas.bontoux Nicolas Bontoux
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: